revert: display information about IntegrityError
See original GitHub issueIt would be good to have the information about the IntegrityError in the error message, instead of the generic “missing dependency”:
> …/Vcs/django-reversion/reversion/models.py(32)
24 def _safe_revert(versions):
25 unreverted_versions = []
26 __import__('pdb').set_trace()
27 for version in versions:
28 try:
29 with transaction.atomic(using=version.db):
30 version.revert()
31 except (IntegrityError, ObjectDoesNotExist):
32 -> unreverted_versions.append(version)
33 if len(unreverted_versions) == len(versions):
34 raise RevertError(ugettext("Could not save %(object_repr)s version - missing dependency.") % {
35 "object_repr": unreverted_versions[0],
36 })
37 if unreverted_versions:
38 _safe_revert(unreverted_versions)
IntegrityError: duplicate key value violates unique constraint "app_subscriptionplan_organization_id_66f20bda_uniq"
DETAIL: Key (organization_id, name)=(77, WEEKLY) already exists.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Django - Dealing With Integrity Error And Showing Error Pop up
I've tried to add exception handling using code below but it is not working. try: if request.method == 'POST': properties_Form = InputForm( ...
Read more >Backup and Restore | InterSystems IRIS Data Platform 2022.2
Explains the role of backup and restore in protecting data integrity and recovering from system failures and disasters on InterSystems IRIS data platform, ......
Read more >Important notes — Borg - Deduplicating Archiver 1.2.2 ...
This section provides information about security and corruption issues. ... cache. related change: add archive name to calc_stats progress display. docs:.
Read more >Display settings - Caseware
You are here: Help Topics > Setup > Display settings. Display settings. Customize how you view documents using various settings and screen modifications....
Read more >How to show validation error in my form instead of getting ...
IntegrityError at /users/admin/add-project/ duplicate key value violates ... display link to object info page instead of edit form , in records change list?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d take a pull request to add logger.exception() calls for the errors.
I’m not so keen on displaying the postgres error message in the admin, as it could be very big and intimidating for admin users (who are typically not database-savvy).
On 5 September 2018 at 15:15, Daniel Hahler notifications@github.com wrote:
@blueyed @etianen
I’ve followed up with a PR to this in #921
This was some time ago, but I’ve bumped into this a couple of times over the years - and always had to omit
fields
and just save everything.Adding a
logging.exception()
to theIntegrityError
instantly diagnosed this in my case.