How to set the sucess message after inserting values to db in django admin
site
like message department added sucessfully
model:
class mdldepartments(models.Model):
class Meta:
verbose_name_plural = "Departments"
verbose_name = "Department"
property = models.ForeignKey(mdlhotelproperty, to_field = 'property_id')
dept_id = models.AutoField(primary_key=True,null=False,blank=False)
dept_name = models.CharField(max_length=100,null=False,blank=False)
dept_desc = models.TextField()
status = models.ForeignKey('hmsCommon.mdlstatus')
def __str__(self):
return self.dept_name
Modelform:
class departmentForm(forms.ModelForm):
model=mdldepartments
def clean(self):
dept_msg = u"Department name allows only characters."
cleaned_data = self.cleaned_data
dept = cleaned_data.get("dept_name")
pattern = re.compile("([A-Z,a-z])")
if not pattern.match(dept):
self._errors["dept_name"] = ErrorList([dept_msg])
#else:
# self.
return cleaned_data
Admin register:
class mdldepartmentsAdmin(admin.ModelAdmin):
form=departmentForm
list_display = ('dept_name','status')
search_fields = ['dept_name']
list_filter = ['status']
admin.site.register(mdldepartments,mdldepartmentsAdmin)
And i tried to enable the messaging module in django but in django.contrib
messages folder is missing
my django version is 1.1
Thaks
Radhika
--
View this message in context:
http://old.nabble.com/How-to-set-the-sucess-message-after-inserting-values-to-db-in-django-admin-site-tp28324504p28324504.html
Sent from the django-users mailing list archive at Nabble.com.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.