Ok so I will write a custom form.

 I think that I  will also write a custom field to do some specific
things (for example add a url method to get
png ...). I need to understand better the methods :

- contribute_to_class,
-validate, validate_full
-formfield

I found nothing in django's doc, and few examples with google. There
are some usuful stuff in  "pro Django" book
but I'm looking for other doc and examples. In particular, I don't
understand how
validate(self, field_data, all_data) works (how to handle
all_data ?).

I would like to find examples or detailled docs on those topics. If
anyone could point a link ...

Thanks, Alain.



On 1 sep, 14:32, Thomas Guettler <h...@tbz-pariv.de> wrote:
> Hi,
>
> Up to now Model Validation is not possible with django. You need to use
> a ModelForm. The documentation contains examples how to do custom validation.
>
> alain31 schrieb:
>
>
>
> > 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 foundhttp://code.djangoproject.com/ticket/6845with a patch to do
> > model validation (1 year ago) that looks
> > like what I need, but is it stable?
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~---------~--~----~------------~-------~--~----~
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