I am trying to generate a printable report when saving objects for the
first time. This is easy enough except I can't easily access related
objects by overriding save() as they are not saved yet, nor are they
available within the save() method.
The new ModelAdmin.save_related() in Django 1.4 method seems to have
been created for just my need. The docs say: "Here you can do any pre-
or post-save operations for objects related to the parent. Note that
at this point the parent object and its form have already been saved."
From what I read this seems perfect for my use case.
if not change:
# Generate and send report only if creating for first time
parent_obj = form.instance
import pdb; pdb.set_trace();
1) At that point when I look into the database I don't see the saved
parent object? This seems to contradict the docs.
2) I can access cleaned data from the formsets, but is there an easy
way to simply get the related instances as I would with
parent.child_set.all(). This would make my life much easier as I have
written the code already to print a LaTeX report from any Django model
(by looping _meta.fields approach).
> I am trying to generate a printable report when saving objects for the
> first time. This is easy enough except I can't easily access related
> objects by overriding save() as they are not saved yet, nor are they
> available within the save() method.
> The new ModelAdmin.save_related() in Django 1.4 method seems to have
> been created for just my need. The docs say: "Here you can do any pre-
> or post-save operations for objects related to the parent. Note that
> at this point the parent object and its form have already been saved."
> From what I read this seems perfect for my use case.
> if not change:
> # Generate and send report only if creating for first time
> parent_obj = form.instance
> import pdb; pdb.set_trace();
> 1) At that point when I look into the database I don't see the saved
> parent object? This seems to contradict the docs.
> 2) I can access cleaned data from the formsets, but is there an easy
> way to simply get the related instances as I would with
> parent.child_set.all(). This would make my life much easier as I have
> written the code already to print a LaTeX report from any Django model
> (by looping _meta.fields approach).
> On May 16, 3:55 pm, ghachey <ghac...@gmail.com> wrote:
>> Hi;
>> I am trying to generate a printable report when saving objects for the
>> first time. This is easy enough except I can't easily access related
>> objects by overriding save() as they are not saved yet, nor are they
>> available within the save() method.
>> The new ModelAdmin.save_related() in Django 1.4 method seems to have
>> been created for just my need. The docs say: "Here you can do any pre-
>> or post-save operations for objects related to the parent. Note that
>> at this point the parent object and its form have already been saved."
>> From what I read this seems perfect for my use case.
>> if not change:
>> # Generate and send report only if creating for first time
>> parent_obj = form.instance
>> import pdb; pdb.set_trace();
>> 1) At that point when I look into the database I don't see the saved
>> parent object? This seems to contradict the docs.
>> 2) I can access cleaned data from the formsets, but is there an easy
>> way to simply get the related instances as I would with
>> parent.child_set.all(). This would make my life much easier as I have
>> written the code already to print a LaTeX report from any Django model
>> (by looping _meta.fields approach).
>> I would appreciate any help.
>> --
>> GH
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.