On 14/12/2017 3:15 AM, Udit Vashisht wrote:
> I have an outside python function which reads a csv from web and fetch
> certain data in forms of tuple. So that i can use that tuple in my
> python models for choices in one of the fields. Till now i am running
> the function independently and copying the returned tuple to my
> models.py for choices. But there must be some better way. like
> pickling it etc etc. Can anyone help me with that?
I suggest you import the csv data into a table using a manage.py custom
command. Then you need to point your field requiring choices at that table.
You could perhaps then run your manage.py command on a cron schedule?
> --
> 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+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> 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/723351d1-aaae-4784-8c78-ae114e5a64c2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/723351d1-aaae-4784-8c78-ae114e5a64c2%40googlegroups.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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/b1f6bc2f-3dc9-dc19-6a99-28aab11b5a06%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment