I am currently trying to modify the module so that the podcast's XML file is static rather than being generated on every request Can be served in the form. .
Every time an episode has been modified, created or deleted, and trying to do so, I am trying to rewrite the channel's XML file so that I am using it. What I would like to do, is something like this ... Import django.db.models.signals import_save from django.template.loader import from post_delete render_to_string def update_xml_file (sender, * * Kwargs): f = open ('channelrss.xml', 'w') f.write (render_to_string ('podcast / show_feed.html', {'object': sender.show})) show f.close () class (Models.Model): ... class episodes (models.model): post_save.connect (update_xml_file) post_delete.connect (update_xml_file) ... show = models.ForeignKey (Show) ...
The problem I am facing is that the sender The show is a but apparently sender.pk does a How do I get an example of Thanks for the time before your response! Josh You can try: model's reverse-breaking object descriptor and the show is not a real example of the class. I tried to reload the sender object like the primary key value of sender.pk such as ...
episode.objects.filter (pk = sender.pk) < / Pre>
property object and does not give an integer or string and I do not know how to get its value, so I think that There are two questions.
show associated with
episode ? And what the heck is a
property object and why does it return to sender.pk?
def update_xml_file (sender, example = false, ** kwargs): f = open ('channelrss.xml', 'w') f.write (render_to_string ('podcast / show_feed.html', {' Object ': instance.show})) f.close ()
example.show.name_field is
name_field .
No comments:
Post a Comment