Hi,

You are using an inline which uses a formset under the hood. When a formset 
gets saved it gets the expected new_objects, but you're not saving the 
formset.

It might make sense to not use an inline and display the data points by 
hand.

Collin

On Tuesday, January 13, 2015 at 8:49:54 AM UTC-5, mateja wrote:
>
> I am working on a simple application to store sets of collected datapoints 
> into a dataset. I am using the admin interface to handle CRUD management of 
> the dataset objects. I would like to be able to add additional datapoints 
> to an existing dataset instance by importing model data from a file. The 
> error happens when I save the change form, I get the error "object has no 
> attribute 'new_objects'"
>
> This is what the admin change view looks like: http://imgur.com/gQGXquS
>
> I have overridden the admin change view to include a file field that 
> accepts a CSV file containing datapoint data. When the user clicks the Save 
> button, the file should upload and the app should import and save 
> datapoints from the file and associate them with the given dataset. I have 
> googled around for this error and I have seen where others omitted to call 
> the save_m2m() function, but I don't think this is what I am trying to do 
> as I am not using a formset, I am using a file upload.
>
> I have overridden the Dataset ModelAdmin save_model function to accept the 
> file, save the datapoints, and associate them with the given dataset.
>
> The code and the full error log is all here: 
> https://gist.github.com/matejaputic/0e25cd74830033442886
>
> Is this the right way to do this? I would appreciate any guidance.
>
> Also, why are the existing datapoints being resubmitted? How can I prevent 
> that from happening?
>
> Thank you
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59f8ab4f-0da7-47d1-a84b-1d84a76165b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to