Django: Is there a way to add a model instance method to the admin? -
I would like to add a method that my ticket model is called a process, so that I can click on a link in the list view In, and "model" for example "process" (do an API call behind the scenes).
To clarify:
class tickets (models.Model): Title = models.CharField (max_length = 255) def process (self): ... hardcore Processing action ...
I need to add process ()
method to admin directly without using a different function
You just need to provide a small method in your ModelAdmin class that points to the viewer calling your model methodLink lets add the method name modeladmin the list_display
tuple will need to clearly define the scene here, and will point to the url.
Comments
Post a Comment