Skip to content

Commit 898a0c9

Browse files
committed
User list and profiles, misc cleanup.
1 parent 15dc432 commit 898a0c9

36 files changed

+128
-309
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
![Django Intro Tutorial](https://github.com/hackersandslackers/django-views-tutorial/blob/master/.github/[email protected]?raw=true)
1212

13-
Pocket reference for creating Django views (part 2 of a series). This repository contains source code for accompanying tutorial: https://hackersandslackers.com/creating-views-django/
13+
This repository contains source code for accompanying tutorial: https://hackersandslackers.com/creating-django-views/
14+
15+
A working demo of this source code is hosted here: https://django.hackersandslackers.app/
1416

1517
## Getting Started
1618

django_views_tutorial/settings.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
STATICFILES_DIRS = [
2222
os.path.join(PROJECT_ROOT, "static"),
2323
os.path.join(BASE_DIR, "homepage/static"),
24-
os.path.join(BASE_DIR, "simple_views/static"),
24+
os.path.join(BASE_DIR, "function_views/static"),
2525
os.path.join(BASE_DIR, "class_views/static"),
2626
]
2727

@@ -47,7 +47,7 @@
4747
'django.contrib.messages',
4848
'django.contrib.staticfiles',
4949
'homepage',
50-
'simple_views',
50+
'function_views',
5151
'class_views',
5252
'model_views',
5353
]
@@ -75,7 +75,6 @@
7575
'PASSWORD': os.environ.get('DATABASE_PASSWORD'),
7676
'HOST': os.environ.get('DATABASE_HOST'),
7777
'PORT': os.environ.get('DATABASE_PORT'),
78-
'OPTIONS': {'ssl': {'ca': os.environ.get('DATABASE_CERTIFICATE')}}
7978
}
8079
}
8180

@@ -116,4 +115,4 @@
116115
# Etc.
117116
APPEND_SLASH = True
118117

119-
GITHUB_REPO = 'Demo for creating views in Django (View on <a href="https://github.com/hackersandslackers/django-views-tutorial">Github</a>).'
118+
GITHUB_REPO = 'https://github.com/hackersandslackers/django-views-tutorial'

django_views_tutorial/static/django_views_tutorial/css/header.css

-35
This file was deleted.

django_views_tutorial/static/django_views_tutorial/css/styles.css

-192
This file was deleted.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{% if messages %}
22
<ul class="messages">
33
{% for message in messages %}
4-
<li {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</li>
4+
<li {% if message.tags %} class="{{ message.tags }}" {% endif %}>
5+
{{ message }}
6+
</li>
57
{% endfor %}
68
</ul>
79
{% endif %}

django_views_tutorial/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
urlpatterns = [
2323
path('admin/', admin.site.urls),
2424
path('', include('homepage.urls'), name='home'),
25-
path("simple_views/", include(("simple_views.urls", 'simple_views'), namespace='simple_views')),
25+
path("function_views/", include(("function_views.urls", 'function_views'), namespace='function_views')),
2626
path("class_views/", include(("class_views.urls", 'class_views'), namespace='class_views')),
2727
path("model_views/", include(("model_views.urls", 'model_views'), namespace='model_views')),
2828
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
File renamed without changes.

function_views/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class FunctionViewsConfig(AppConfig):
5+
name = 'function_views'
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django import forms
2-
from django.forms import CharField, Textarea, IntegerField
2+
from django.forms import CharField, Textarea
33

44

55
class GuestBookForm(forms.Form):
@@ -11,7 +11,3 @@ class GuestBookForm(forms.Form):
1111
widget=Textarea(attrs={'cols': '30', 'rows': '5'}),
1212
min_length=10)
1313

14-
15-
class ViewUserProfile(forms.Form):
16-
id = IntegerField(required=True,
17-
label="Enter an ID.")

simple_views/migrations/0002_auto_20200420_2052.py renamed to function_views/migrations/0002_auto_20200420_2052.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('simple_views', '0001_initial'),
9+
('function_views', '0001_initial'),
1010
]
1111

1212
operations = [

simple_views/migrations/0003_auto_20200420_2102.py renamed to function_views/migrations/0003_auto_20200420_2102.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('simple_views', '0002_auto_20200420_2052'),
9+
('function_views', '0002_auto_20200420_2052'),
1010
]
1111

1212
operations = [

simple_views/migrations/0004_auto_20200421_1657.py renamed to function_views/migrations/0004_auto_20200421_1657.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('simple_views', '0003_auto_20200420_2102'),
9+
('function_views', '0003_auto_20200420_2102'),
1010
]
1111

1212
operations = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 3.0.5 on 2020-04-23 19:03
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('function_views', '0004_auto_20200421_1657'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='user',
15+
name='facebook_profile',
16+
),
17+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.0.5 on 2020-04-23 21:38
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('function_views', '0005_remove_user_facebook_profile'),
10+
]
11+
12+
operations = [
13+
migrations.RenameField(
14+
model_name='user',
15+
old_name='title',
16+
new_name='profession',
17+
),
18+
]

simple_views/models.py renamed to function_views/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class User(models.Model):
66
id = models.AutoField(primary_key=True)
77
name = models.CharField(max_length=50)
88
email = models.EmailField(null=False)
9-
title = models.CharField(max_length=250, null=True)
9+
profession = models.CharField(max_length=250, null=True)
1010
bio = models.TextField(null=True)
1111
location = models.CharField(max_length=250, null=True)
1212
twitter_profile = models.URLField(null=True)

0 commit comments

Comments
 (0)