Commit bc71115f authored by okhin's avatar okhin 🚴

Fixing the organization page

parent b4c50a97
Pipeline #1150 passed with stage
in 46 seconds
...@@ -17,6 +17,8 @@ class GroupInline(admin.TabularInline): ...@@ -17,6 +17,8 @@ class GroupInline(admin.TabularInline):
class GroupTypeAdmin(admin.ModelAdmin): class GroupTypeAdmin(admin.ModelAdmin):
list_display = ('name', 'organization',)
list_filter = ('organization',)
inlines = [GroupInline] inlines = [GroupInline]
def get_queryset(self, request): def get_queryset(self, request):
...@@ -37,6 +39,10 @@ class GroupTypeAdmin(admin.ModelAdmin): ...@@ -37,6 +39,10 @@ class GroupTypeAdmin(admin.ModelAdmin):
class GroupAdmin(admin.ModelAdmin): class GroupAdmin(admin.ModelAdmin):
list_display = ('name', 'type', 'organization',)
list_filter = ('type',)
search_fields = ['name',]
def get_queryset(self, request): def get_queryset(self, request):
qs = super(GroupAdmin, self).get_queryset(request) qs = super(GroupAdmin, self).get_queryset(request)
if request.user.is_superuser: if request.user.is_superuser:
......
...@@ -38,6 +38,9 @@ class Group(models.Model): ...@@ -38,6 +38,9 @@ class Group(models.Model):
contacts = models.ManyToManyField(Contact, blank=True, contacts = models.ManyToManyField(Contact, blank=True,
related_name='groups') related_name='groups')
def organization(self):
return self.type.organization
def __str__(self): def __str__(self):
return self.name return self.name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment