Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save
1. You dont need ManyToMany field class urlclass(models.Model): url =models.CharField() class itemclass(models.Model): url = models.ForeignKey(urlclass) myitem = models.CharField() #somewhere in view def saveitems(url, itemlist): for item in itemlist: item = itemclass(url= urlclass.objects.get(url=url), myitem=item) item.save() or something like that :-) 2012/11/26 Andriyko : > The problem is not how to fetch, but how to save. > > On Monday, November 26, 2012 2:37:31 PM UTC+2, Sergiy Khohlov wrote: >> >> >>> import httplib >> >>> myhost = httplib.HTTPConnection('www.google.com') >> >>> myhost.request("GET") >> >>> googleanswer = myhost.getresponse() >> >>> print googleanswer.read() >> > content="text/html;charset=utf-8"> >> 302 Moved >> 302 Moved >> The document has moved >> http://www.google.com.ua/";>here. >> >> >> >>> >> >> >> Need more ? >> >> >> 2012/11/25 Andriyko : >> > Hello, >> > >> > Please give an advice and some examples on how can I do the following. >> > 1. I need to fetch some data (list of items) from external url and save >> > that >> > list into the field of the, say Model1(possible?) >> > The problem is not how to fetch, but how to save. >> > 2. This should be done dynamically from admin add/change Model1 page >> > using >> > custom button or on Save. >> > 3. Currently I use another Model2 to store that list(ManyToMany). Is it >> > possible to store that list as field(and show these items on the Model's >> > page) without Model2 so that I can use items of that list in a template? >> > >> > In short, I want to be able to auto-fill some field of the model on Save >> > or/and with custom button. Possible? >> > >> > Thanks >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Django users" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/django-users/-/ZINp_t_15zAJ. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/hoO6KnjrjZkJ. > > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save
The problem is not how to fetch, but how to save. On Monday, November 26, 2012 2:37:31 PM UTC+2, Sergiy Khohlov wrote: > > >>> import httplib > >>> myhost = httplib.HTTPConnection('www.google.com') > >>> myhost.request("GET") > >>> googleanswer = myhost.getresponse() > >>> print googleanswer.read() > content="text/html;charset=utf-8"> > 302 Moved > 302 Moved > The document has moved > http://www.google.com.ua/";>here. > > > >>> > > > Need more ? > > > 2012/11/25 Andriyko >: > > Hello, > > > > Please give an advice and some examples on how can I do the following. > > 1. I need to fetch some data (list of items) from external url and save > that > > list into the field of the, say Model1(possible?) > > The problem is not how to fetch, but how to save. > > 2. This should be done dynamically from admin add/change Model1 page > using > > custom button or on Save. > > 3. Currently I use another Model2 to store that list(ManyToMany). Is it > > possible to store that list as field(and show these items on the Model's > > page) without Model2 so that I can use items of that list in a template? > > > > In short, I want to be able to auto-fill some field of the model on Save > > or/and with custom button. Possible? > > > > Thanks > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/ZINp_t_15zAJ. > > To post to this group, send email to > > django...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users...@googlegroups.com . > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/hoO6KnjrjZkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save
>>> import httplib >>> myhost = httplib.HTTPConnection('www.google.com') >>> myhost.request("GET") >>> googleanswer = myhost.getresponse() >>> print googleanswer.read() 302 Moved 302 Moved The document has moved http://www.google.com.ua/";>here. >>> Need more ? 2012/11/25 Andriyko : > Hello, > > Please give an advice and some examples on how can I do the following. > 1. I need to fetch some data (list of items) from external url and save that > list into the field of the, say Model1(possible?) > The problem is not how to fetch, but how to save. > 2. This should be done dynamically from admin add/change Model1 page using > custom button or on Save. > 3. Currently I use another Model2 to store that list(ManyToMany). Is it > possible to store that list as field(and show these items on the Model's > page) without Model2 so that I can use items of that list in a template? > > In short, I want to be able to auto-fill some field of the model on Save > or/and with custom button. Possible? > > Thanks > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/ZINp_t_15zAJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
how to auto-populate(auto-update) model's field(s) via custom button or on Save
Hello, Please give an advice and some examples on how can I do the following. 1. I need to fetch some data (list of items) from external url and save that list into the field of the, say Model1(possible?) The problem is not how to fetch, but how to save. 2. This should be done dynamically from admin add/change Model1 page using custom button or on Save. 3. Currently I use another Model2 to store that list(ManyToMany). Is it possible to store that list as field(and show these items on the Model's page) without Model2 so that I can use items of that list in a template? In short, I want to be able to auto-fill some field of the model on Save or/and with custom button. Possible? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZINp_t_15zAJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.