I want to create a model that does not map to a database table. Instead, it stays in memory as a python object.
In fact, this model should represent normalized data from many other displayed tables.
Other models store data that can be edited several times in one day. Due to these few changes, I do not want the table-mapped model to perform normalization / calculations and store them in the database, since these stored data can immediately become outdated.
Every time this normalized model is available (via admin), I want it to normalize data from other models from scratch (so that it displays the latest data) and behave like a normal model will be under the administrator, as shown in the list view and detailed overview for each line.
Edit after Shintoist answer:
@Shintoist Thank you for clarifying and providing a useful approach. I just implemented it, but hit a small wall at the end :)
@skirmantas: Yes, the calculations are in a separate object. This object is passed to user views.
Problem. One of the problems is that under admin.py I created a modeladminclass for this object (which does not inherit models.Model), so my custom views can override the change list view and changeview. Then I use admin.site.register () to register this model class and modeladmin. But, since this model is not a django model at all (since it is an independent python object in memory), admin.site.register () throws an error like "type is noterable". I do not want to use url.py instead of admin.py, as it is for the interface, while Im trying to override backend-admin.
database django mapping models
sysasa
source share