Commit 97a31768 authored by Benoit Alessandroni's avatar Benoit Alessandroni

Adding the proper step field

parent 23411f78
/coopstarter/__pycache__
coopstarter_data/__pycache__/*
coopstarter_data/migrations/__pycache__/
from django.contrib import admin
from .models import Resource
from .models import Step
admin.site.register(Resource)
admin.site.register(Step)
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-24 13:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Resource',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=32, verbose_name='Title')),
('format', models.CharField(choices=[('pdf', 'PDF'), ('video', 'Vidéo'), ('document', 'Document'), ('image', 'Image')], max_length=10, verbose_name='Format')),
('publication_year', models.IntegerField(verbose_name='Publication Year')),
('language', models.CharField(max_length=32, verbose_name='Language')),
('field', models.CharField(max_length=32, verbose_name='Field')),
('country', models.CharField(max_length=32, verbose_name='Country of publication')),
('uri', models.CharField(max_length=32, verbose_name='Location/weblink')),
('author', models.CharField(max_length=32, verbose_name='Author')),
('skills', models.TextField(verbose_name='Learning outcomes/skills')),
('description', models.TextField(verbose_name='Description')),
('iframe_link', models.TextField(verbose_name='Iframe link')),
('target', models.CharField(choices=[('mentor', 'Mentor'), ('entrepreneur', 'Entrepreneur'), ('public', 'public')], max_length=32, verbose_name='Target audience')),
('type', models.CharField(choices=[('mentor', 'Mentor'), ('entrepreneur', 'Entrepreneur')], max_length=32, verbose_name='Type of content')),
('sharing', models.CharField(choices=[('private', 'Private (nobody)'), ('public', 'Public (everybody)')], max_length=32, verbose_name='Sharing profile')),
('related', models.ManyToManyField(blank=True, related_name='_resource_related_+', to='coopstarter_data.Resource')),
],
options={
'abstract': False,
'default_permissions': ('add', 'change', 'delete', 'view', 'control'),
},
),
migrations.CreateModel(
name='Step',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=32, verbose_name='Title')),
],
options={
'abstract': False,
'default_permissions': ('add', 'change', 'delete', 'view', 'control'),
},
),
migrations.AddField(
model_name='resource',
name='steps',
field=models.ManyToManyField(to='coopstarter_data.Step'),
),
]
from django.db import models
from djangoldp.models import Model
class Step (Model):
title = models.CharField(max_length=32, verbose_name="Title")
def __str__(self):
return self.title
class Resource (Model):
# Mandatory Fields
title = models.CharField(max_length=32, verbose_name="Title")
......@@ -23,11 +29,10 @@ class Resource (Model):
#Classification Fields
target = models.CharField(max_length=32, choices=(('mentor', 'Mentor'), ('entrepreneur', 'Entrepreneur'), ('public', 'public')), verbose_name="Target audience")
type = models.CharField(max_length=32, choices=(('mentor', 'Mentor'), ('entrepreneur', 'Entrepreneur')), verbose_name="Type of content")
# step = models.CharField(max_length=32, choices=(('step-1', 'Step 1'), ('step-2', 'Step 2'), ('step-3', 'Step 3'),('step-4', 'Step 4'), ('step-5', 'Step 5'), ('step-6', 'Step 6')), verbose_name="Step")
#friends = models.ManyToManyField("self")
steps = models.ManyToManyField(Step)
sharing = models.CharField(max_length=32, choices=(('private', 'Private (nobody)'), ('public', 'Public (everybody)')), verbose_name="Sharing profile")
related = models.ManyToManyField("self", blank=True, null=True)
related = models.ManyToManyField("self", blank=True)
def __str__(self):
return self.title
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