Verified Commit 56bb1c1e authored by Jonathan Weth's avatar Jonathan Weth

Update paths

parent 58976c90
from django.contrib import admin
# Register your models here.
from menu.models import Menu
from .models import Menu
admin.site.register(Menu)
......@@ -2,7 +2,7 @@ from django import forms
from django.core.validators import FileExtensionValidator
from django.utils import timezone
from menu.models import Menu
from .models import Menu
current_year = timezone.datetime.now().year
options_for_year = [(current_year, current_year),
......
from django.db import models
# Create your models here.
from utils.helper import path_and_rename
from aleksis.core.util.helper import path_and_rename
class Menu(models.Model):
......
......@@ -7,8 +7,8 @@ from django.http import FileResponse
from django.shortcuts import render, redirect
from django.utils import timezone
from menu.models import Menu
from schoolapps.settings import BASE_DIR
from .models import Menu
from django.conf import settings
from .forms import MenuUploadForm
......@@ -54,7 +54,7 @@ def return_pdf(filename):
def return_default_pdf():
"""Response the default PDF"""
return return_pdf(os.path.join(BASE_DIR, "menu", "default.pdf"))
return return_pdf(os.path.join(settings.BASE_DIR, "menu", "default.pdf"))
def show_current(request):
......@@ -81,7 +81,7 @@ def show_current(request):
# Look for matching PDF in DB
try:
obj = Menu.objects.get(year=year, calendar_week=calendar_week)
return return_pdf(os.path.join(BASE_DIR, "media", str(obj.pdf)))
return return_pdf(os.path.join(settings.MEDIA_ROOT, str(obj.pdf)))
# Or show the default PDF
except Menu.DoesNotExist:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment