Thanks Andrea I'm gonna investigate this !!!

Rafael E. Ferrero

2016-01-18 9:02 GMT-03:00 Andreas Kuhne <[email protected]>:

> Hi Rafael,
>
> I would use a plugin for django admin that creates an autocomplete field
> (django-selectable works). Then when the user chooses something in the
> autocomplete list, I would populate the other fields via ajax with the
> values that you need. That way you don'ẗ need a foreign key field (even
> though you could have it until the product is deleted) and you would get
> the functionality that you need.
>
> Regards,
>
> Andréas
>
> 2016-01-18 12:54 GMT+01:00 Rafael E. Ferrero <[email protected]>:
>
>> Hello everybody,
>>
>> I'm gonna try to express my use case and hope you can help me to achieve
>> this objective because i can't figure it out how i can resolve it.
>>
>> 1) I have a model of Products, with a lot of data for description, and
>> other stuff.
>> (Let me say, ID, Short Description, Long Description,Minimun Amount Of
>> Products Per Sale, Cost Price, Sale Price,
>> 2) Then I have an other table (you can call it Sales), in this i need to
>> save data of Products (Descriptions, Measure of units, and other specific
>> data of my project)
>> (Let me say, ID, Short Description, Long Description, Sale Price, Date of
>> Sale, Number of Document, etc.) where Short and Long Description, and Sale
>> Price it's from Products model.
>>
>> The Sales model DO NOT have to be related to Products with a Foreign key
>> because we use Sales as Historic model too. So i need to take the data from
>> Products and save it in Sales. So, I think that I can rewrite the method
>> "save" in Sales model.
>>
>> But... In the Admin Site, in the Sales form, I need a dropdown box of
>> Products and when i choose one of them I need to populate the needed data
>> in the fields of the Sales form, where the user can (If he wish), for
>> example, add more text to Long Description field.
>>
>> How I can put data of Products in the fields of Sales form without any
>> relationship to Products, and how i can populate the fields based on the
>> selected product??
>>
>> Thanks in advance !!
>>
>> Rafael E. Ferrero
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJJc_8VScv11s-cwRE%2BCFXn2oH-29KL12iUk-%2BJHzD6A3TgVhw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJJc_8VScv11s-cwRE%2BCFXn2oH-29KL12iUk-%2BJHzD6A3TgVhw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUb%3D3iBKz_m%3DKjcAru78rTDDG%2BFKuEqhoq6W0AURViNTJPQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUb%3D3iBKz_m%3DKjcAru78rTDDG%2BFKuEqhoq6W0AURViNTJPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJJc_8UXUkMjASpygc77Ja99LyGGyP8TDD6GEkqKRRJ4MUO0jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to