Hello, I wrote a model to manage small TeX fragments:

class LaTeX(models.Model):
    latex = models.TextField(help_text="Un extrait de source LaTeX")
    macros = models.ForeignKey(Macros)

For now, I override save() to compile the latex string using macros
strings with LaTeX compilator, and produce a
png image that I store with a name made with self.id (so I need to
call super...save() before). But in case of
LaTeX compilation errors, I just raise an exception that will not
appear in production with DEBUG = False.

I'd like to treat  LaTeX compilation errors as standard validation
errors to
appear in error list in forms, admin...

 I don't know how to do this, I looked at
- signals (pre-post save) : what about validation ?
- write a TextField  subclass and override validate to do compilation
here ? But I need to access another field 'macros'  and model.id  ...
- I found http://code.djangoproject.com/ticket/6845 with a patch to do
model validation (1 year ago) that looks
like what I need, but is it stable?

Any hint ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to