Bugfixing (#27)

* Enforce ordering on some metadata models
* Fix a 500 error while accessing flat pages
* Clean up HTML and fix cards (missing class)
* Make the "driver" app optional and disabled by default
This commit is contained in:
2023-10-10 22:17:21 +02:00
committed by GitHub
parent 448ecae070
commit 87e1107156
9 changed files with 44 additions and 18 deletions

View File

@@ -444,14 +444,15 @@ class GetBook(View):
class GetFlatpage(View):
def get(self, request, flatpage):
_filter = Q(published=True) # Show only published pages
if request.user.is_authenticated:
_filter = Q() # Reset the filter if user is authenticated
try:
flatpage = Flatpage.objects.get(path=flatpage)
flatpage = Flatpage.objects.filter(_filter).get(path=flatpage)
except ObjectDoesNotExist:
raise Http404
if not request.user.is_authenticated:
flatpage = flatpage.filter(published=False)
return render(
request,
"flatpages/flatpage.html",