I want to redirect with HttpResponseRedirect or stop and display a
error message in admin view,
when user change some record in admin view while it not means some
conditions.

I try to rewrite save() in models.py

class Seed(models.Model):
    ....
    def save(self):
        if os.path.exist(file_a):
            super(Seed, self).save()
    ...


then do redirect view.py,

def seed_pre_save_handler(sender, **kwargs):
    ...
    if os.path.exist(file_a):
        return HttpResponseRedirect('/error/')

but above code doesn't work.

I couldn't find a good idea to do redirect from django official
documentation.

On 6月11日, 下午11时26分, Jashugan <jashu...@gmail.com> wrote:
> On Jun 11, 3:13 am,ShugeLee <shuge....@gmail.com> wrote:
>
> > For some reason, I want to create a static file after user change
> > record of DB with admin view, I need to use 
> > signalhttp://docs.djangoproject.com/en/dev/topics/signals/#topics-signals
>
> Yeah signals would work well.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to