Skip to content
Browse files

adding search for messages

  • Loading branch information...
1 parent 39c55c7 commit c5f8f0370accbf8237d2bfeb20e917dd2f1e6f2a @philippWassibauer philippWassibauer committed
Showing with 24 additions and 4 deletions.
  1. +1 −1 README.rst
  2. +1 −1 threaded_messages/__init__.py
  3. +22 −2 threaded_messages/admin.py
View
2 README.rst
@@ -60,7 +60,7 @@ I am not sure what the exact differences are to this implementation. I am pretty
Follow Me
===============
http://github.com/philippWassibauer
-http://twitter.com/scalar
+http://twitter.com/__philw__
http://philippw.tumblr.com
https://bitbucket.org/philippwassibauer
View
2 threaded_messages/__init__.py
@@ -1,2 +1,2 @@
-VERSION = (0, 1, 26)
+VERSION = (0, 1, 27)
__version__ = '.'.join(map(str, VERSION))
View
24 threaded_messages/admin.py
@@ -6,9 +6,29 @@
from threaded_messages.models import *
+class MessagesInline(admin.TabularInline):
+ model = Message
+ fields = ['sender', 'sent_at', 'body']
+ readonly_fields = ['sender', 'sent_at', 'body']
+ ordering = ("-sent_at",)
+ can_delete = False
+
+
class MessageAdmin(admin.ModelAdmin):
list_display = ('sender', 'sent_at','body')
-
+ ordering = ('-sent_at',)
+ search_fields = ('body', 'sender__first_name',
+ 'sender__last_name', 'sender__username')
admin.site.register(Message, MessageAdmin)
-admin.site.register(Thread)
+
+
+class ThreadAdmin(admin.ModelAdmin):
+ list_display = ('subject', 'creator', 'replied')
+ ordering = ('sent_at',)
+ search_fields = ('subject', 'creator__first_name',
+ 'creator__last_name', 'creator__username')
+ inlines = [MessagesInline]
+admin.site.register(Thread, ThreadAdmin)
+
+
admin.site.register(Participant)

0 comments on commit c5f8f03

Please sign in to comment.
Something went wrong with that request. Please try again.