I've been struggling with the following for a couple of days, and
would appreciate any help or suggestions.  I'm still learning the
intricacies of both Django and Python, so please bear with me if this
is relatively obvious.  Alternatively, if you could point me to some
examples of how to do this, I'd be most appreciative.

Thanks,
Jim


We are developing a site that includes some administration rights for
particular organizations.  The admin rights can be set for each user/
member from a list of potential actions.  A user can be a member of
multiple organizations and have different admin rights for each
organization.

Using the regroup tag, I have gotten my template to look as follows:

Org 1
   action 1
   action 2
   action 3

Org 2
   action 1
   action 4

Each of the actions is rendered as a link.  What I would like to do is
pass the organization ( {{item.organization}} ) associated with the
action to the view that would handle the action.  So if a user clicked
on "action 1" under the "Org 2" heading, I'd like to pass "Org 2" to
the view "action 1".  I'd like to stay away from forms/buttons to make
the rendering a bit less cluttered, but may go that route if using
links isn't possible.

I have the following models (abridged):

class AdminRoles(models.Model):
    role_abbr = models.CharField(max_length = 2)
    role = models.CharField(max_length = 20)
    description = models.CharField(max_length = 50)

class AdminGroup(models.Model):
    description = models.CharField(max_length = 50)
    admin_roles = models.ManyToManyField(AdminRoles)

class AdminRights(models.Model):
    user = models.ForeignKey(User)
    organization = models.ForeignKey(Organization)
    admin_roles = models.ManyToManyField(AdminRoles, blank=True,
null=True)
    admin_group = models.ForeignKey(AdminGroup)

Here is the relevant template code:
                        {% regroup admin_rights|dictsort:"organization" by 
organization as
org_list %}
                        {% for organization in org_list %}
                        <div class="contentbox-container-full">
                                <div class="contentbox-title-shading bg-green07 
box-on">&nbsp;</
div>
                                <div 
class="contentbox-title-shading">{{organization.grouper}}
Administration</div>
                                {% for item in organization.list %}
                                        {%for a in item.admin_roles.all %}
                                                <h3 
class="hide">{{item.organization}}</h3>
                                                <p><a href={{ 
a.get_absolute_url }}>{{a}}</a></p>
                                        {% endfor %}
                                        <br>
                                {% endfor %}
                                </div>
                        {% endfor %}

--~--~---------~--~----~------------~-------~--~----~
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