title: Python: How to solve the issue : 'badly formed hexadecimal UUID string' in Django
body: <p>I have created 'post' model in which I included 'post_id' as the primary key field. When I am trying to create a post, it is raising an error: 'badly formed hexadecimal UUID string'. I would appreciate helping me in solve this.</p>
  
  <p>Here's my code.</p>
  
  <p>Models.py:</p>
  
  <pre><code>class Post(models.Model):
  
      post_id = models.UUIDField(primary_key=True, default='uuid.uuid4', editable=False)
      user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1)
      from1 = models.CharField(max_length=20)
      To = models.CharField(max_length=20)
      timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)
  
      objects = PostManager()
  
      def __unicode__(self):
          return self.post_id
  
      def __str__(self):
          return self.post_id
  
      def get_absolute_url(self):
          return reverse("posts:detail", kwargs={"post_id": self.post_id})
  
      class Meta:
          ordering = ["-timestamp", "-Time"]
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def post_create(request):
  
      form = PostForm(request.POST or None)
      if form.is_valid():
          instance = form.save(commit=False)
          print(form.cleaned_data.get("post_id"))
          instance.user = request.user
          instance.save()
          return HttpResponseRedirect(instance.get_absolute_url())
      context = {
          "form": form,
      }
      return render(request, "loggedin_load/post_load.html", context)
  </code></pre>