11# old meeting models can be found in ../proceedings/models.py
22
3- import pytz
3+ import pytz , datetime
44
55from django .db import models
66from timedeltafield import TimedeltaField
77
88from redesign .group .models import Group
99from redesign .person .models import Person
1010from redesign .doc .models import Document
11- from redesign .name .models import TimeSlotTypeName , SessionStatusName , ConstraintName
11+ from redesign .name .models import MeetingTypeName , TimeSlotTypeName , SessionStatusName , ConstraintName
1212
1313countries = pytz .country_names .items ()
1414countries .sort (lambda x ,y : cmp (x [1 ], y [1 ]))
1717timezones .sort ()
1818
1919class Meeting (models .Model ):
20- # Number is not an integer any more, in order to be able to accomodate
21- # interim meetings (and other variations?)
20+ # number is either the number for IETF meetings, or some other
21+ # identifier for interim meetings/IESG retreats/liaison summits/...
2222 number = models .CharField (max_length = 64 )
23+ type = models .ForeignKey (MeetingTypeName )
2324 # Date is useful when generating a set of timeslot for this meeting, but
2425 # is not used to determine date for timeslot instances thereafter, as
2526 # they have their own datetime field.
@@ -37,11 +38,10 @@ class Meeting(models.Model):
3738
3839 def __str__ (self ):
3940 return "IETF-%s" % (self .number )
41+ def time_zone_offset (self ):
42+ return pytz .timezone (self .time_zone ).localize (datetime .datetime .combine (self .date , datetime .time (0 , 0 ))).strftime ("%z" )
4043 def get_meeting_date (self ,offset ):
4144 return self .date + datetime .timedelta (days = offset )
42- # cut-off dates (draft submission cut-of, wg agenda cut-off, minutes
43- # submission cut-off), and more, are probably methods of this class,
44- # rather than fields on a Proceedings class.
4545
4646 @classmethod
4747 def get_first_cut_off (cls ):
@@ -60,6 +60,13 @@ def get_ietf_monday(cls):
6060 date = cls .objects .all ().order_by ('-date' )[0 ].date
6161 return date + datetime .timedelta (days = - date .weekday (), weeks = 1 )
6262
63+ # the various dates are currently computed
64+ def get_submission_start_date (self ):
65+ return self .date + datetime .timedelta (days = - 90 )
66+ def get_submission_cut_off_date (self ):
67+ return self .date + datetime .timedelta (days = 33 )
68+ def get_submission_correction_date (self ):
69+ return self .date + datetime .timedelta (days = 59 )
6370
6471class Room (models .Model ):
6572 meeting = models .ForeignKey (Meeting )
@@ -82,8 +89,10 @@ class TimeSlot(models.Model):
8289 time = models .DateTimeField ()
8390 duration = TimedeltaField ()
8491 location = models .ForeignKey (Room , blank = True , null = True )
85- show_location = models .BooleanField (default = True )
92+ show_location = models .BooleanField (default = True , help_text = "Show location in agenda" )
8693 materials = models .ManyToManyField (Document , blank = True )
94+ session = models .ForeignKey ('Session' , null = True , blank = True , help_text = u"Scheduled group session, if any" )
95+ modified = models .DateTimeField (default = datetime .datetime .now )
8796
8897 def __unicode__ (self ):
8998 location = self .get_location ()
@@ -120,7 +129,6 @@ def __unicode__(self):
120129
121130class Session (models .Model ):
122131 meeting = models .ForeignKey (Meeting )
123- timeslot = models .ForeignKey (TimeSlot , null = True , blank = True ) # Null until session has been scheduled
124132 group = models .ForeignKey (Group ) # The group type determines the session type. BOFs also need to be added as a group.
125133 attendees = models .IntegerField (null = True , blank = True )
126134 agenda_note = models .CharField (blank = True , max_length = 255 )
@@ -132,16 +140,15 @@ class Session(models.Model):
132140 #
133141 status = models .ForeignKey (SessionStatusName )
134142 scheduled = models .DateTimeField (null = True , blank = True )
135- modified = models .DateTimeField (null = True , blank = True )
143+ modified = models .DateTimeField (default = datetime . datetime . now )
136144
137145 # contains the materials while the session is being requested,
138- # when it is scheduled, timeslot.materials should be used (FIXME: ask Henrik)
146+ # when it is scheduled, timeslot.materials should be used
139147 materials = models .ManyToManyField (Document , blank = True )
140148
141149 def __unicode__ (self ):
142- return u"%s: %s %s" % (self .meeting , self .group .acronym , self .timeslot .time .strftime ("%H%M" ) if self .timeslot else "(unscheduled)" )
143-
144- # Agendas, Minutes and Slides are all mapped to Document.
150+ timeslots = self .timeslot_set .order_by ('time' )
151+ return u"%s: %s %s" % (self .meeting , self .group .acronym , timeslots [0 ].time .strftime ("%H%M" ) if timeslots else "(unscheduled)" )
145152
146153# IESG history is extracted from GroupHistory, rather than hand coded in a
147154# separate table.
0 commit comments