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 a Rails (2.1 and 2.2) model with ActiveRecord validations, but
I want to create a function that performs a function passed by parameter on
I want to create a simple http proxy server that does some very basic
I want to create an allocator which provides memory with the following attributes: cannot
I want to create basic low-poly 3D models to use in XNA Game Studio
I want to use php in console mode and create an environment to test
I want create a drop shadow around the canvas component in flex. Technically speaking
I want to create a Java application bundle for Mac without using Mac. According
I want to create a client side mail creator web page. I know the
I want to create a draggable and resizable window in JavaScript for cross browser

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.