Add documentation
This commit is contained in:
@ -8,6 +8,21 @@ from apps.polyclinic.models import Polyclinic
|
||||
|
||||
# Create your models here.
|
||||
class Employee(MetaDataModel):
|
||||
"""
|
||||
A model that holds the employee information that is not available in the normal user model. It has a One To One relation with the Djano User model
|
||||
It will inherit the attributes :attr:`~lib.models.base.MetaDataModel.created_at` and :attr:`~lib.models.base.MetaDataModel.updated_at` from the Abstract model :class:`~lib.models.base.MetaDataModel`
|
||||
|
||||
Attributes
|
||||
----------
|
||||
user : User
|
||||
The Django user in the system where this employee data belongs to.
|
||||
hospital : Hospital
|
||||
The hospital where this employee is working. You can only choose **one** hospital per employee.
|
||||
polyclinic : Polyclinic
|
||||
The polyclinic where this employee is working within the hospital. It is possible to have / work for multiple polyclinics.
|
||||
phone : str
|
||||
Holds the direct phone number of this employee. Max length is 20 characters.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('employee')
|
||||
@ -18,8 +33,8 @@ class Employee(MetaDataModel):
|
||||
hospital = models.ForeignKey(Hospital, 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'))
|
||||
phone = models.CharField(_('Phone number'), max_length=15, 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):
|
||||
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""
|
||||
"""str: Returns a readable name for the employee. Format is [employee_full_name] ([city])."""
|
||||
return '{} ({})'.format(self.user.get_full_name(), self.hospital)
|
Reference in New Issue
Block a user