[Answer]-How to do simple function operations in django and return values to the admin interface?

1👍

#models.py
class Calc(models.Model):
    id = models.AutoField(primary_key=True)
    status = models.CharField(max_length=100), 
    text = models.CharField(max_length=100)
    @property
    def checkStatus():
      return 'xxx'

#views.py
from django.views.generic import DetailView,
  class Calc(DetailView):
     model = Calc

#template
{{ object.checkStatus }}
👤sai

Leave a comment