You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
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?
Mike Dewhirst
unread,
Dec 13, 2017, 7:14:08 PM12/13/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django users
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 do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
On 14/12/2017 11:14 AM, Udit Vashisht wrote:
> Thanks for the reply. I am new to python and django. Will have to
> google a lot to understand your solution :-)
A custom command just needs to follow a specific pattern and contain
functions with specific names so the command can be executed like python
manage.py fetch_web_values
> 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...@googlegroups.com