related_url = 'admin:%s_%s_add' % info
self.related_url = related_url

def render(self, name, value, *args, **kwargs):
    self.related_url = reverse(self.related_url)
output = [super(RelatedFieldWidgetCanAdd, self).render(name, value, *args,
    **kwargs)]
output.append(
    '<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
     % (self.related_url, name))
output.append(
    '<img src="%sadmin/img/icon_addlink.gif" width="10" height="10" alt="%s"/></a>'
     % (settings.STATIC_URL, 'Add Another'))
return mark_safe(''.join(output))
Django: adding an "Add new" button for a ForeignKey in a ModelForm