Changeset 65974d1 for asadb/groups/views.py
- Timestamp:
- May 29, 2011, 3:10:29 AM (14 years ago)
- Branches:
- master, space-access, stable, stage, test-hooks
- Children:
- 5b68039
- Parents:
- 5daa12a
- git-author:
- Alex Dehnert <adehnert@…> (05/29/11 03:00:33)
- git-committer:
- Alex Dehnert <adehnert@…> (05/29/11 03:10:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/views.py
rc4a4d13 r65974d1 4 4 5 5 from django.contrib.auth.decorators import user_passes_test, login_required 6 from django.contrib.contenttypes.models import ContentType 6 7 from django.core.exceptions import PermissionDenied 7 from django.views.generic import DetailView8 from django.views.generic import ListView, DetailView 8 9 from django.shortcuts import render_to_response, get_object_or_404 9 10 from django.template import RequestContext … … 19 20 20 21 import form_utils.forms 22 import reversion.models 21 23 22 24 class GroupChangeMainForm(form_utils.forms.BetterModelForm): … … 102 104 context['viewpriv'] = self.request.user.has_perm('groups.view_group_private_info', group) 103 105 return context 106 107 class GroupHistoryView(ListView): 108 context_object_name = "version_list" 109 template_name = "groups/group_version.html" 110 111 def get_queryset(self): 112 history_entries = None 113 if 'group' in self.kwargs: 114 group = get_object_or_404(groups.models.Group, pk=self.kwargs['group']) 115 history_entries = reversion.models.Version.objects.get_for_object(group) 116 else: 117 history_entries = reversion.models.Version.objects.all() 118 group_content_type = ContentType.objects.get_for_model(groups.models.Group) 119 history_entries = history_entries.filter(content_type=group_content_type) 120 return history_entries 121 122 def get_context_data(self, **kwargs): 123 context = super(GroupHistoryView, self).get_context_data(**kwargs) 124 if 'group' in self.kwargs: 125 group = get_object_or_404(groups.models.Group, pk=self.kwargs['group']) 126 context['title'] = "History for %s" % (group.name, ) 127 else: 128 context['title'] = "Recent Changes" 129 return context
Note: See TracChangeset
for help on using the changeset viewer.