2012-07-04 06:25:25 +00:00
|
|
|
import datetime
|
2012-06-04 13:27:32 +00:00
|
|
|
from django.db import models
|
|
|
|
from django.forms import ModelForm, Textarea
|
|
|
|
|
|
|
|
class Notification(models.Model):
|
|
|
|
message = models.CharField(max_length=512)
|
|
|
|
primary = models.BooleanField(default=False)
|
|
|
|
|
2012-06-25 13:40:18 +00:00
|
|
|
class UserNotification(models.Model):
|
2012-06-26 08:29:15 +00:00
|
|
|
to_user = models.EmailField(db_index=True, max_length=255)
|
|
|
|
msg_type = models.CharField(db_index=True, max_length=30)
|
2012-06-26 06:20:37 +00:00
|
|
|
detail = models.TextField()
|
2012-07-04 06:25:25 +00:00
|
|
|
timestamp = models.DateTimeField(default=datetime.datetime.now)
|
2012-06-25 13:40:18 +00:00
|
|
|
|
2012-06-04 13:27:32 +00:00
|
|
|
class NotificationForm(ModelForm):
|
|
|
|
"""
|
|
|
|
Form for adding notification.
|
|
|
|
"""
|
|
|
|
class Meta:
|
|
|
|
model = Notification
|
|
|
|
fields = ('message', 'primary')
|
|
|
|
widgets = {
|
|
|
|
'message': Textarea(),
|
|
|
|
}
|
|
|
|
|