What's the problem?

On 16 February 2018 at 15:00, Dragan Mestrovik <[email protected]> wrote:
> Hi,
>
> I am getting issue with setting default foreign key value of type UUID. My
> models are
>
> import uuid
> from django.db import models
>
> # Create your models here.
> class Provider(models.Model):
>   id = models.UUIDField(primary_key = True, default = uuid.uuid4, editable =
> False)
>   providerName = models.CharField(max_length = 200)
>   providerUrl = models.URLField(max_length = 500)
>   Email = models.EmailField()
>   Password = models.CharField(max_length = 200)
>
> class Course(models.Model):
>   id = models.UUIDField(primary_key = True, default = uuid.uuid4, editable =
> False)
>   providerID = models.ForeignKey(Provider, on_delete = models.SET_DEFAULT,
> default = uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org'))
> #6fa459ea-ee8a-3ca4-894e-db77e160355e
>   courseProviderID = models.CharField(max_length = 50)
>   courseName = models.CharField(max_length = 200)
>   authorName = models.CharField(max_length = 200)
>   courseUrl = models.URLField(max_length = 500)
>   courseSummary = models.TextField()
>   courseCategory = models.CharField(max_length = 200)
>   isDownloaded = models.BooleanField(default = False)
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3b41e4f4-1948-494e-ac31-5214c4c10684%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFmXjSAASrbp%2BPS%2Bbob1Xs%3DraSmCO3VkUun96ROoPYgK1TTw3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to