Commit 4d811c89 authored by Jomaro Rodrigues's avatar Jomaro Rodrigues
Browse files

Merge branch 'master' into analysis_modular

parents 703f4814 75e06a8e
from django.contrib import admin
# Register your models here.
from django import forms
from uploads.core.models import Document
class DocumentForm(forms.ModelForm):
class Meta:
model = Document
fields = ('description', 'document', )
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-01 08:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Document',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.CharField(blank=True, max_length=255)),
('document', models.FileField(upload_to=b'')),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
],
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-01 08:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='document',
name='document',
field=models.FileField(upload_to='documents/'),
),
]
from __future__ import unicode_literals
from django.db import models
class Document(models.Model):
description = models.CharField(max_length=255, blank=True)
document = models.FileField(upload_to='documents/')
uploaded_at = models.DateTimeField(auto_now_add=True)
from django import forms
from .models import Submission
class SubmissionForm(forms.ModelForm):
class Meta:
model = Submission
\ No newline at end of file
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
......@@ -6,6 +5,7 @@ from django.utils import timezone
from os import path
from django.conf import settings
def get_path(instance, filename):
return '{}/{}/{}'.format(instance.course, instance.id, filename)
......@@ -32,6 +32,4 @@ class Submission(models.Model):
def __str__(self):
return 'Submission (from: {}, to: {}, on: {})'.format(self.author.first_name,
self.course,
self.timestamp)
self.timestamp)
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple File Upload</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
\ No newline at end of file
......@@ -3,10 +3,10 @@
{% block content %}
<ul>
<li>
<a href="{% url 'simple_upload' %}">Simple Upload</a>
<a href="{% url 'uploads:simple' %}">Simple Upload</a>
</li>
<li>
<a href="{% url 'model_form_upload' %}">Model Form Upload</a>
<a href="{% url 'uploads:model_form' %}">Model Form Upload</a>
</li>
</ul>
......
{% extends 'base.html' %}
{% block content %}
<form method="post" enctype="multipart/form-data">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Upload</button>
</form>
<p><a href="{% url 'home' %}">Return to home</a></p>
<p><a href="{% url 'uploads:home' %}">Return to home</a></p>
{% endblock %}
\ No newline at end of file
......@@ -14,5 +14,5 @@
<p>File uploaded at: <a href="{{ uploaded_file_url }}">{{ uploaded_file_url }}</a></p>
{% endif %}
<p><a href="{% url 'home' %}">Return to home</a></p>
<p><a href="{% url 'uploads:home' %}">Return to home</a></p>
{% endblock %}
from django.conf.urls import url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from uploads.core import views
from uploads import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^uploads/simple/$', views.simple_upload, name='simple_upload'),
url(r'^uploads/form/$', views.model_form_upload, name='model_form_upload'),
url(r'^admin/', admin.site.urls),
url(r'^simple/$', views.simple_upload, name='simple'),
url(r'^form/$', views.model_form_upload, name='model_form'),
]
if settings.DEBUG:
......
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