﻿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
30210	Allow empty strings of blank=True model fields to pass unique_together constraint	Spleeding1	nobody	"I've been researching this one a little, and this is what I found: [https://stackoverflow.com/questions/454436/unique-fields-that-allow-nulls-in-django]

Here is what I am trying to accomplish:


{{{
class MyModel(models.Model):
    my_foreignkey = models.ForeignKey(
        'ForeignKeyModel',
        on_delete=models.CASCADE
    )
    my_charfield = models.CharField(
        'My Field',
        max_length=100,
        blank=True
    )
    field = models.CharField(
        max_length=100
    )
    
    class Meta:
        unique_together = ('my_foreignkey', 'my_charfield')
        

FOREIGN_KEY = ForeignKeyModel.objects.get(id=1)
        
MyModel.objects.create(
    my_foreignkey=FOREIGN_KEY,
    field='Field 1',
    my_charfield=''
)

# This raises unique_together error.
MyModel.objects.create(
    my_foreignkey=FOREIGN_KEY,
    field='Field 2',
    my_charfield=''
)
}}}

It does appear as though there is enough interest in the issue. Is this unrealistic?"	New feature	closed	Database layer (models, ORM)	2.1	Normal	wontfix	unique_together, Models		Unreviewed	0	0	0	0	0	0
