On Mar 3, 10:50 am, Jon Reck <jonr...@gmail.com> wrote:
> I'm a novice Python and Django programmer so please don't assume a lot of
> knowledge here.
> I'm trying to place a link on an admin change form to a label printing
> function. I'd like to pass the id of the current record to the function. If
> I hardwire it in (see below- record number = 920) it works. I can't figure
> out how to code this so the current record number is inserted by the
> program. Is there some sort of template variable that I can use for this? Or
> can you suggest a better approach?
>
> thanks , Jon
>
> {% extends "admin/change_form.html" %}
> {% load i18n %}
> {% block after_field_sets %}
> <a href={% url company.views.render_company_label 920 %}>Print Labels</a>
> {% endblock %}

I believe that the object id for the current object is passed in the
context in object_id.

You can see it in use in the history link rendering in admin/
change_form.html:
href="../../../r/{{ content_type_id }}/{{ object_id }}/"

Wayne

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to