How to call fields from Revision model in a custom inherited model?
See original GitHub issueFor example, if I need call date_created
from Revision in my admin.py as list_display field? Is there possible?
@admin.register(Container)
class ContainerAdmin(CompareVersionAdmin, admin.ModelAdmin):
list_display = ('date_created', 'id_auto_series', 'id_human', 'uuid', 'title', 'description', 'description_level',)
filter_horizontal = ('items', 'container_child')
ERRORS:
django_1 | <class 'collection.admin.ContainerAdmin'>: (admin.E108) The value of 'list_display[0]' refers to 'date_created', which is not a callable, an attribute of 'ContainerAdmin', or an attribute or method on 'collection.Container'.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
django-reversion API - Read the Docs
A revision represents one or more changes made to your model instances, grouped together as a single unit. You create a revision by...
Read more >Django - save copy of instance in inherited model
I want to save 'revisions' of the model as the inherited model. All fields should be the same at the time of the...
Read more >Sharing custom models
In this tutorial, we will show you how to write a custom model and its ... In both cases, notice how we inherit...
Read more >List work item fields and attributes in Azure Boards
The isPicklist and isPicklistSuggested attributes are only assigned to custom fields defined for an inherited process. The Inherited process ...
Read more >Inherited fields, modified model and views
partner (or not?). If I look at my model table in the database I can see all the fields (the ones from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, and another correction:
def get_date_created(self): return Version.objects.get_for_ object(self).order_by(“id”).first().revision.date_created
It would be a lot easier to just add a “date_created” field to your model directly, however.
On 19 July 2018 at 16:06, Dave Hall dave@etianen.com wrote:
ok! I got it now. Thank you.
This works pretty well! Thank you again.