Opps, sorry. I was actually trying to ask how one would get a hold of the current model in this admin form, but the Esc key for some reason sent the message.
The above function works, but the instance is not a model instance which can be saved. How would I go about getting the current RssFeedPage model which pertains to the form instance?
This works great on the cli --> from Django_project.update_rss_feeds import *; m = get_models(); rss_page = m[1]; rss_item=m[2]; UpdateFeeds().parse_feed(page_model_instance=rss_page.objects.get(pk=1), rss_item=rss_item, feed_url="http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml")
..because I pass in a usable model to -> parse_feed(page_model_instance=model)
Note: this script will be open-sourced shortly. I will post the repo when it is ready :)
On Sat, Jan 25, 2014 at 2:29 PM, Robert Steckroth <robertsteckroth@gmail.com> wrote:
class RssFeedPageForm(forms.ModelForm):class Meta:model = RssFeedPagedef clean_link(self):self.instance.save()
page_model_instance=self.instance, rss_item=RssFeedItem, feed_url=self.data['link'])UpdateFeeds().parse_feed(page_model_instance=self.instance, rss_item=RssFeedItem, feed_url=self.data['link'])--<surgemcgee>
<surgemcgee>
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-VaPf72eDCrPpOqkz%3Dx3twNSy_2oKU3i4YevnWVmnPhEi9xg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment