Add support for ordering

This commit is contained in:
Senad Uka
2023-07-06 06:22:18 +02:00
parent 17f9045b74
commit d197b99e76
8 changed files with 6 additions and 3 deletions

View File

@@ -2,12 +2,15 @@ from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
import uuid
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
price_from = models.IntegerField(validators=[MinValueValidator(0)])
price_to = models.IntegerField(validators=[MinValueValidator(0)])
needed_information = models.JSONField()
needed_information = models.JSONField(default=dict)
order = models.IntegerField(null=True)
def __str__(self):
return self.title

View File

@@ -3,7 +3,7 @@
{% block content %}
<article>
<h1 class="font-bold rounded-xl border-2 border-gray-200 bg-slate-100 mb-3 ml-3 mr-3 p-4 text-lg">How does it function?</h1>
<h1 class="font-bold rounded-xl border-2 border-gray-200 bg-slate-100 mb-3 ml-3 mr-3 p-4 text-lg">How does it work?</h1>
<section class="rounded-xl border-2 border-gray-200 bg-slate-100 mb-3 ml-3 mr-3 p-4">
<h2>It's straightforward!</h2>
<ol class="max-w-md space-y-1 list-decimal list-inside">

View File

@@ -5,7 +5,7 @@ from django.http import HttpResponseRedirect
from django.urls import reverse
def home(request):
tasks = Task.objects.all()
tasks = Task.objects.order_by('order','id')
return render(request, 'core/home.html', {'tasks': tasks})
def thankyou(request):

Binary file not shown.