title: How to fix “ '" is not a valid UUID.”
body: <p>I want to let user re-order/sort table of content with drag and drop. And whene I push &quot;Submit order&quot; button (after re-order) I have error:</p>
  <pre><code>ValidationError at /save-group-ordering/
  ['“” is not a valid UUID.']
  Request Method: POST
  Request URL:    http://127.0.0.1:8000/save-group-ordering/
  Django Version: 3.0.2
  Exception Type: ValidationError
  Exception Value:    
  ['“” is not a valid UUID.']
  
  Traceback Switch to copy-and-paste view
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site- 
  packages\django\db\models\fields\__init__.py in to_python
  return uuid.UUID(**{input_form: value}) …
  ▶ Local vars
  C:\Python 3.7\lib\uuid.py in __init__
  raise ValueError('badly formed hexadecimal UUID string') …
  ▶ Local vars
  During handling of the above exception (badly formed hexadecimal UUID string), another exception occurred:
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\core\handlers\exception.py in inner
  response = get_response(request) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\core\handlers\base.py in _get_response
  response = self.process_exception_by_middleware(e, request) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site- packages\django\core\handlers\base.py in _get_response
  response = wrapped_callback(request, *callback_args, **callback_kwargs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\views\decorators\http.py in inner
  return func(request, *args, **kwargs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\tasks\views.py in save_new_ordering
  group = Task.objects.get(lookup_id__exact=lookup_id) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\manager.py in manager_method
  return getattr(self.get_queryset(), name)(*args, **kwargs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\query.py in get
  clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\query.py in filter
  return self._filter_or_exclude(False, *args, **kwargs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\query.py in _filter_or_exclude
  clone.query.add_q(Q(*args, **kwargs)) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\sql\query.py in add_q
  clause, _ = self._add_q(q_object, self.used_aliases) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\sql\query.py in _add_q
  check_filterable=check_filterable, …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\sql\query.py in build_filter
  condition = self.build_lookup(lookups, col, value) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\sql\query.py in build_lookup
  </code></pre>
  <p>lookup = lookup_class(lhs, rhs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site- packages\django\db\models\lookups.py in <strong>init</strong>
  self.rhs = self.get_prep_lookup() …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\lookups.py in get_prep_lookup
  return self.lhs.output_field.get_prep_value(self.rhs) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\fields_<em>init</em>_.py in get_prep_value
  return self.to_python(value) …
  ▶ Local vars
  C:\Users\Admin.2\Desktop\taskmanager\ENV\lib\site-packages\django\db\models\fields_<em>init</em>_.py in to_python
  params={'value': value}, …
  ▶ Local vars</p>
  <p>I only start work with django  and I not understand what I am doing wrong.</p>
  <p>Here is my models.py</p>
  <pre><code>class Task(models.Model):
      
  project = models.ForeignKey(Project, null=True, on_delete=models.CASCADE)
  title = models.CharField(max_length=300, null=True)
  complete = models.BooleanField(default=False)
  deadline = models.DateField('Deadline of the task (year, month, day)', default=date.today)
  created = models.DateTimeField(auto_now_add=True,null=True)
  lookup_id = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True)
  order = models.IntegerField(blank=False, default=100_000)
  
  def __str__(self):
  return self.title
  
  def deadline_func(self):
  days = self.deadline - date.today()
  return days
  </code></pre>
  <p>Here is my urls.py</p>
  <pre><code>from django.urls import path
  from . import views
  
  urlpatterns = [
  path('' , views.projects_list, name=&quot;list&quot;),
  path('create_project/' , views.createProject, name=&quot;create_project&quot;),
  
  path('deadline_project/&lt;str:pk&gt;' , views.deadlineProject, name=&quot;deadline_project&quot;),
  
  path('update_project/&lt;str:pk&gt;' , views.updateProject, name=&quot;update_project&quot;),
  path('delete_project/&lt;str:pk&gt;' , views.deleteProject, name=&quot;delete_project&quot;),
  path('create_task/&lt;str:pk&gt;' , views.createTask, name=&quot;create_task&quot;),
  
  path('save-group-ordering/', views.save_new_ordering, name='save-group-oldering'),
  
  path('deadline_task/&lt;str:pk&gt;' , views.deadlineTask, name=&quot;deadline_task&quot;),
  
  path('update_task/&lt;str:pk&gt;' , views.updateTask, name=&quot;update_task&quot;),
  path('delete_task/&lt;str:pk&gt;' , views.deleteTask, name=&quot;delete_task&quot;),  
  ]
  </code></pre>
  <p>Here is my views.py</p>
  <pre><code>@require_POST
  def save_new_ordering(request):
  form = OrderingForm(request.POST)
  
  if form.is_valid():
  ordered_ids = form.cleaned_data[&quot;ordering&quot;].split(',')
  
  with transaction.atomic():
  current_order = 1
  for lookup_id in ordered_ids:
  group = Task.objects.get(lookup_id__exact=lookup_id)
  group.order = current_order
  group.save()
  current_order += 1
  
  return redirect('/')
  </code></pre>
  <p>Here is my forms.py</p>
  <pre><code>class TaskForm(forms.ModelForm):
  
  class Meta:
  model = Task
  fields = '__all__'
  
  class OrderingForm(forms.Form):
  ordering = forms.CharField()
  </code></pre>
  <p>Here is my html</p>
  <pre><code>&lt;table class=&quot;raz&quot;&gt;
                  
  &lt;tbody id=&quot;groups&quot;&gt;
  {% for task in project.task_set.all %}
  
                  
  
  &lt;tr data-lookup=&quot;{{ folder.lookup_id }}&quot;&gt;
  &lt;td style=&quot;width: 50px;&quot;&gt;&lt;span class=&quot;handle&quot;&gt;&lt;img src=&quot; static/images/Up_Down.png &quot; alt=&quot;Up_Down_icon&quot;&gt;&lt;/span&gt;&lt;/td&gt;
  
  {% if task.complete == True %}
  &lt;td style=&quot;width: 50px;&quot;class=&quot;ch&quot;&gt;&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; name=&quot;complete&quot; id=&quot;id_complete&quot; checked &gt;&lt;/td&gt;
  {% else %}
  &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input class=&quot;checkbox&quot; type=&quot;checkbox&quot; name=&quot;complete&quot; id=&quot;id_complete&quot;  &gt;&lt;/td&gt;
  {% endif %}
  
  &lt;td style=&quot;width: 550px;&quot;&gt;&lt;p&gt;{{task.title}}&lt;/p&gt;&lt;/td&gt;
  
  &lt;td style=&quot;width: 50px;&quot;&gt;&lt;a class=&quot;calendar&quot; href=&quot;{% url 'deadline_task' task.id %}&quot;&gt;
  &lt;img src=&quot; static/images/calendar.png &quot; alt=&quot;calendar_icon&quot;&gt;
  &lt;/a&gt;&lt;/td&gt;
  
  &lt;td style=&quot;width: 50px;&quot;&gt;&lt;a href=&quot;{% url 'update_task' task.id %}&quot; class=&quot;edittask&quot;&gt;
                              &lt;img src=&quot; static/images/pencil_icon.png &quot; alt=&quot;pencil_icon&quot;&gt;
  &lt;/a&gt;&lt;/td&gt;
                                  
  &lt;td style=&quot;width: 50px;&quot;&gt;&lt;a href=&quot;{% url 'delete_task' task.id %}&quot; class=&quot;deletetask&quot;&gt;
                              &lt;img src=&quot; static/images/trash.png &quot; alt=&quot;trash_icon&quot;&gt;
  &lt;/a&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  {% endfor%}
  &lt;/tbody&gt;
                  
  &lt;/table&gt;
  
  
  &lt;form id=&quot;orderingForm&quot; method=&quot;post&quot; action=&quot;{% url 'save-group-oldering'  %}&quot;&gt;
  {% csrf_token %}
  &lt;input type=&quot;hidden&quot; id=&quot;orderingInput&quot; name=&quot;ordering&quot;&gt;
  &lt;/form&gt;
  
  &lt;button id=&quot;saveOrdering&quot;&gt;Save ordering&lt;/button&gt;
  </code></pre>