Add support for ordering
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,12 +2,15 @@ from django.db import models
|
|||||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
class Task(models.Model):
|
class Task(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
price_from = models.IntegerField(validators=[MinValueValidator(0)])
|
price_from = models.IntegerField(validators=[MinValueValidator(0)])
|
||||||
price_to = 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):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<article>
|
<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">
|
<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>
|
<h2>It's straightforward!</h2>
|
||||||
<ol class="max-w-md space-y-1 list-decimal list-inside">
|
<ol class="max-w-md space-y-1 list-decimal list-inside">
|
||||||
|
|||||||
Binary file not shown.
@@ -5,7 +5,7 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
tasks = Task.objects.all()
|
tasks = Task.objects.order_by('order','id')
|
||||||
return render(request, 'core/home.html', {'tasks': tasks})
|
return render(request, 'core/home.html', {'tasks': tasks})
|
||||||
|
|
||||||
def thankyou(request):
|
def thankyou(request):
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user