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 8954893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:24:59+00:00 2026-06-15T14:24:59+00:00

I did the initial installation steps and created the initial revisions, but then when

  • 0

I did the initial installation steps and created the initial revisions, but then when I save a model in django shell, the new revision is not created:

In [1]: s = Shop.objects.all()[0]
In [2]: import reversion
In [3]: s.name = 'a'
In [4]: s.save()
In [5]: s.name = 'b'
In [6]: s.save()

In [7]: reversion.get_for_object(s)
Out[7]: [<Version: <1> "X">]

This is the initial revision.

When I update the model from a view, a revision is created successfully.

What am I missing?

The models.py file is:

 ...
 class Shop(Model):
     ...


 import reversion
 reversion.register(Shop)
 <EOF>

I see a reversion method among post_save receiver, although it isn’t called when I debug it.

I have Django v1.4.1, reversion v1.6.2.

  • 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-06-15T14:25:00+00:00Added an answer on June 15, 2026 at 2:25 pm

    I wrote django-reversion, so I think I can shed some light on this issue.

    A Version of a model is automatically saved when a model is saved, providing the following are true:

    1. The model is registered with django-reversion.
    2. The code block is marked up as being within a revision.

    Point 1 can be achieved by either registering a model with VersionAdmin, or explicitly calling reversion.register() in your models.py file.

    Point 2 can be achieved by using RevisionMiddleware, or the reversion.create_revision() decorator or context manager. Any admin views in VersionAdmin also save a revision.

    So, if your shell is not creating Versions, then either point 1 or point 2 is not being met. Here’s how to fix it:

    1. If you’re using VersionAdmin, import the relevant admin module in your shell code to kick in the auto-registration. Alternatively, call reversion.register() in your models.py file.
    2. In your shell code, using the reversion.create_revision() context manager around your call to save.
    with reversion.create_revision():
        s.save()
    

    More about this sort of thing on the Low Level API wiki page:

    http://django-reversion.readthedocs.org/en/latest/api.html

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

Sidebar

Related Questions

My initial question have been answered, but that did just open up for further
I did some research on JSF view instances: new view, initial view, and postback
I did do some googling and searching on this site but did not find
I am trying to create an edit form for my model. I did not
Did you ever have the following situation: you need to store information, but a
Did about 30 minutes worth of searching, found lots of relevant info, but none
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
Did not have luck with these examples: Javascript File remove Javascript FSO DeleteFile Method
This code works really well for an initial insert into a table. But now
I would like to add the mugshot in django userena to the initial registration

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.