Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3338226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:21:00+00:00 2026-05-18T00:21:00+00:00

I want to create a model that doesn’t map to a database table. Instead,

  • 0

I want to create a model that doesn’t map to a database table. Instead, stays in memory as a python object.

Actually, this model is supposed to represents normalised data from many other table-mapped models.

The other models store data which can be edited multiple times in a single day. Because of these multiple edits, I don’t want a table-mapped-model that performs normalisations/calculations and stores them in a database as, this stored data can go out of date right away.

Every time this normalised model is accessed (via admin), I want it to perform the normalisations on data from the other models from scratch (So that it can show the most up to date data) and behave just like a normal model would under admin like Showing the list view and a detailed view for each row.

Edit after Shintoist’s answer:

@Shintoist Thanks for the clearing things out and providing a usable approach. I have just implemented it but hitting a small wall in the end 🙂

@skirmantas: Yes, the calculations are in a separate object. This object is being passed into the custom views.

Problem: One problem is that under admin.py, I have created an modeladminclass for this object(which doesn’t inherit models.Model) so my custom views can overide the changelist view and changeview.
I then use admin.site.register() to register this model-like class and the modeladmin. But, since this model is not a django model at all (as it is an independant python object in memory) admin.site.register() throws a ” ‘type’ object is not iterable” error. I don’t want to use the url.py instead of admin.py as it’s meant for the frontend while Im trying to overide the backend-admin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:21:01+00:00Added an answer on May 18, 2026 at 12:21 am

    hmmm. Thanks for your help everyone. The solution I have come up (with your help ofcourse) is as follows:

    I have two custom templates:

       my_model_list.html
       my_model_detail.html
    

    Under views.py:

    class MyModel(object):
        # ... Access other models
        # ... process / normalise data 
        # ... store data
    
    @staff_member_required
    def my_model_list_view(request) #show list of all objects
        #. . . create objects of MyModel . . .
        #. . . call their processing methods . . .
        #. . . store in context variable . . . 
        r = render_to_response('admin/myapp/my_model_list.html', context, RequestContext(request))
        return HttpResponse(r)
    
    @staff_member_required
    def my_model_detail_view(request, row_id) # Shows one row (all values in the object) in detail     
        #. . . create object of MyModel . . .
        #. . . call it's methods . . .
        #. . . store in context variable . . . 
        r = render_to_response('admin/myapp/my_model_detail.html', context, RequestContext(request))
        return HttpResponse(r)
    

    Under the main django urls.py:

    urlpatterns = patterns( 
        '',
        (r'^admin/myapp/mymodel/$', my_model_list_view),
        (r'^admin/myapp/mymodel/(\d+)/$', my_model_detail_view),
        ( r'^admin/', include( admin.site.urls ) )
    )
    

    As you’ve already noticed, I had to insert url patterns to my url.py file. I don’t know if thats the best way to do it, as I reckon, the url.py file is not meant for admin related pages. It’s only for the site frontend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application that doesn't use Portrait mode. I am not
What I want is to create a Model that connects with another using a
This the model that I want to create using json file Ext.define('Users', { extend:
I have strong-type view, I want to create link that refers to Model, which
In EmberJS I want to create a model that has a field that is
I want to create a modal dialog that has more controls than what a
I want to create a model named Model. I'm pretty sure this isn't allowed,
I want to create my Model fields dynamically (in ExtJS 4). For instance, sometimes
I want to create one new model class, which will be extended in all
I want to create a graph in Excel with the spreadsheet reference. @model IEnumerable<ARTex.Core.Models.Reservation>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.