Skip to content
Snippets Groups Projects
Commit bb6f469d authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

django 1.11, models, migrations

parent 364ec619
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-09 16:29
from __future__ import unicode_literals
import autoslug.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='License',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, unique=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Package',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('name', models.CharField(max_length=200, unique=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)),
('url', models.URLField(blank=True, null=True)),
('license', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='gepetto_packages.License')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, unique=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Repo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('url', models.URLField(unique=True)),
('default_branch', models.CharField(max_length=50)),
('open_issues', models.PositiveSmallIntegerField(blank=True, null=True)),
('open_pr', models.PositiveSmallIntegerField(blank=True, null=True)),
('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gepetto_packages.Package')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='package',
name='project',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gepetto_packages.Project'),
),
]
from django.db import models
# Create your models here.
from ndh.models import TimeStampedModel, NamedModel
class Project(NamedModel):
pass
class License(NamedModel):
pass
class Package(NamedModel, TimeStampedModel):
project = models.ForeignKey(Project)
url = models.URLField(max_length=200, blank=True, null=True)
license = models.ForeignKey(License, blank=True, null=True)
class Repo(TimeStampedModel):
url = models.URLField(max_length=200, unique=True)
package = models.ForeignKey(Package)
default_branch = models.CharField(max_length=50)
open_issues = models.PositiveSmallIntegerField(blank=True, null=True)
open_pr = models.PositiveSmallIntegerField(blank=True, null=True)
def __str__(self):
return self.url
"""
Django settings for gepkg project.
Generated by 'django-admin startproject' using Django 2.0b1.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
......@@ -19,7 +19,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'c=6-%df*+_4*8vphwwqm1v4^fdv*fc+zb*13ouw-bn7u=pexei'
......@@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'gepetto_packages',
]
......@@ -74,7 +75,7 @@ WSGI_APPLICATION = f'{PROJECT}.wsgi.application'
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
......@@ -85,7 +86,7 @@ DATABASES = {
# Password validation
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
......@@ -104,7 +105,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
......@@ -118,6 +119,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
SITE_ID = 1
"""gepkg URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/dev/topics/http/urls/
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^admin/', admin.site.urls),
]
......@@ -4,7 +4,7 @@ WSGI config for gepkg project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
......
......@@ -6,10 +6,17 @@ if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gepkg.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
Django
django-autoslug
-e git://github.com/Nim65s/ndh.git#egg=ndh
Django==2.0b1
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements.txt requirements.in
#
-e git+git://github.com/Nim65s/ndh.git#egg=ndh
django-autoslug==1.9.3
django==1.11.7
pytz==2017.3 # via django
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