I've created my own edit_inline class so I can override the template.
This was easy. However, due to lack of documentation, I'm busting my
head trying to figure out how to do this:

I have an Article that is connected to a Photos model using the
ArticleImage model like this:

class ArticleImages(models.Model):
    article = models.ForeignKey(Article,
edit_inline=ArticleImageRelatedObject, num_in_admin=5,
                              max_num_in_admin=99,
num_extra_on_change=3, related_name='article_images')
    photo = models.ForeignKey(Photo, raw_id_admin=True)
    number = models.IntegerField(core=True, help_text='Delete this to
delete the image')

I have copied the ArticleImageRelatedObject from the
TabularRelatedObject:

class ArticleImageRelatedObject(BoundRelatedObject):
    def __init__(self, related_object, field_mapping, original):
        super(ArticleImageRelatedObject,
self).__init__(related_object, field_mapping, original)
        self.field_wrapper_list = [FieldWrapper(field) for field in
self.relation.editable_fields()]

        fields = self.relation.editable_fields()

        self.form_field_collection_wrappers =
[FormFieldCollectionWrapper(field_mapping, fields, i)
                                               for (i,field_mapping)
in self.field_mappings.items() ]
        self.original_row_needed = max([fw.use_raw_id_admin() for fw
in self.field_wrapper_list])
        self.show_url = original and hasattr(self.relation.opts,
'get_absolute_url')

    def template_name(self):
        return "admin/articles/articleimages/
edit_inline_tabular.html"

I've just extended the template.

What I would like to do, is to display another link next to the
'show_url', which has value related to the ArticleImage object. I
can't for the life of me figure out how to access the original
ArticleImage instance from the ArticleImageRelatedObject.

Please help!


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to