It's hard to say, because I don't know what kind of "validation" or business
logic regarding it you are trying to accomplish/employ.

However, if you are wanting to ensure you validate a foto during a gallery
save, why not call an overridden fotos.save() from your custom
galeria.save()?

On Sun, Dec 5, 2010 at 1:25 PM, Daniel Carvalho <idn...@gmail.com> wrote:

> hi
>
> I have this models:
>
>
> models.py:
>
> class Galeria(models.Model):
>    ...
> class Foto(models.Model):
>    ...
>    galeria = models.ForeignKey(Galeria, null=False)
>
>
> admin.py:
>
> class FotoInline(admin.StackedInline):
>    model = Foto
> class GaleriaAdmin(admin.ModelAdmin):
>    inlines = [FotoInline, VideoInline]
> admin.site.register(Galeria, GaleriaAdmin)
>
>
>
> When a galeria is saved in the django administration, I want to perform
> a validation that involves his fotos. ..
>
> They are edited at the same time because I use inline in the admin.
>
>
> But cannot do that in Galeria.save, nor GaleriaAdmin.save_model, nor in
> a postsave event from galeria, because at the time it is called the
> fotos have not been saved yet.
>
> Where should I do it the validation?
> Have to define a GaleriaForm and do something there?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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