Thank you! You're right, I don't even want to be able to edit datapoints, 
just display them in the admin view so they shouldn't be an inline.

On Wednesday, January 14, 2015 at 9:42:57 AM UTC-5, Collin Anderson wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
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/98b2e9dc-3ecc-4919-a356-c288a9f6b510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to