mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
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:
@@ -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",
|
||||
|
Reference in New Issue
Block a user