Browse Source

Fix #14 (and a bit more) : Correct several spelling/translation errors in the admin interface

SimonBoulier 7 years ago
parent
commit
f18aa84f69

+ 19 - 0
coin/billing/migrations/0008_auto_20170802_2021.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('billing', '0007_auto_20170801_1530'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='invoice',
+            name='status',
+            field=models.CharField(default='open', max_length=50, verbose_name='statut', choices=[('open', '\xc0 payer'), ('closed', 'R\xe9gl\xe9e'), ('trouble', 'Litige')]),
+        ),
+    ]

+ 2 - 2
coin/billing/models.py

@@ -109,8 +109,8 @@ class InvoiceQuerySet(models.QuerySet):
 class Invoice(models.Model):
 class Invoice(models.Model):
 
 
     INVOICES_STATUS_CHOICES = (
     INVOICES_STATUS_CHOICES = (
-        ('open', 'A payer'),
-        ('closed', 'Reglée'),
+        ('open', 'À payer'),
+        ('closed', 'Réglée'),
         ('trouble', 'Litige')
         ('trouble', 'Litige')
     )
     )
 
 

+ 151 - 0
coin/isp_database/migrations/0014_auto_20170802_2021.py

@@ -0,0 +1,151 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import multiselectfield.db.fields
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('isp_database', '0013_merge'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='chatroom',
+            options={'verbose_name': 'Salon de discussions', 'verbose_name_plural': 'Salons de discussions'},
+        ),
+        migrations.AlterModelOptions(
+            name='coveredarea',
+            options={'verbose_name': 'Zone couverte', 'verbose_name_plural': 'Zones couvertes'},
+        ),
+        migrations.AlterModelOptions(
+            name='ispinfo',
+            options={'verbose_name': 'Information du FAI', 'verbose_name_plural': 'Informations du FAI'},
+        ),
+        migrations.AlterModelOptions(
+            name='otherwebsite',
+            options={'verbose_name': 'Autre site Internet', 'verbose_name_plural': 'Autres sites Internet'},
+        ),
+        migrations.AlterModelOptions(
+            name='registeredoffice',
+            options={'verbose_name': 'Si\xe8ge social', 'verbose_name_plural': 'Si\xe8ges sociaux'},
+        ),
+        migrations.AlterField(
+            model_name='coveredarea',
+            name='name',
+            field=models.CharField(max_length=512, verbose_name='Nom'),
+        ),
+        migrations.AlterField(
+            model_name='coveredarea',
+            name='technologies',
+            field=multiselectfield.db.fields.MultiSelectField(max_length=42, verbose_name='Technologie', choices=[('ftth', 'FTTH'), ('dsl', '*DSL'), ('wifi', 'WiFi'), ('vpn', 'VPN'), ('cube', 'Brique Internet')]),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='creationDate',
+            field=models.DateField(help_text='Date de cr\xe9ation de la structure l\xe9gale', null=True, verbose_name='Date de cr\xe9ation', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='description',
+            field=models.TextField(help_text='Description courte du projet', verbose_name='Description', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='email',
+            field=models.EmailField(help_text='Adresse courriel de contact', max_length=254, verbose_name='Courriel'),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='ffdnMemberSince',
+            field=models.DateField(help_text='Date \xe0 laquelle le FAI a rejoint la F\xe9d\xe9ration FDN', null=True, verbose_name='Membre de FFDN depuis', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='latitude',
+            field=models.FloatField(help_text='Coordonn\xe9es latitudinales du si\xe8ge', null=True, verbose_name='Latitude', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='logoURL',
+            field=models.URLField(help_text='Adresse HTTP(S) du logo du FAI', verbose_name='URL du logo', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='longitude',
+            field=models.FloatField(help_text='Coordonn\xe9es longitudinales du si\xe8ge', null=True, verbose_name='Longitude', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='mainMailingList',
+            field=models.EmailField(help_text='Principale liste de discussion publique', max_length=254, verbose_name='Liste de discussion principale', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='name',
+            field=models.CharField(help_text='Nom du FAI', max_length=512, verbose_name='Nom'),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='phone_number',
+            field=models.CharField(help_text='Num\xe9ro de t\xe9l\xe9phone de contact principal', max_length=25, verbose_name='Num\xe9ro de t\xe9l\xe9phone', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='progressStatus',
+            field=models.PositiveSmallIntegerField(blank=True, help_text="\xc9tat d'avancement du FAI", null=True, verbose_name="\xc9tat d'avancement", validators=[django.core.validators.MaxValueValidator(7)]),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='shortname',
+            field=models.CharField(help_text='Nom plus court', max_length=15, verbose_name='Abr\xe9viation', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='ispinfo',
+            name='website',
+            field=models.URLField(help_text='Adresse URL du site Internet', verbose_name='URL du site Internet', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='otherwebsite',
+            name='name',
+            field=models.CharField(max_length=512, verbose_name='Nom'),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='country_name',
+            field=models.CharField(max_length=512, verbose_name='Pays'),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='extended_address',
+            field=models.CharField(max_length=512, verbose_name='Adresse compl\xe9mentaire', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='locality',
+            field=models.CharField(max_length=512, verbose_name='Ville'),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='post_office_box',
+            field=models.CharField(max_length=512, verbose_name='Bo\xeete postale', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='postal_code',
+            field=models.CharField(max_length=512, verbose_name='Code postal', blank=True),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='region',
+            field=models.CharField(max_length=512, verbose_name='R\xe9gion'),
+        ),
+        migrations.AlterField(
+            model_name='registeredoffice',
+            name='street_address',
+            field=models.CharField(max_length=512, verbose_name='Adresse', blank=True),
+        ),
+    ]

+ 59 - 32
coin/isp_database/models.py

@@ -53,48 +53,55 @@ class ISPInfo(SingleInstanceMixin, models.Model):
         return count_active_subscriptions()
         return count_active_subscriptions()
 
 
     name = models.CharField(max_length=512,
     name = models.CharField(max_length=512,
-                            help_text="The ISP's name")
+                            verbose_name="Nom",
+                            help_text="Nom du FAI")
     # Length required by the spec
     # Length required by the spec
     shortname = models.CharField(max_length=15, blank=True,
     shortname = models.CharField(max_length=15, blank=True,
-                                 help_text="Shorter name")
+                                 verbose_name="Abréviation",
+                                 help_text="Nom plus court")
     description = models.TextField(blank=True,
     description = models.TextField(blank=True,
-                                   help_text="Short text describing the project")
+                                   verbose_name="Description",
+                                   help_text="Description courte du projet")
     logoURL = models.URLField(blank=True,
     logoURL = models.URLField(blank=True,
-                              verbose_name="logo URL",
-                              help_text="HTTP(S) URL of the ISP's logo")
+                              verbose_name="URL du logo",
+                              help_text="Adresse HTTP(S) du logo du FAI")
     website = models.URLField(blank=True,
     website = models.URLField(blank=True,
-                              help_text='URL to the official website')
-    email = models.EmailField(help_text="Contact email address")
+                              verbose_name="URL du site Internet",
+                              help_text='Adresse URL du site Internet')
+    email = models.EmailField(verbose_name="Courriel",
+                              help_text="Adresse courriel de contact")
     mainMailingList = models.EmailField(blank=True,
     mainMailingList = models.EmailField(blank=True,
-                                        verbose_name="main mailing list",
-                                        help_text="Main public mailing-list")
+                                        verbose_name="Liste de discussion principale",
+                                        help_text="Principale liste de discussion publique")
     phone_number = models.CharField(max_length=25, blank=True,
     phone_number = models.CharField(max_length=25, blank=True,
-                                    verbose_name="phone number",
-                                    help_text='Main contact phone number')
+                                    verbose_name="Numéro de téléphone",
+                                    help_text='Numéro de téléphone de contact principal')
     creationDate = models.DateField(blank=True, null=True,
     creationDate = models.DateField(blank=True, null=True,
-                                    verbose_name="creation date",
-                                     help_text="Date of creation for legal structure")
+                                    verbose_name="Date de création",
+                                    help_text="Date de création de la structure légale")
     ffdnMemberSince = models.DateField(blank=True, null=True,
     ffdnMemberSince = models.DateField(blank=True, null=True,
-                                       verbose_name="FFDN member since",
-                                       help_text="Date at wich the ISP joined the Federation")
+                                       verbose_name="Membre de FFDN depuis",
+                                       help_text="Date à laquelle le FAI a rejoint la Fédération FDN")
     # TODO: choice field
     # TODO: choice field
     progressStatus = models.PositiveSmallIntegerField(
     progressStatus = models.PositiveSmallIntegerField(
         validators=[MaxValueValidator(7)],
         validators=[MaxValueValidator(7)],
-        blank=True, null=True, verbose_name='progress status',
-        help_text="Progression status of the ISP")
+        blank=True, null=True, verbose_name="État d'avancement",
+        help_text="État d'avancement du FAI")
     # TODO: better model for coordinates
     # TODO: better model for coordinates
     latitude = models.FloatField(blank=True, null=True,
     latitude = models.FloatField(blank=True, null=True,
-        help_text="Coordinates of the registered office (latitude)")
+                                 verbose_name="Latitude",
+                                 help_text="Coordonnées latitudinales du siège")
     longitude = models.FloatField(blank=True, null=True,
     longitude = models.FloatField(blank=True, null=True,
-        help_text="Coordinates of the registered office (longitude)")
+                                  verbose_name="Longitude",
+                                  help_text="Coordonnées longitudinales du siège")
 
 
     # Uncomment this (and handle the necessary migrations) if you want to
     # Uncomment this (and handle the necessary migrations) if you want to
     # manage one of the counters by hand.  Otherwise, they are computed
     # manage one of the counters by hand.  Otherwise, they are computed
     # automatically, which is probably what you want.
     # automatically, which is probably what you want.
-    #memberCount = models.PositiveIntegerField(help_text="Number of members",
+    #memberCount = models.PositiveIntegerField(help_text="Nombre de membres",
     #                                          default=0)
     #                                          default=0)
     #subscriberCount = models.PositiveIntegerField(
     #subscriberCount = models.PositiveIntegerField(
-    #    help_text="Number of subscribers to an internet access",
+    #    help_text="Nombre d'abonnés à un accès Internet",
     #    default=0)
     #    default=0)
 
 
     # field outside of db-ffdn format:
     # field outside of db-ffdn format:
@@ -110,9 +117,13 @@ class ISPInfo(SingleInstanceMixin, models.Model):
         verbose_name="serveur de listes", blank=True,
         verbose_name="serveur de listes", blank=True,
         help_text="URL du serveur de listes de discussions/diffusion")
         help_text="URL du serveur de listes de discussions/diffusion")
 
 
+    class Meta:
+        verbose_name = "Information du FAI"
+        verbose_name_plural = "Informations du FAI"
+
     @property
     @property
     def version(self):
     def version(self):
-        """Version of the API"""
+        """Version de l'API"""
         return API_VERSION
         return API_VERSION
 
 
     @property
     @property
@@ -168,25 +179,33 @@ class ISPInfo(SingleInstanceMixin, models.Model):
 
 
 
 
 class OtherWebsite(models.Model):
 class OtherWebsite(models.Model):
-    name = models.CharField(max_length=512)
+    name = models.CharField(max_length=512, verbose_name="Nom")
     url = models.URLField(verbose_name="URL")
     url = models.URLField(verbose_name="URL")
     isp = models.ForeignKey(ISPInfo)
     isp = models.ForeignKey(ISPInfo)
 
 
+    class Meta:
+        verbose_name = "Autre site Internet"
+        verbose_name_plural = "Autres sites Internet"
+
 
 
 class RegisteredOffice(models.Model):
 class RegisteredOffice(models.Model):
     """ http://json-schema.org/address """
     """ http://json-schema.org/address """
-    post_office_box = models.CharField(max_length=512, blank=True)
-    extended_address = models.CharField(max_length=512, blank=True)
-    street_address = models.CharField(max_length=512, blank=True)
-    locality = models.CharField(max_length=512)
-    region = models.CharField(max_length=512)
-    postal_code = models.CharField(max_length=512, blank=True)
-    country_name = models.CharField(max_length=512)
+    post_office_box = models.CharField(max_length=512, blank=True, verbose_name="Boîte postale")
+    extended_address = models.CharField(max_length=512, blank=True, verbose_name="Adresse complémentaire")
+    street_address = models.CharField(max_length=512, blank=True, verbose_name="Adresse")
+    locality = models.CharField(max_length=512, verbose_name="Ville")
+    region = models.CharField(max_length=512, verbose_name="Région")
+    postal_code = models.CharField(max_length=512, blank=True, verbose_name="Code postal")
+    country_name = models.CharField(max_length=512, verbose_name="Pays")
     isp = models.OneToOneField(ISPInfo)
     isp = models.OneToOneField(ISPInfo)
 
 
     # not in db.ffdn.org spec
     # not in db.ffdn.org spec
     siret = FRSIRETField('SIRET')
     siret = FRSIRETField('SIRET')
 
 
+    class Meta:
+        verbose_name = "Siège social"
+        verbose_name_plural = "Sièges sociaux"
+
     def to_dict(self):
     def to_dict(self):
         d = dict()
         d = dict()
         for field in ('post_office_box', 'extended_address', 'street_address',
         for field in ('post_office_box', 'extended_address', 'street_address',
@@ -202,11 +221,15 @@ class ChatRoom(models.Model):
         verbose_name="URL", max_length=256, validators=[chatroom_url_validator])
         verbose_name="URL", max_length=256, validators=[chatroom_url_validator])
     isp = models.ForeignKey(ISPInfo)
     isp = models.ForeignKey(ISPInfo)
 
 
+    class Meta:
+        verbose_name = "Salon de discussions"
+        verbose_name_plural = "Salons de discussions"
+
 
 
 class CoveredArea(models.Model):
 class CoveredArea(models.Model):
-    name = models.CharField(max_length=512)
+    name = models.CharField(max_length=512, verbose_name="Nom")
 
 
-    technologies = MultiSelectField(choices=TECHNOLOGIES, max_length=42)
+    technologies = MultiSelectField(choices=TECHNOLOGIES, max_length=42, verbose_name="Technologie")
     # TODO: find a geojson library
     # TODO: find a geojson library
     #area =
     #area =
     isp = models.ForeignKey(ISPInfo)
     isp = models.ForeignKey(ISPInfo)
@@ -215,6 +238,10 @@ class CoveredArea(models.Model):
         return {"name": self.name,
         return {"name": self.name,
                 "technologies": self.technologies}
                 "technologies": self.technologies}
 
 
+    class Meta:
+        verbose_name = "Zone couverte"
+        verbose_name_plural = "Zones couvertes"
+
 
 
 class BankInfo(models.Model):
 class BankInfo(models.Model):
     """Information about bank account and the bank itself
     """Information about bank account and the bank itself

+ 10 - 4
coin/members/admin.py

@@ -35,11 +35,17 @@ class MembershipFeeInline(admin.TabularInline):
 class OfferSubscriptionInline(admin.TabularInline):
 class OfferSubscriptionInline(admin.TabularInline):
     model = OfferSubscription
     model = OfferSubscription
     extra = 0
     extra = 0
-    exclude = ('comments',)
     readonly_fields = ('get_subscription_reference', 'subscription_date', 'resign_date',
     readonly_fields = ('get_subscription_reference', 'subscription_date', 'resign_date',
-                       'commitment', 'offer')
-
-    show_change_link = True
+                       'commitment', 'offer', 'show_change_link')
+
+    # FIXME: Workaround en attendant la migration vers Django >=1.8
+    # À remplacer par InlineModelAdmin.show_change_link = True
+    def show_change_link(self, obj=None):
+        url = reverse('admin:%s_%s_change' % (obj._meta.app_label,
+                                              obj._meta.model_name),
+                      args=[obj.id])
+        return format_html(u'<a href="{}">Éditer</a>', url)
+    show_change_link.short_description = 'Éditer ?'
 
 
     def has_add_permission(self, request, obj=None):
     def has_add_permission(self, request, obj=None):
         return False
         return False

+ 2 - 17
hardware_provisioning/admin.py

@@ -5,7 +5,6 @@ from __future__ import unicode_literals
 
 
 from django.contrib import admin
 from django.contrib import admin
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
-from django.forms import ModelChoiceField
 from django.utils import timezone
 from django.utils import timezone
 
 
 from .models import ItemType, Item, Loan, Storage
 from .models import ItemType, Item, Loan, Storage
@@ -56,7 +55,7 @@ class AvailabilityFilter(admin.SimpleListFilter):
 class ItemAdmin(admin.ModelAdmin):
 class ItemAdmin(admin.ModelAdmin):
     list_display = (
     list_display = (
         'designation', 'type', 'mac_address', 'serial', 'owner',
         'designation', 'type', 'mac_address', 'serial', 'owner',
-        'buy_date', 'deployed', 'is_available')
+        'buy_date', 'is_available')
     list_filter = (
     list_filter = (
         AvailabilityFilter, 'type__name', 'storage',
         AvailabilityFilter, 'type__name', 'storage',
         'buy_date', OwnerFilter)
         'buy_date', OwnerFilter)
@@ -120,15 +119,9 @@ class BorrowerFilter(admin.SimpleListFilter):
             return queryset
             return queryset
 
 
 
 
-class ItemChoiceField(ModelChoiceField):
-    # On surcharge cette méthode pour afficher mac et n° de série dans le menu
-    # déroulant de sélection d'un objet dans la création d'un prêt.
-    def label_from_instance(self, obj):
-        return obj.designation + ' ' + obj.get_mac_and_serial()
-
 @admin.register(Loan)
 @admin.register(Loan)
 class LoanAdmin(admin.ModelAdmin):
 class LoanAdmin(admin.ModelAdmin):
-    list_display = ('item', 'get_mac_and_serial', 'user', 'loan_date', 'loan_date_end')
+    list_display = ('item', 'user', 'loan_date', 'loan_date_end')
     list_filter = (StatusFilter, BorrowerFilter, 'item__designation')
     list_filter = (StatusFilter, BorrowerFilter, 'item__designation')
     search_fields = (
     search_fields = (
         'item__designation',
         'item__designation',
@@ -142,14 +135,6 @@ class LoanAdmin(admin.ModelAdmin):
     end_loan.short_description = 'Mettre fin au prêt'
     end_loan.short_description = 'Mettre fin au prêt'
 
 
 
 
-    def formfield_for_foreignkey(self, db_field, request, **kwargs):
-        if db_field.name == 'item':
-            kwargs['queryset'] = Item.objects.all()
-            return ItemChoiceField(**kwargs)
-        else:
-            return super(LoanAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
-
 @admin.register(Storage)
 @admin.register(Storage)
 class StorageAdmin(admin.ModelAdmin):
 class StorageAdmin(admin.ModelAdmin):
     list_display = ('name', 'truncated_notes', 'items_count')
     list_display = ('name', 'truncated_notes', 'items_count')

+ 1 - 1
hardware_provisioning/app.py

@@ -7,5 +7,5 @@ import coin.apps
 
 
 class HardwareProvisioningConfig(AppConfig, coin.apps.AppURLs):
 class HardwareProvisioningConfig(AppConfig, coin.apps.AppURLs):
     name = 'hardware_provisioning'
     name = 'hardware_provisioning'
-    verbose_name = 'prêt de matériel'
+    verbose_name = 'Prêt de matériel'
     exported_urlpatterns = [('hardware_provisioning', 'hardware_provisioning.urls')]
     exported_urlpatterns = [('hardware_provisioning', 'hardware_provisioning.urls')]

+ 35 - 0
hardware_provisioning/migrations/0016_auto_20170802_2021.py

@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+from django.conf import settings
+import hardware_provisioning.fields
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('hardware_provisioning', '0015_auto_20170802_1701'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='item',
+            name='deployed',
+        ),
+        migrations.AlterField(
+            model_name='item',
+            name='mac_address',
+            field=hardware_provisioning.fields.MACAddressField(null=True, max_length=17, blank=True, help_text='pr\xe9f\xe9rable au n\xb0 de s\xe9rie si possible', unique=True, verbose_name='adresse MAC'),
+        ),
+        migrations.AlterField(
+            model_name='item',
+            name='owner',
+            field=models.ForeignKey(related_name='items', blank=True, to=settings.AUTH_USER_MODEL, help_text="dans le cas de mat\xe9riel n'appartenant pas \xe0 l'association", null=True, verbose_name='Propri\xe9taire'),
+        ),
+        migrations.AlterField(
+            model_name='item',
+            name='serial',
+            field=models.CharField(null=True, max_length=250, blank=True, help_text='ou toute autre r\xe9f\xe9rence unique', unique=True, verbose_name='N\xb0 de s\xe9rie'),
+        ),
+    ]

+ 9 - 22
hardware_provisioning/models.py

@@ -40,22 +40,20 @@ class Item(models.Model):
         null=True, blank=True,
         null=True, blank=True,
         help_text='Laisser vide si inconnu')
         help_text='Laisser vide si inconnu')
     mac_address = MACAddressField(
     mac_address = MACAddressField(
-        verbose_name='addresse MAC',
+        verbose_name='adresse MAC',
         blank=True, null=True, unique=True,
         blank=True, null=True, unique=True,
-        help_text="Préférable au n° de série si possible")
+        help_text="préférable au n° de série si possible")
     serial = models.CharField(
     serial = models.CharField(
         verbose_name='N° de série',
         verbose_name='N° de série',
         max_length=250, blank=True, null=True, unique=True,
         max_length=250, blank=True, null=True, unique=True,
-        help_text='ou toute autre référence unique)')
+        help_text='ou toute autre référence unique')
     buy_date = models.DateField(verbose_name='date d’achat' , blank=True , null=True)
     buy_date = models.DateField(verbose_name='date d’achat' , blank=True , null=True)
     owner = models.ForeignKey(
     owner = models.ForeignKey(
         settings.AUTH_USER_MODEL,
         settings.AUTH_USER_MODEL,
         verbose_name='Propriétaire',
         verbose_name='Propriétaire',
         related_name='items',
         related_name='items',
         null=True, blank=True,
         null=True, blank=True,
-        help_text="Dans le cas de matériel n'appartenant pas à l'association")
-    deployed = models.BooleanField(verbose_name='déployé', default=False,
-                                   help_text='Cocher si le matériel est en production')
+        help_text="dans le cas de matériel n'appartenant pas à l'association")
     comment = models.TextField(verbose_name='commentaire', blank=True,
     comment = models.TextField(verbose_name='commentaire', blank=True,
                                null=True)
                                null=True)
 
 
@@ -83,21 +81,15 @@ class Item(models.Model):
 
 
     def is_available(self):
     def is_available(self):
         """
         """
-        Returns the status of the Item. If a running loan exists,
-        or if the item is deployed, returns False (else True).
+        Returns the status of the Item. If a Loan without an end date exists,
+        returns False (else True).
         """
         """
-        return (not self.deployed) and (not self.loans.running().exists())
+        if self.loans.running().exists():
+            return False
+        return True
     is_available.boolean = True
     is_available.boolean = True
     is_available.short_description = 'disponible'
     is_available.short_description = 'disponible'
 
 
-    def get_mac_and_serial(self):
-        mac = self.mac_address
-        serial = self.serial
-        if mac and serial:
-            return "{} / {}".format(mac, serial)
-        else:
-            return mac or serial or ''
-
     class Meta:
     class Meta:
         verbose_name = 'objet'
         verbose_name = 'objet'
 
 
@@ -136,11 +128,6 @@ class Loan(models.Model):
         return 'prêt de {item} à {user}'.format(
         return 'prêt de {item} à {user}'.format(
             item=self.item, user=self.user)
             item=self.item, user=self.user)
 
 
-    def get_mac_and_serial(self):
-        return self.item.get_mac_and_serial()
-    
-    get_mac_and_serial.short_description = "Adresse MAC / n° de série"
-
     def user_can_close(self, user):
     def user_can_close(self, user):
         return (not self.item.is_available()) and (self.user == user)
         return (not self.item.is_available()) and (self.user == user)
 
 

+ 5 - 5
vpn/admin.py

@@ -54,11 +54,11 @@ class VPNConfigurationAdmin(ConfigurationAdminFormMixin, PolymorphicChildModelAd
 
 
     def activate(self, request, queryset):
     def activate(self, request, queryset):
         self.set_activation(request, queryset, True)
         self.set_activation(request, queryset, True)
-    activate.short_description = "Activate selected VPNs"
+    activate.short_description = "Activer les VPN sélectionnés"
 
 
     def deactivate(self, request, queryset):
     def deactivate(self, request, queryset):
         self.set_activation(request, queryset, False)
         self.set_activation(request, queryset, False)
-    deactivate.short_description = "Deactivate selected VPNs"
+    deactivate.short_description = "Désactiver les VPN sélectionnés"
 
 
     def generate_endpoints_generic(self, request, queryset, v4=True, v6=True):
     def generate_endpoints_generic(self, request, queryset, v4=True, v6=True):
         count = 0
         count = 0
@@ -72,14 +72,14 @@ class VPNConfigurationAdmin(ConfigurationAdminFormMixin, PolymorphicChildModelAd
 
 
     def generate_endpoints(self, request, queryset):
     def generate_endpoints(self, request, queryset):
         self.generate_endpoints_generic(request, queryset)
         self.generate_endpoints_generic(request, queryset)
-    generate_endpoints.short_description = "Generate IPv4 and IPv6 endpoints"
+    generate_endpoints.short_description = "Attribuer des adresses IPv4 et IPv6"
 
 
     def generate_endpoints_v4(self, request, queryset):
     def generate_endpoints_v4(self, request, queryset):
         self.generate_endpoints_generic(request, queryset, v6=False)
         self.generate_endpoints_generic(request, queryset, v6=False)
-    generate_endpoints_v4.short_description = "Generate IPv4 endpoints"
+    generate_endpoints_v4.short_description = "Attribuer des adresses IPv4"
 
 
     def generate_endpoints_v6(self, request, queryset):
     def generate_endpoints_v6(self, request, queryset):
         self.generate_endpoints_generic(request, queryset, v4=False)
         self.generate_endpoints_generic(request, queryset, v4=False)
-    generate_endpoints_v6.short_description = "Generate IPv6 endpoints"
+    generate_endpoints_v6.short_description = "Attribuer des adresses IPv6"
 
 
 admin.site.register(VPNConfiguration, VPNConfigurationAdmin)
 admin.site.register(VPNConfiguration, VPNConfigurationAdmin)

+ 23 - 0
vpn/migrations/0002_auto_20170802_2021.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('vpn', '0001_squashed_0002_remove_vpnconfiguration_comment'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='vpnconfiguration',
+            options={'verbose_name': 'VPN', 'verbose_name_plural': 'VPN'},
+        ),
+        migrations.AlterField(
+            model_name='vpnconfiguration',
+            name='login',
+            field=models.CharField(help_text='Laisser vide pour une g\xe9n\xe9ration automatique', unique=True, max_length=50, verbose_name='identifiant', blank=True),
+        ),
+    ]

+ 2 - 1
vpn/models.py

@@ -27,7 +27,7 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
     activated = models.BooleanField(default=False, verbose_name='activé')
     activated = models.BooleanField(default=False, verbose_name='activé')
     login = models.CharField(max_length=50, unique=True, blank=True,
     login = models.CharField(max_length=50, unique=True, blank=True,
                              verbose_name="identifiant",
                              verbose_name="identifiant",
-                             help_text="leave empty for automatic generation")
+                             help_text="Laisser vide pour une génération automatique")
     password = models.CharField(max_length=256, verbose_name="mot de passe",
     password = models.CharField(max_length=256, verbose_name="mot de passe",
                                 blank=True, null=True)
                                 blank=True, null=True)
     ipv4_endpoint = InetAddressField(validators=[validation.validate_v4],
     ipv4_endpoint = InetAddressField(validators=[validation.validate_v4],
@@ -152,6 +152,7 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
 
 
     class Meta:
     class Meta:
         verbose_name = 'VPN'
         verbose_name = 'VPN'
+        verbose_name_plural = 'VPN'
 
 
 
 
 class LdapVPNConfig(ldapdb.models.Model):
 class LdapVPNConfig(ldapdb.models.Model):