Customising the admin site in django -


I have admin site I Dijengo app and I am trying to customize it so I add people to the event Saku presence My model would look like this:

  class Talk (models.Model): title = models.CharField (MAX_LENGTH = 200, primary_key = true) speaker = models.CharField (MAX_LENGTH = 200) date_of_talk = models.DateField ( 'date_of_talk') def __unicode __ (self): return self.title class member (models.Model): name = models.CharField (MAX_LENGTH = 200) TELEPHONE_NUMBER = models.CharField (MAX_LENGTH = 200) EMAIL_ADDRESS = model . CharField (MAX_LENGTH = 200) membership_type = models.CharField (MAX_LENGTH = 1, choices = MEMBERSHIP_TYPES) ​​membership_number = models.CharField (MAX_LENGTH = 200, primary_key = true) def __unicode __ (self): return self.name class Event_Attendance ( models.Model): talk = models.ForeignKey ( 'talk') membersAttended = models.ForeignKey ( 'member')  

I do so that I can keep adding members to configure admin site I want to be able to talk in the Event_attendance object, I have one thing with many members. How would I do this? I also want to be equal to the number of members of the maximum number of members Attend in event_attendance object.
Thanks in advance,
Dean

The member can use a need ManyToManyField Through logic:

  class members (models.model): [...] = Attention to not allow many members to participate in an event to participate in the event To keep, you can apply a specific barrier to event_entendance just like: << Many Tommanyfield (Talk, Event_Attendance) via Content_Attendance  

/ P>

  Category Event_Attendance (models.Model): [...] Category Meta: unique_together = ('talk', 'member present')  

With this you can be sure that Each member can be present only once, and you can happily ask in all your models that you can gain access to the data you are looking for.


Comments