Created
September 8, 2014 19:57
-
-
Save jamilatta/37b1f3416ad61abeff1f to your computer and use it in GitHub Desktop.
Editorial Manager models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from journalmanager.models import Issue | |
class EditorialBoard(models.Model): | |
""" | |
Represents the editorial board for one issue. | |
""" | |
issue = models.ForeignKey(Issue) | |
members = models.ManyToManyField('EditorialMember') | |
def __unicode__(self): | |
return "Editorial board of issue: %s" % self.issue | |
class EditorialMember(models.Model): | |
""" | |
Represents members of an editorial board | |
Required Fields: First Name, Last Name, E-mail. | |
""" | |
role = models.ForeignKey('RoleType') | |
first_name = models.CharField(_('First Name'), max_length=256) | |
last_name = models.CharField(_('Last Name'), max_length=256) | |
email = models.EmailField(_('E-mail')) | |
institution = models.CharField(_('institution'), max_length=256, null=True, | |
blank=True) | |
link_cv = models.URLField(_('Link CV')) | |
city = models.CharField(_('City'), max_length=256, null=True, blank=True) | |
state = models.CharField(_('State'), max_length=256, null=True, blank=True) | |
country = models.CharField(_('Country'), max_length=256, null=True, blank=True) | |
class RoleType(models.Model): | |
""" | |
Represents the editor category | |
""" | |
role_name = models.CharField(_('Editor Category'), max_length=256) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vou comçar pelo final:
_('Editor Category')
acho que esta errado, ou pelo menos parece confuso. acho melhor:_('Role Name')
role_name
, trocaria por:name
, até porque vai ser um attr do RoleType, então acho menos verboseRoleType.name
do queRoleType.role_name
EditorialMember
deveria mostrar aquele string que aparece tudo o que tem para mostrar. tipo o User.get_full_name()link_cv
deve ser opcional segundo o comentario da linha 24.members = models.ManyToManyField('EditorialMember')
por uma relação desde o modelEditorialMember
tipo:assism cada instancia de EditorialMember, tem os dados do membro é seu role, nesse board.