fork download
  1. copy
  2. # models.py
  3. class Model():
  4.  
  5. ...
  6.  
  7. def title(self):
  8. is_last = Model.objects.all().order_by('-date').pk == self.pk
  9. if is_last:
  10. return '<b style="font-size:16px; color:....">%s<b>' % self.somefield
  11. return self.somefield
  12. title.allow_tags = True
  13. title.short_description = _(u'SomeField')
  14.  
  15.  
  16. # admin.py
  17. class ModelAdmin(admin.ModelAdmin):
  18.  
  19. list_display = ('title',)
Runtime error #stdin #stdout #stderr 0.02s 44680KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
  File "<string>", line 7
    def title(self):
                   ^
IndentationError: unindent does not match any outer indentation level