class RoomAdmin(admin.ModelAdmin):
list_display = ('name', 'created', 'last_activity_formatted', 'description', 'description_modified')
readonly_fields = ('created', 'description_modified', 'content_type', 'object_id')
- # As we've set some fields to be read-only, they will automatically appear at the end
+ # As we've set some fields to be read-only, they will automatically appear at the end
# of the list. Manually order the fields to be as they are defined in the model.
fieldsets = (
(None, {
(3, "has left the room."),
)
class messageManager(models.Manager):
-
+
def create_message(self, user, room, msg):
"""Create a message for the given user."""
m = Message.objects.create(user=user,
- a text typed in by the user.
- an event carried out in the room ("user X has left the room.").
- New messages should be created through the supplied manager methods, as all
+ New messages should be created through the supplied manager methods, as all
messages get preformatted (added markup) for display in the chat window.
For example:
-
+
Messages:
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
>>> room = Room.objects.create(name='Test room')