from django.contrib import admin

from .models import Discussion, Group


class GroupAdmin(admin.ModelAdmin):
    filter_horizontal = ('moderators', 'watchers', 'members_if_private')

    class Meta:
        model = Group


class DiscussionAdmin(admin.ModelAdmin):
    filter_horizontal = ('subscribers', 'ignorers')

    class Meta:
        model = Discussion


admin.site.register(Group, GroupAdmin)
admin.site.register(Discussion, DiscussionAdmin)

from django.contrib import admin

from .models import Discussion, Group


@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
    filter_horizontal = ('moderators', 'watchers', 'members_if_private')

    class Meta:
        model = Group


@admin.register(Discussion)
class DiscussionAdmin(admin.ModelAdmin):
    filter_horizontal = ('subscribers', 'ignorers')

    class Meta:
        model = Discussion

Use a decorator for slickness.
Use a decorator for slickness.

  from django.contrib import admin
  
  from .models import Discussion, Group
  
  
+ @admin.register(Group)
  class GroupAdmin(admin.ModelAdmin):
      filter_horizontal = ('moderators', 'watchers', 'members_if_private')
  
      class Meta:
          model = Group
  
  
+ @admin.register(Discussion)
  class DiscussionAdmin(admin.ModelAdmin):
      filter_horizontal = ('subscribers', 'ignorers')
  
      class Meta:
          model = Discussion
  
- 
- admin.site.register(Group, GroupAdmin)
- admin.site.register(Discussion, DiscussionAdmin)
- 
Use a decorator for slickness.
## Code Before:
from django.contrib import admin

from .models import Discussion, Group


class GroupAdmin(admin.ModelAdmin):
    filter_horizontal = ('moderators', 'watchers', 'members_if_private')

    class Meta:
        model = Group


class DiscussionAdmin(admin.ModelAdmin):
    filter_horizontal = ('subscribers', 'ignorers')

    class Meta:
        model = Discussion


admin.site.register(Group, GroupAdmin)
admin.site.register(Discussion, DiscussionAdmin)

## Instruction:
Use a decorator for slickness.
## Code After:
from django.contrib import admin

from .models import Discussion, Group


@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
    filter_horizontal = ('moderators', 'watchers', 'members_if_private')

    class Meta:
        model = Group


@admin.register(Discussion)
class DiscussionAdmin(admin.ModelAdmin):
    filter_horizontal = ('subscribers', 'ignorers')

    class Meta:
        model = Discussion
