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 <ahryts...@gmail.com>: > 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() >> <HTML><HEAD><meta http-equiv="content-type" >> content="text/html;charset=utf-8"> >> <TITLE>302 Moved</TITLE></HEAD><BODY> >> <H1>302 Moved</H1> >> The document has moved >> <A HREF="http://www.google.com.ua/">here</A>. >> </BODY></HTML> >> >> >>> >> >> >> Need more ? >> >> >> 2012/11/25 Andriyko <ahry...@gmail.com>: >> > 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.