Skip to content

Commit f700481

Browse files
committed
updates
1 parent abe20c0 commit f700481

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+165
-194
lines changed

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/advcbv/__init__.py

Whitespace-only changes.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/advcbv/urls.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/basic_app/__init__.py

Whitespace-only changes.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/basic_app/migrations/0002_auto_20170318_0000.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/basic_app/migrations/__init__.py

Whitespace-only changes.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/basic_app/templates/basic_app/basic_app_base.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/basic_app/urls.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/manage.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/templates/base.html

Lines changed: 0 additions & 45 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
22
Django settings for advcbv project.
33
4-
Generated by 'django-admin startproject' using Django 1.10.5.
4+
Generated by 'django-admin startproject' using Django 2.0.5.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.10/topics/settings/
7+
https://docs.djangoproject.com/en/2.0/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/1.10/ref/settings/
10+
https://docs.djangoproject.com/en/2.0/ref/settings/
1111
"""
1212

1313
import os
@@ -17,10 +17,10 @@
1717
TEMPLATE_DIR = os.path.join(BASE_DIR,'templates')
1818

1919
# Quick-start development settings - unsuitable for production
20-
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
20+
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = '7!6cfh24dtp$9dcxm2m_yj%a-riev0&_ma@51_om_umo=+^5fi'
23+
SECRET_KEY = '=f%ns04d@z9na8xh(kfo8v8aa-v2p0bcn^jukrh4dm_^=zq70$'
2424

2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
@@ -37,7 +37,7 @@
3737
'django.contrib.sessions',
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
40-
'basic_app',
40+
'basic_app.apps.BasicAppConfig',
4141
]
4242

4343
MIDDLEWARE = [
@@ -55,7 +55,7 @@
5555
TEMPLATES = [
5656
{
5757
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58-
'DIRS': [TEMPLATE_DIR],
58+
'DIRS': [TEMPLATE_DIR,],
5959
'APP_DIRS': True,
6060
'OPTIONS': {
6161
'context_processors': [
@@ -72,7 +72,7 @@
7272

7373

7474
# Database
75-
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
75+
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
7676

7777
DATABASES = {
7878
'default': {
@@ -83,7 +83,7 @@
8383

8484

8585
# Password validation
86-
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
86+
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
8787

8888
AUTH_PASSWORD_VALIDATORS = [
8989
{
@@ -102,7 +102,7 @@
102102

103103

104104
# Internationalization
105-
# https://docs.djangoproject.com/en/1.10/topics/i18n/
105+
# https://docs.djangoproject.com/en/2.0/topics/i18n/
106106

107107
LANGUAGE_CODE = 'en-us'
108108

@@ -116,6 +116,6 @@
116116

117117

118118
# Static files (CSS, JavaScript, Images)
119-
# https://docs.djangoproject.com/en/1.10/howto/static-files/
119+
# https://docs.djangoproject.com/en/2.0/howto/static-files/
120120

121121
STATIC_URL = '/static/'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""advcbv URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/2.0/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.contrib import admin
17+
from django.urls import path, include
18+
from basic_app import views
19+
20+
urlpatterns = [
21+
path('',views.IndexView.as_view()),
22+
path('admin/',admin.site.urls,name='admin'),
23+
path('basic_app/',include('basic_app.urls',namespace='basic_app')),
24+
# path('',views.CBView.as_view()),
25+
# path('',views.index)
26+
]

Section 22 - Advanced Topics - CBVs/Advanced_Django_CBV/advcbv/advcbv/wsgi.py renamed to Section 22 - Advanced Topics - CBVs/advcbv/advcbv/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
88
"""
99

1010
import os
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.contrib import admin
2-
from basic_app.models import School,Student
2+
from .models import School,Student
33
# Register your models here.
44
admin.site.register(School)
55
admin.site.register(Student)
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# -*- coding: utf-8 -*-
2-
# Generated by Django 1.10.5 on 2017-03-17 21:38
3-
from __future__ import unicode_literals
1+
# Generated by Django 2.0.5 on 2018-09-05 16:28
42

5-
from django.conf import settings
63
from django.db import migrations, models
74
import django.db.models.deletion
85

@@ -12,7 +9,6 @@ class Migration(migrations.Migration):
129
initial = True
1310

1411
dependencies = [
15-
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
1612
]
1713

1814
operations = [
@@ -21,8 +17,8 @@ class Migration(migrations.Migration):
2117
fields=[
2218
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
2319
('name', models.CharField(max_length=256)),
20+
('principal', models.CharField(max_length=256)),
2421
('location', models.CharField(max_length=256)),
25-
('principal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='schools', to=settings.AUTH_USER_MODEL)),
2622
],
2723
),
2824
migrations.CreateModel(
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from django.db import models
2-
from django.core.urlresolvers import reverse
2+
from django.urls import reverse
3+
# SuperUserInformation
4+
# User: Jose
5+
# Email: training@pieriandata.com
6+
# Password: testpassword
37

48
# Create your models here.
59
class School(models.Model):
@@ -16,7 +20,7 @@ def get_absolute_url(self):
1620
class Student(models.Model):
1721
name = models.CharField(max_length=256)
1822
age = models.PositiveIntegerField()
19-
school = models.ForeignKey(School,related_name='students')
23+
school = models.ForeignKey(School,related_name='students',on_delete=models.CASCADE)
2024

2125
def __str__(self):
2226
return self.name
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
{% load static %}
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<title>
7+
CBVs
8+
{# Title Extensions go inside the block#}
9+
{% block title_block %}
10+
11+
{% endblock %}
12+
</title>
13+
14+
{# Bootstrap and CSS (Probably would want downloaded files in your real projects)#}
15+
{# https://bootswatch.com/#}
16+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
17+
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
18+
19+
</head>
20+
<body>
21+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
22+
<div class="navbar-nav">
23+
<a class="navbar-brand" href="{% url 'basic_app:list' %}">Schools</a>
24+
<a class="nav-item nav-link" href="{% url 'admin:index' %}">Admin</a>
25+
<a class="nav-item nav-link" href="{% url 'basic_app:create' %}">Create School</a>
26+
</div>
27+
</nav>
28+
29+
<div class="container">
30+
{% block body_block %}
31+
32+
{% endblock %}
33+
</div>
34+
35+
</body>
36+
37+
{# Plugins#}
38+
39+
<!-- Latest compiled and minified jQuery -->
40+
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
41+
<!-- Latest compiled and minified JavaScript -->
42+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
43+
</html>

0 commit comments

Comments
 (0)