Advice please.

19 views
Skip to first unread message

Hector Berrones

unread,
Aug 2, 2020, 8:22:00 PM8/2/20
to django...@googlegroups.com
Hi Bros,

I have very little experience using django and I would like to know how would be the most conveniente way  to store and manage the common data in a django proyect that would have several  applications  when I say common data I mean information about tables cities, Countries, Catalog Sections I mean information that usera can use select from a Select Field in for example.

Thanks in advance for reading me.

Ryan Nowakowski

unread,
Aug 2, 2020, 9:16:12 PM8/2/20
to django...@googlegroups.com


On August 2, 2020 7:21:04 PM CDT, Hector Berrones <hec...@getin2web.com> wrote:
>I have very little experience using django and I would like to know how
>would be the most conveniente way to store and manage the common data
>in a
>django proyect that would have several applications when I say common
>data I mean information about tables cities, Countries, Catalog
>Sections I
>mean information that usera can use select from a Select Field in for
>example.
>

For your model, if the data is relatively static, use a CharField with choices. If the data is likely to change often, use a model for each kind of data and link them together with ForeignKey.

Then in your ModelForm, either the CharField with choices or the ForeignKey will be shown as a ChoiceField which renders as a select input in your template.

Hector Berrones

unread,
Aug 3, 2020, 12:55:41 AM8/3/20
to django...@googlegroups.com
Thank you Rayan.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/FE1AAC21-E0DA-49F2-AFAF-36142DFC83B5%40fattuba.com.

Chucky Mada Madamombe

unread,
Aug 3, 2020, 1:00:22 AM8/3/20
to django...@googlegroups.com
Hi,

You have 2 options:

1. You can use choices 
2. You can store data in a model, and then link with a foreign key.

First option is suitable for that data which wont change regularly e.g gender..For data that changes or need to be updated regularly,  then use second option.

--
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...@googlegroups.com.

Hector Berrones

unread,
Aug 3, 2020, 10:49:08 AM8/3/20
to django...@googlegroups.com
Thacks Chucky, Since I would kike fot the users to personalize their own options I think I would choose the second option, thanks a lot for the advice.

Reply all
Reply to author
Forward
0 new messages