It basically sets a null value i.e. "" for the fields that you don't pass
while creating an object in shell. And "" it acceptable value. If you want
to restrict "" then add some validations.

On Fri, Aug 7, 2020, 5:16 PM Juan D. <juan.diaz.ali...@gmail.com> wrote:

> I've created a model with null and blank set to False in robot_name:
>
> class Robot(models.Model):
>     robot_name = models.CharField(max_length=200, null=False, blank=False)
>     version = models.CharField(max_length=20, blank=True, null=True)
>
>     class Meta:
>         unique_together = ('robot_name', 'version',)
>
> On the admin website everything works perfectly and I am not allowed to
> create a robot without a name. However, on the shell:
>
> Robot.objects.create(version="test_version")
>
> doesn't raise any Exception.
>
> What could it be?
>
> --
> 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/4ff1570e-70a2-495c-82e3-f20d760992d2n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4ff1570e-70a2-495c-82e3-f20d760992d2n%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/CAGR%2BspfiXjjPePW2JHh2_QEdGKjOHiSsZLAYZjxfTYr_Ea6tFw%40mail.gmail.com.

Reply via email to