I suggest that if you set unique, the field must have value, so null=False.

Blank=True es for form and template, to set required.  Null es for database.



Dios L@s Bendiga

Saludos,



[image: --]

daniel.bojorge
[image: http://]about.me/daniel.bojorge
<http://about.me/daniel.bojorge?promo=email_sig>
 [image: snake]*Curso Desarrollo Web con Python usando Django 2.2 Para
Principiantes con Descuento 95% <http://bit.ly/DJFULL-BLOG12019>   *[image:
snake]
*WebService RestFul API con Python usando Django RestFrameWork*
<https://goo.gl/j8i34C>
*Fácil Replicación de Cualquier Base de Datos y/o Sistema Operativo*
<https://goo.gl/HjtExs>
*Programación en Capas (Web y Escritorio)* <https://goo.gl/zGZpSD>
Mi Blog <http://debsconsultores.blogspot.com>
Nicaragua

"Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
enseñanzas, pidan lo que quieran y se les dará.
(Juan 15:7 DHH)
Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
(Jeremías 17:7 RV2000)




El mié, 7 abr 2021 a las 16:52, Mike Dewhirst (<mi...@dewhirst.com.au>)
escribió:

> No. PostgreSQL.
>
> I checked that post. And googled the answer. Postgres follows the SQL
> standard and permits multiple nulls in a unique column.
>
> I should have done that instead of asking. I had first thought of it being
> a Django thing and couldn't find the answer in the docs.
>
> Thanks for responding.
>
> Cheers
>
> Mike
>
>
>
> --
> (Unsigned mail from my phone)
>
>
>
> -------- Original message --------
> From: Derek <gamesb...@gmail.com>
> Date: 7/4/21 23:05 (GMT+10:00)
> To: Django users <django-users@googlegroups.com>
> Subject: Re: Unique and null
>
> Are you using MySQL?
>
>
> https://stackoverflow.com/questions/3712222/does-mysql-ignore-null-values-on-unique-constraints
>
>
> On Wednesday, 7 April 2021 at 08:07:35 UTC+2 Mike Dewhirst wrote:
>
>> I have just made a CharField unique and Django detects duplicates nicely
>> but seems to ignore multiple instances where the field value is null.
>>
>>     arn = models.CharField(
>>         max_length=MEDIUM,
>>         unique=True,
>>         null=True,
>>         blank=True,
>>     )
>>
>> Is this correct behaviour?
>>
>> Thanks
>>
>> Mike
>>
>>
>>
>> --
>> Signed email is an absolute defence against phishing. This email has
>> been signed with my private key. If you import my public key you can
>> automatically decrypt my signature and be sure it came from me. Just
>> ask and I'll send it to you. Your email software can handle signing.
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/efd40f22-50d8-4250-9738-95d2152e68ecn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/efd40f22-50d8-4250-9738-95d2152e68ecn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/606e377e.1c69fb81.2c612.06e5SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> <https://groups.google.com/d/msgid/django-users/606e377e.1c69fb81.2c612.06e5SMTPIN_ADDED_MISSING%40gmr-mx.google.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQeQjbA%3D6GG--TwG3ja8L%2B-2%2BtRnMfH3_jrPvrZ%2B5tTgPmGYA%40mail.gmail.com.

Reply via email to