So that does not work. Is there a builtin method that will allow me to call
the script before the form is rendered in save_model?

    form = RssFeedPageForm # <-- how can this be loaded with UpdateFeeds
ValidationErrors?
    def save_model(self, request, obj, form, change):
        # UpdateFeeds().parse_feed will raise VailidationError
        UpdateFeeds().parse_feed(update_feed_data=True,
update_item_data=True, page_model_instance=obj, rss_item=RssFeedItem,
feed_url=form.data['link'])



On Sat, Jan 25, 2014 at 2:37 PM, Robert Steckroth <robertsteckr...@gmail.com
> wrote:

> 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 <
> robertsteckr...@gmail.com> wrote:
>
>>
>>
>> class RssFeedPageForm(forms.ModelForm):
>>     class Meta:
>>         model = RssFeedPage
>>
>>     def 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>
>
>
>
>


-- 
<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+unsubscr...@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-VaPcR4FRA7-NvGY3V3cf%3Dr-tUUXnw_tiL%3DTwUrpMTNYKw6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to