0

Lets say I have a model:

class Applicant(models.Model):
   name = models.CharField()
   status = Models.CharField(choices=Choices)

Lets say Choices gives the choices of Reviewed, Rejected, Accepted.

I want to be able to declare a choice for an instance in the admin panel, and once I save the choice, the instance is moved to another section, preferably another admin folder such as Reviewed Applicants, Rejected Applicant, etc etc.

Whats the best way to achieve this?

Thank you

Anthony
  • 929
  • 7
  • 21
  • [This](https://stackoverflow.com/questions/42230437/django-admin-how-to-redirect-to-another-url-after-object-save) might help. – k33da_the_bug Apr 27 '20 at 14:55

1 Answers1

0

Quoted from This, This should solve your problem

from django.shortcuts import redirect

class PaymentAdmin(VersionAdmin, admin.ModelAdmin):
    def response_add(self, request, obj, post_url_continue=None):
        return redirect('/admin/sales/invoice')

    def response_change(self, request, obj):
        return redirect('/admin/sales/invoice')

and here're the official doc links

Ahmed I. Elsayed
  • 2,013
  • 2
  • 17
  • 30
  • Thanks, this is along the right lines, although I am still struggling to implement the moving of instances based on the choices attribute. – Anthony Apr 27 '20 at 16:57