def handle(self, *args, **kwargs):
to_year = int(args[-1])
from_year = int(args[-2])
+ to_period = Period.objects.get_or_create(name=str(to_year))
+ from_period = Period.objects.get_or_create(name=str(from_year))
for seminar in Seminar.objects.all():
if seminar.expiry_date:
source = getattr(seminar, field.attname)
destination = getattr(clone, field.attname)
for item in source.all():
+ item.period = from_period
+ item.save()
item_clone = item.clone()
item_clone.readers = []
+ item_clone.period = to_period
item_clone.save()
destination.remove(item)
destination.add(item_clone)
- print ("documents and medias cloned and assigned:", clone)
+ print ("cloned and assigned:", item_clone)
questions = seminar.question.all()
for question in questions:
question_clone = question.clone()
question_clone.seminar = clone
question.save()
- print ("updated:", question)
+ print ("cloned and assigned:", question)
def __unicode__(self):
strings = []
+ if self.period:
+ strings.append(self.period)
if self.course:
strings.append(self.course.code)
if self.course_type.all():
def __unicode__(self):
strings = []
-
+ if self.period:
+ strings.append(self.period)
if self.course and self.course_type:
strings.append(self.course.code + ' ' + self.course_type.name)
elif self.course:
objects = DisplayableManager()
def __unicode__(self):
- return ' - '.join([self.course.title, str(self.rank), self.title])
+ if self.publish_date:
+ return ' - '.join([self.publish_date.year, self.course.title, str(self.rank), self.title])
+ else:
+ return ' - '.join([self.course.title, str(self.rank), self.title])
@property
def pretty_title(self):