mirror of
https://github.com/tjsga/study-bank.git
synced 2025-04-09 22:40:17 -04:00
Improvements
This commit is contained in:
parent
f79d19f5ef
commit
322f39f0e8
Binary file not shown.
|
@ -27,6 +27,7 @@ def show(request, course_url):
|
|||
mod = Moderator.objects.get(username=request.session['user'])
|
||||
except Moderator.DoesNotExist:
|
||||
is_mod = False
|
||||
return render(request, 'class/show.html', {'course': course, 'is_mod': is_mod})
|
||||
|
||||
if mod.admin:
|
||||
is_mod = True
|
||||
|
|
BIN
server/server/apps/files/__pycache__/forms.cpython-35.pyc
Normal file
BIN
server/server/apps/files/__pycache__/forms.cpython-35.pyc
Normal file
Binary file not shown.
BIN
server/server/apps/files/__pycache__/urls.cpython-35.pyc
Normal file
BIN
server/server/apps/files/__pycache__/urls.cpython-35.pyc
Normal file
Binary file not shown.
BIN
server/server/apps/files/__pycache__/views.cpython-35.pyc
Normal file
BIN
server/server/apps/files/__pycache__/views.cpython-35.pyc
Normal file
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 2.2.10 on 2020-03-24 01:35
|
||||
|
||||
from django.db import migrations, models
|
||||
import server.apps.files.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('files', '0002_auto_20200302_0345'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='file',
|
||||
name='payload',
|
||||
field=models.FileField(blank=True, upload_to=server.apps.files.models.gen_filename),
|
||||
),
|
||||
]
|
Binary file not shown.
9
server/server/apps/files/urls.py
Normal file
9
server/server/apps/files/urls.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "file"
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.upload_file, name="upload"),
|
||||
]
|
|
@ -3,10 +3,11 @@ from django.http import HttpResponseRedirect
|
|||
|
||||
from .forms import UploadFileForm
|
||||
from .models import File
|
||||
from ..decorators import login
|
||||
|
||||
# Create your views here.
|
||||
@login
|
||||
def upload_file(request):
|
||||
if 'type' in request.session and request.session['type'] in settings.ALLOWED_USERS:
|
||||
if request.method == 'POST':
|
||||
form = UploadFileForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
|
|
|
@ -27,5 +27,6 @@ urlpatterns = [
|
|||
path('logout/', auth_views.logout, name="logout"),
|
||||
path('courses/', include("server.apps.course.urls", namespace="courses")),
|
||||
path('mod/', include("server.apps.mod.urls", namespace="mod")),
|
||||
path('file/', include("server.apps.files.urls", namespace="file")),
|
||||
path('', content_views.index, name="index"),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user