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.

Get reference to revision object/pk in/after revision block.

See original GitHub issue

Apologies for posting a question here.

I’m using both reversion and activity-stream and want to add a reference to revisions from the activity. Activity-stream allows arbitrary data to be saved to the actions via a jsonfield.

My code currently looks like this. I’m hoping to patch in a reference to the revision in action.send.

with reversion.create_revision() and transaction.atomic():
    reversion.set_comment('Updated')
    model.save()

action.send(self.request.user, verb='updated', target=mode, revision_pk=?)

How do I get a reference to the revision?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wjdpcommented, Feb 22, 2017

Thanks for the insight. I think I’ve gotten my head a little further around how reversion works.

(More importantly I’ve an activity feed with version integration 😄

image

)

0reactions
wjdpcommented, Jun 19, 2017

In case anyone comes across this later, the solution I came up with was a class DoAction to use in a with block: https://gitlab.com/wjdp/xSACdb/blob/develop/src/xsd_frontend/activity.py

To ‘approve a trip’ as in the above screenshot you would do:

with DoAction() as action, reversion.create_revision():
    self.state = STATE_APPROVED
    self.save()
    action.set(actor=actor, verb='approved trip request', target=self, state=STATE_APPROVED,
               style='trip-approved')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Return a Specific Revision of An Object - java - Stack Overflow
The method that does not work is getRevisions(Object, Number) . It returns nothing for the before revision (that's correct), it returns still ...
Read more >
Revision Tables and Revision Tags in Drawings | Inventor 2022
Revision tags indicate the revision for objects on the drawing sheet. ... Edit Revision Table Reference ... Post a question, get an answer....
Read more >
inserting a revision history block - Inventor 2018 tutorials
In today's video Drafting Tutorials will show you how to input and edit a revision history block in a drawing for Inventor 2018....
Read more >
7.1 Git Tools - Revision Selection
Revision Selection. Git allows you to refer to a single commit, set of commits, or range of commits in a number of ways....
Read more >
Post Revisions | REST API Handbook
Query this endpoint to retrieve a collection of post revisions. The response you receive can be controlled and filtered using the URL query...
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