Zwischencommit

This commit is contained in:
Sebastian Lohff 2017-02-14 22:26:16 +01:00
parent ff5dea9628
commit 35458ab391
12 changed files with 139 additions and 6 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.*.swp
.*.swo
*.pyc
*.pyo
__pycache__
db.sqlite3

View File

@ -1,3 +1,5 @@
from django.contrib import admin from django.contrib import admin
# Register your models here. from .models import User
admin.site.register(User)

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-13 03:01
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name_plural': 'users',
'verbose_name': 'user',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]

View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Header</div>
<div class="panel-body">
Body
</div>
</div>
</div>
</div>
{% endblock %}

12
dncore/urls.py Normal file
View File

@ -0,0 +1,12 @@
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views as dncore_views
urlpatterns = [
url(r'^$', dncore_views.dashboard, name='dashboard'),
url(r'^login/$', auth_views.login, name='login'),
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
url(r'^profile/$', dncore_views.profile, name='profile'),
]

View File

@ -1,3 +1,13 @@
from django.shortcuts import render from django.shortcuts import render
from django.contrib.auth.decorators import login_required
# Create your views here. @login_required
def profile(request):
return render(request, "profile/profile.html", {})
@login_required
def dashboard(request):
pass
def index(request):
return render(request, "index.html", {})

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.10/ref/settings/
""" """
import os import os
from django.contrib import messages
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -130,7 +131,7 @@ MESSAGE_TAGS = {
messages.ERROR: 'danger', messages.ERROR: 'danger',
} }
AUTH_USER_MODEL = 'contest.User' AUTH_USER_MODEL = 'dncore.User'
LOGIN_REDIRECT_URL = '/' LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/' LOGIN_URL = '/login/'

View File

@ -13,11 +13,19 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
import dncore.urls
import dncore.views
import whoisdb.urls
urlpatterns = [ urlpatterns = [
url(r'^$', dncore.views.index),
url(r'^dashboard/$', dncore.views.dashboard),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^user/', dncore.urls), url(r'^user/', include(dncore.urls, namespace='user')),
url(r'^whoisdb/', whoisdb.urls), url(r'^whoisdb/', include(whoisdb.urls, namespace='whoisdb')),
] ]

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-13 03:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Maintainer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('auth', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
),
]

8
whoisdb/urls.py Normal file
View File

@ -0,0 +1,8 @@
from django.conf.urls import url
from . import views as whoisdb_views
urlpatterns = [
#url(r'^$', dncore_views.dashboard, name='dashboard'),
]