question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty user (and comments) field for revisions created outside admin

See original GitHub issue

I’m using the 'reversion.middleware.RevisionMiddleware' middleware setting along with reversion.register(MyModel) after every model definition. All my models have a created_by and updated_by field.

For objects that are updated through the Django Admin, I get a User and Comments field that is properly filled in. However, for objects that are created or updated through my own non-admin views, the revision is created (done by the middleware) but there is no User or Comment information. I’m especially interested in the User part. When having a look at the revisions in the admin, a dash (-) is displayed in the User and Comments column for those non-admin created/modified objects.

Any idea on what the proper way is to get proper tracking who changed the object, outside the admin?

Note that the created_by and modified_by fields seem to be tracked by reversion:

'_field_dict_cache': 
{
'modified_by': None, 
'title': u'test', 
'created': datetime.datetime(2015, 11, 11, 10, 30, 24, 682000, tzinfo=<UTC>), 
'modified': datetime.datetime(2015, 11, 11, 11, 1, 20, 515000, tzinfo=<UTC>), 
'created_by': 1, 
u'id': 1, 
}, 

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
etianencommented, Apr 28, 2016

Thanks, I’ve corrected the original example. I’ve also corrected the list of HTTP headers. It should be POST, PUT, PATCH.

(This is because accessing request.user in the view will add a Vary: Cookie header, breaking most caching. You don’t want that on every GET request. However, almost all POST, PUT and PATCH requests won’t want caching anyway, so it’s a decent metric to use.)

2reactions
etianencommented, Apr 28, 2016

If there’s interest in this functionality, I could include an official RevisionMixin in the next release of reversion. I’d also cover RevisionMiddleware in deprecation warnings, as it’s really not a good idea to do!

Read more comments on GitHub >

github_iconTop Results From Across the Web

WordPress Revisions: How to Use and Optimize Them - Kinsta
To safely delete post revisions in WordPress via a query, log into your phpMyAdmin account, select your WordPress database from the left-hand ...
Read more >
Using modern comments in Word - Microsoft Support
Modern comments aligns the commenting experience across Word platforms and other Office apps, especially Word, Excel, and PowerPoint.
Read more >
ADOM revisions - FortiManager 6.2.1
This field is user-defined when creating the ADOM revision. ... Optional comments typed in the Description field when the ADOM revision was created....
Read more >
Revisions | Google Drive
This may not be present in certain contexts if the user has not made their ... You can only delete revisions for files...
Read more >
4 Ways to Delete or Change the Author Names for Comments ...
Now and then, we'd like to insert comments to Word documents as to make revisions. As you may notice, there is the author...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found