Skip to content
Snippets Groups Projects
Commit b8fa5c2b authored by Barnabás Czémán's avatar Barnabás Czémán
Browse files

Create initial app & models for documents

parent 30a2f6de
No related branches found
No related tags found
No related merge requests found
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class DocumentConfig(AppConfig):
name = 'document'
# Generated by Django 2.0.1 on 2018-05-28 15:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('account', '0017_auto_20180205_2004'),
]
operations = [
migrations.CreateModel(
name='Document',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=150)),
('description', models.TextField()),
('file', models.FileField(upload_to='')),
('uploaded_by', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='account.Profile')),
],
),
]
from django.db import models
from account.models import Profile
class Document(models.Model):
uploaded_by = models.ForeignKey(Profile, on_delete=models.DO_NOTHING)
uploaded_at = models.DateTimeField(auto_now_add=True, editable=False)
name = models.CharField(max_length=150)
description = models.TextField()
file = models.FileField()
def __str__(self):
return self.name
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
......@@ -47,6 +47,7 @@ INSTALLED_APPS = [
'account',
'stats',
'news',
'document',
]
MIDDLEWARE = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment