Seconds part of translations in models

This commit is contained in:
Joshua Rubingh 2020-05-19 16:13:34 +02:00
parent 7c4ca62a2d
commit 65f3d73a47
5 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,7 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from .models import Employee from .models import Employee
@ -9,7 +10,7 @@ from .models import Employee
class EmployeeInline(admin.StackedInline): class EmployeeInline(admin.StackedInline):
model = Employee model = Employee
can_delete = False can_delete = False
verbose_name_plural = 'employee' verbose_name_plural = _('employee')
# Define a new User admin # Define a new User admin
class UserAdmin(BaseUserAdmin): class UserAdmin(BaseUserAdmin):

View File

@ -30,9 +30,9 @@ class Employee(MetaDataModel):
user = models.OneToOneField(User, on_delete=models.CASCADE, help_text=_('Django user')) user = models.OneToOneField(User, on_delete=models.CASCADE, help_text=_('Django user'))
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('Select the hospital for this employee')) hospital = models.ForeignKey(Hospital, verbose_name=Hospital._meta.verbose_name, on_delete=models.CASCADE, help_text=_('Select the hospital for this employee'))
polyclinic = models.ManyToManyField(Polyclinic, blank=True, help_text=_('Select the polyclinic(s) for this employee')) polyclinic = models.ManyToManyField(Polyclinic, verbose_name=Polyclinic._meta.verbose_name, blank=True, help_text=_('Select the polyclinic(s) for this employee'))
phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The direct phone number of this employee')) phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The direct phone number of this employee'))
def __str__(self): def __str__(self):

View File

@ -24,7 +24,7 @@ class Polyclinic(MetaDataModel):
verbose_name = _('polyclinic') verbose_name = _('polyclinic')
verbose_name_plural = _('polyclinics') verbose_name_plural = _('polyclinics')
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('To which hospital belongs this polyclinic')) hospital = models.ForeignKey(Hospital, verbose_name=Hospital._meta.verbose_name, on_delete=models.CASCADE, help_text=_('To which hospital belongs this polyclinic'))
name = models.CharField(_('Name'), max_length=200, blank=True, help_text=_('The name of this polyclinic')) name = models.CharField(_('Name'), max_length=200, blank=True, help_text=_('The name of this polyclinic'))
phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The general/direct phone number of this polyclinic')) phone = models.CharField(_('Phone number'), max_length=20, blank=True, help_text=_('The general/direct phone number of this polyclinic'))

View File

@ -1,4 +1,5 @@
from django.contrib import admin from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from .models import Schedule from .models import Schedule
@ -14,3 +15,4 @@ class ScheduleAdmin(admin.ModelAdmin):
return obj.done return obj.done
done.boolean = True done.boolean = True
done.short_description = _('Done')

View File

@ -69,7 +69,7 @@ class Schedule(MetaDataModel):
INVALID = 'invalid', _('Invalid') INVALID = 'invalid', _('Invalid')
FAILURE = 'failure', _('Failure') FAILURE = 'failure', _('Failure')
employee = models.ForeignKey(Employee, on_delete=models.CASCADE, help_text=_('Select the employee that is responsible for this schedule request')) employee = models.ForeignKey(Employee, verbose_name=Employee._meta.verbose_name, on_delete=models.CASCADE, help_text=_('Select the employee that is responsible for this schedule request'))
name = models.CharField(_('Name'), max_length=100, help_text=_('Name of the schedule')) name = models.CharField(_('Name'), max_length=100, help_text=_('Name of the schedule'))
email = models.CharField(_('Email address'), max_length=100, help_text=_('Email address where the results will be sent to.')) email = models.CharField(_('Email address'), max_length=100, help_text=_('Email address where the results will be sent to.'))