diff options
-rw-r--r-- | equations/models.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/equations/models.py b/equations/models.py index 6791eb2..7a5f8fe 100644 --- a/equations/models.py +++ b/equations/models.py @@ -7,7 +7,7 @@ from django.db.models import signals from signals import update_render class Symbol(models.Model): - name = models.CharField(_("Name"), maxlength=256) + name = models.CharField(_("Name"), max_length=256) latex = models.TextField(_("Raw LaTeX"), unique=True) unicode = models.TextField(_("Unicode Representation"), blank=True) renderdir = "symbolrenders/" @@ -46,12 +46,14 @@ def update_generic_variable(sender, instance, signal, *args, **kwargs): isgeneric=True) genericv.save() -dispatcher.connect(update_render, signal=signals.pre_save, sender=Symbol) -dispatcher.connect(update_generic_variable, signal=signals.post_save, - sender=Symbol) +signals.pre_save.connect(update_render, sender=Symbol) +signals.post_save.connect(update_generic_variable, sender=Symbol) +#dispatcher.connect(update_render, signal=signals.pre_save, sender=Symbol) +#dispatcher.connect(update_generic_variable, signal=signals.post_save, +# sender=Symbol) class Variable(models.Model): - name = models.CharField(_("Name"), maxlength=256) + name = models.CharField(_("Name"), max_length=256) latex = models.TextField(_("Raw LaTeX"), unique=True) unicode = models.TextField(_("Unicode Representation"), blank=True) description = models.TextField(_("Description"), blank=True) @@ -78,10 +80,11 @@ class Variable(models.Model): self.render = self.renderdir + "%s.png" % self.id super(Variable, self).save() -dispatcher.connect(update_render, signal=signals.pre_save, sender=Variable) +signals.pre_save.connect(update_render, sender=Variable) +#dispatcher.connect(update_render, signal=signals.pre_save, sender=Variable) class Equation(models.Model): - name = models.CharField(_("Name"), maxlength=256) + name = models.CharField(_("Name"), max_length=256) latex = models.TextField(_("Raw LaTeX"), unique=True) unicode = models.TextField(_("Unicode Representation"), blank=True) description = models.TextField(_("Description"), blank=True) @@ -116,5 +119,6 @@ class Equation(models.Model): self.render = self.renderdir + "%s.png" % self.id super(Equation, self).save() +signals.post_save.connect(update_render, sender=Equation) +#dispatcher.connect(update_render, signal=signals.post_save, sender=Equation) -dispatcher.connect(update_render, signal=signals.post_save, sender=Equation) |