Hi
Sorry about the last email - fat fingered it.
For some reason I can't get the model.save() method to actually save
the data I want it to. I have tried using both save() and
save(force_update=True) without any joy.
I have the following model:
class Applicant(model.Models):
...
successful = NullBooleanField()
...
def mark_successful(self):
self.successful = 0
self.last_change_by = request.user
#self.save(force_update=True)
self.save()
def mark_successful(self):
self.successful = 1
self.last_change_by = request.user
self.save(force_update=True)
self.save()
I call these functions from the admin interface, via admin.py:
class ApplicantAdmin(admin.ModelAdmin):
...
actions = ['mark_successful', 'mark_unsuccessful']
...
def mark_unsuccessful(self, request, queryset):
'''Marks a group of applicants as unsuccessful'''
rows_updated = 0
for applicant in queryset:
applicant.mark_unsuccessful(request)
rows_updated += 1
if rows_updated == 1:
message_bit = "1 applicant was"
else:
message_bit = "%s applicants were" % rows_updated
self.message_user(request, "%s marked unsuccessful." % message_bit)
Can anyone see what's going wrong?
cheers
L.
--
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, "We
look at the present through a rear-view mirror. We march backwards
into the future."
http://www.warrenellis.com/?p=14314
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment