I wish to produce a model that does not map to some database table. Rather, stays in memory like a python object.

Really, this model should really signifies normalised data from a number of other table-planned models.

Another models store data which may be edited multiple occasions right away. Due to these multiple edits, I'm not going a table-planned-model that works normalisations/information and stores these questions database as, this saved data can expire immediately.

Each time this normalised model is utilized (via admin), I would like it to carry out the normalisations on data in the other models on your own (To ensure that it may show probably the most current data) and behave as being a normal model would under admin like Showing their email list view along with a detailed view for every row.

Edit after Shintoist's answer:

@Shintoist Just clearing things out and supplying a functional approach. I've just implemented it but striking a little wall ultimately :)

@skirmantas: Yes, the information have been in another object. This object has been passed in to the custom sights.

Problem: One issue is that under admin.py, I've produced an modeladminclass with this object(which does not inherit models.Model) so my custom sights can overide the changelist view and changeview. Then i use admin.site.register() to join up this model-like class and also the modeladmin. But, because this model isn't a django model whatsoever (because it is an independant python object in memory) admin.site.register() throws a " 'type' object isn't iterable" error. I'd rather not make use of the url.py rather than admin.py as it is intended for the frontend while Im attempting to overide the after sales-admin.

How about using multiple databases, and setting up one of these to make use of in-memory tables?

For MySQL it might seem like this:

    'default': {
    'memory': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': '',  
        'HOST': 'localhost',
        'PORT': '',         

        'OPTIONS': {"init_command": "SET storage_engine=MEMORY"}

Observe that you only have to use SET storage_engine when designing tables, but it may be it does not drink too much overhead anyway to use situation.


Why possess a model whatsoever? Reference your information inside a view, write a template for this and require admin login to gain access to it. That will recreate this normalised data only if you load the page and would only ever appear in memory, helping you save assets.

For the way complex these "information" are, it may sound like you'll need a custom database view (supported, In my opinion, by SQLite, MySQL, Postgres, and Oracle, a minimum of) used along with one with [cde].

If you are lucky, you'll have the ability to get South to make it for you inside a migration, however it does not seem like South supports sights yet.