﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34376	Admin has no support for unique constraint fields.	Alex Urbanowicz	nobody	"The context is an Admin based application - all database operations are done using Admin. The backend is SQLite.
One of the fields in the application is a field for an (unique) ip address:
    `ip = models.GenericIPAddressField(protocol='IPv4', unique=True)`

When there's an attempt to enter duplicate IP address, the application crashes to a 500 error:

    `django.db.utils.IntegrityError: UNIQUE constraint failed: <table>.ip`

Attempt at handling that error by catching the exception and emitting an message leads to another error:

    `django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.`

I would expect that, since the ORM supports unique fields, there's some Admin UI to handle constraint errors in a similar way to validation errors, and not fall flat and give the user a 500 error.
"	Bug	closed	contrib.admin	4.1	Normal	worksforme	sqlite unique admin		Unreviewed	0	0	0	0	0	0
