diff options
-rw-r--r-- | equations/models.py | 26 | ||||
-rw-r--r-- | equations/templates/equations/equation_detail.html | 2 | ||||
-rw-r--r-- | equations/templates/equations/equation_list.html | 2 | ||||
-rw-r--r-- | equations/templates/equations/symbol_detail.html | 2 | ||||
-rw-r--r-- | equations/templates/equations/symbol_list.html | 2 | ||||
-rw-r--r-- | equations/templates/equations/variable_detail.html | 2 | ||||
-rw-r--r-- | equations/templates/equations/variable_list.html | 2 | ||||
-rw-r--r-- | templates/404.html | 6 | ||||
-rw-r--r-- | urls.py | 6 |
9 files changed, 35 insertions, 15 deletions
diff --git a/equations/models.py b/equations/models.py index d011181..e644a37 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/" @@ -48,12 +48,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) @@ -80,10 +82,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) @@ -118,5 +121,12 @@ 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) + +from django.contrib import admin + +admin.site.register(Symbol) +admin.site.register(Variable) +admin.site.register(Equation) -dispatcher.connect(update_render, signal=signals.post_save, sender=Equation) diff --git a/equations/templates/equations/equation_detail.html b/equations/templates/equations/equation_detail.html index 978b2e1..968e5ef 100644 --- a/equations/templates/equations/equation_detail.html +++ b/equations/templates/equations/equation_detail.html @@ -4,7 +4,7 @@ {% block content %} <div style="width: 100%; text-align:center;"> -<img src="{{ object.get_render_url }}" style="border: none;" /></div> +<img src="{{ object.render.url }}" style="border: none;" /></div> <br /> <table width="100%"> {% if object.description %} diff --git a/equations/templates/equations/equation_list.html b/equations/templates/equations/equation_list.html index 549c38f..9712182 100644 --- a/equations/templates/equations/equation_list.html +++ b/equations/templates/equations/equation_list.html @@ -8,7 +8,7 @@ {% for item in object_list %} <tr style="height:60px;"><td style="width:50%;"> <a href="{{ item.get_absolute_url }}" class="imglink"> - <img style="border: none;" src="{{ item.get_render_url }}" /></a> + <img style="border: none;" src="{{ item.render.url }}" /></a> </td><td style="width: 50%"><a href="{{ item.get_absolute_url }}"> {{ item.name }}</a></td></tr> {% endfor %} diff --git a/equations/templates/equations/symbol_detail.html b/equations/templates/equations/symbol_detail.html index 85f59d8..b53b1d6 100644 --- a/equations/templates/equations/symbol_detail.html +++ b/equations/templates/equations/symbol_detail.html @@ -4,7 +4,7 @@ {% block content %} <div style="width: 100%; text-align:center;"> -<img src="{{ object.get_render_url }}" style="border: none;" /></div> +<img src="{{ object.render.url }}" style="border: none;" /></div> <br /> <table width="100%"> <tr><td width="25%"><b>Raw LaTeX:</b></td><td><pre>{{ object.latex }}</pre></td></tr> diff --git a/equations/templates/equations/symbol_list.html b/equations/templates/equations/symbol_list.html index 1983b3f..99c4f55 100644 --- a/equations/templates/equations/symbol_list.html +++ b/equations/templates/equations/symbol_list.html @@ -8,7 +8,7 @@ {% for item in object_list %} <tr style="height:60px;"><td style="width:10%;padding-left:10%;"> <a href="{{ item.get_absolute_url }}" class="imglink"> - <img style="border: none;" src="{{ item.get_render_url }}" /></a> + <img style="border: none;" src="{{ item.render.url }}" /></a> </td><td style="width: 70%"><a href="{{ item.get_absolute_url }}"> {{ item.name }}</a></td></tr> {% endfor %} diff --git a/equations/templates/equations/variable_detail.html b/equations/templates/equations/variable_detail.html index 05c432f..63ca233 100644 --- a/equations/templates/equations/variable_detail.html +++ b/equations/templates/equations/variable_detail.html @@ -4,7 +4,7 @@ {% block content %} <div style="width: 100%; text-align:center;"> -<img src="{{ object.get_render_url }}" style="border: none;" /></div> +<img src="{{ object.render.url }}" style="border: none;" /></div> <br /> <table width="100%"> {% if object.description %} diff --git a/equations/templates/equations/variable_list.html b/equations/templates/equations/variable_list.html index 9ff7a64..dbd6e41 100644 --- a/equations/templates/equations/variable_list.html +++ b/equations/templates/equations/variable_list.html @@ -8,7 +8,7 @@ {% for item in object_list %} <tr style="height:60px;"><td style="width:10%;padding-left:10%;"> <a href="{{ item.get_absolute_url }}" class="imglink"> - <img style="border: none;" src="{{ item.get_render_url }}" /></a> + <img style="border: none;" src="{{ item.render.url }}" /></a> </td><td style="width: 70%"><a href="{{ item.get_absolute_url }}"> {{ item.name }}</a></td></tr> {% endfor %} diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..10431f4 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} + +{% block title %}<span style="color: orange;">OH NOZ!</span>{% endblock %} +{% block content %} +Sumthing iz wrong! +{% endblock %} @@ -1,11 +1,15 @@ from django.conf.urls.defaults import * from django.conf import settings +from django.contrib import admin from equations.models import Equation, Symbol, Variable +admin.autodiscover() + urlpatterns = patterns('', (r'^go/', 'django.views.generic.simple.direct_to_template', {'template': 'go.html'}), - (r'^admin/', include('django.contrib.admin.urls')), + (r'^admin/doc/', include('django.contrib.admindocs.urls')), + (r'^admin/(.*)', admin.site.root), (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) |