Changeset - ddc355365609
[Not reviewed]
0 1 0
Martey Dodoo - 9 years ago 2015-12-31 17:35:22
martey@mobolic.com
Remove duplicate Slot.save method.

Remove "save" method in Slot model since #107 added another "save"
method. This fixes the automated test failures in Travis CI.
1 file changed with 0 insertions and 4 deletions:
0 comments (0 inline, 0 general)
symposion/schedule/models.py
Show inline comments
...
 
@@ -69,52 +69,48 @@ class SlotKind(models.Model):
 
    """
 

	
 
    schedule = models.ForeignKey(Schedule, verbose_name=_("schedule"))
 
    label = models.CharField(max_length=50, verbose_name=_("Label"))
 

	
 
    def __str__(self):
 
        return self.label
 

	
 
    class Meta:
 
        verbose_name = _("Slot kind")
 
        verbose_name_plural = _("Slot kinds")
 

	
 

	
 
@python_2_unicode_compatible
 
class Slot(models.Model):
 

	
 
    name = models.CharField(max_length=100, editable=False)
 
    day = models.ForeignKey(Day, verbose_name=_("Day"))
 
    kind = models.ForeignKey(SlotKind, verbose_name=_("Kind"))
 
    start = models.TimeField(verbose_name=_("Start"))
 
    end = models.TimeField(verbose_name=_("End"))
 
    content_override = models.TextField(blank=True, verbose_name=_("Content override"))
 
    content_override_html = models.TextField(blank=True)
 

	
 
    def save(self, *args, **kwargs):
 
        self.content_override_html = parse(self.content_override)
 
        return super(Slot, self).save(*args, **kwargs)
 

	
 
    def assign(self, content):
 
        """
 
        Assign the given content to this slot and if a previous slot content
 
        was given we need to unlink it to avoid integrity errors.
 
        """
 
        self.unassign()
 
        content.slot = self
 
        content.save()
 

	
 
    def unassign(self):
 
        """
 
        Unassign the associated content with this slot.
 
        """
 
        content = self.content
 
        if content and content.slot_id:
 
            content.slot = None
 
            content.save()
 

	
 
    @property
 
    def content(self):
 
        """
 
        Return the content this slot represents.
 
        @@@ hard-coded for presentation for now
 
        """
0 comments (0 inline, 0 general)