#240 Customise admin interface for Message Model
Merged 5 months ago by jflory7. Opened 5 months ago by shraddhaag.
fedora-commops/ shraddhaag/fedora-happiness-packets custom-admin-interface  into  master

@@ -1,5 +1,27 @@ 

  from django.contrib import admin

  from happinesspackets.messaging.models import Message, BlacklistedEmail

  

- admin.site.register(Message)

- admin.site.register(BlacklistedEmail)

+ @admin.register(Message)

+ class MessageAdmin(admin.ModelAdmin):

+     list_display = ('identifier', 'status', 'admin_approved_public', 'sender_approved_public', 'recipient_approved_public')

+     list_filter = ('status','admin_approved_public', 'sender_approved_public', 'recipient_approved_public')

+ 

+     fieldsets = (

+         ('Sender Details', {

+             'fields': ('sender_name', 'sender_email', 'sender_email_stripped', 'sender_email_token', 'sender_ip')

+         }),

+         ('Recipient Details', {

+             'fields': ('recipient_name', 'recipient_email', 'recipient_email_stripped', 'recipient_email_token')

+         }),

+         ('Message Details', {

+             'fields': ('identifier', 'status', 'message')

+         }),

+         ('Message Permissions', {

+             'fields': (('sender_named', 'sender_approved_public', 'sender_approved_public_named'), ('recipient_approved_public', 'recipient_approved_public_named'), 'admin_approved_public')

+         })

+     )

+ 

+ @admin.register(BlacklistedEmail)

+ class MessageAdmin(admin.ModelAdmin):

+     pass

+ 

This commit modifies the message model admin interface:
1. Lists the messages with the identifier, status and permissions.
2. Can sort the messages with the above parameters.
3. Categorised the message details into sender, recipient, message and permission details.

Metadata Update from @jflory7:
- Pull-request tagged with: PASSED, needs testing, new change, type - backend, type - summer coding

5 months ago

Metadata Update from @jflory7:
- Pull-request untagged with: needs testing
- Request assigned

5 months ago

@shraddhaag This makes the admin interface for messages 100% easier to read and figure out if an admin user can approve new messages. Awesome work on this one!!

Easy merge. :ocean:

BTW, this is a really awesome change – if you have spare time, I suggest sending this one as a PR back upstream because it will likely be a big quality-of-life improvement for the upstream project too. :smile: To save yourself time, you can create a patch file for this commit and then apply the patch file to a fork of the upstream project. See this StackOverflow question for an easy way on how to do this. Feel free to tag my GitHub account in the upstream PR if you get to this.

Pull-Request has been merged by jflory7

5 months ago