diff --git a/youngjin.han/django/mysite/db.sqlite3 b/youngjin.han/django/mysite/db.sqlite3 index c1315a7..555268d 100644 Binary files a/youngjin.han/django/mysite/db.sqlite3 and b/youngjin.han/django/mysite/db.sqlite3 differ diff --git a/youngjin.han/django/mysite/mysite/__pycache__/settings.cpython-37.pyc b/youngjin.han/django/mysite/mysite/__pycache__/settings.cpython-37.pyc index e60958a..47950c9 100644 Binary files a/youngjin.han/django/mysite/mysite/__pycache__/settings.cpython-37.pyc and b/youngjin.han/django/mysite/mysite/__pycache__/settings.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/mysite/settings.py b/youngjin.han/django/mysite/mysite/settings.py index 76cb072..1c8d420 100644 --- a/youngjin.han/django/mysite/mysite/settings.py +++ b/youngjin.han/django/mysite/mysite/settings.py @@ -60,7 +60,7 @@ ROOT_URLCONF = 'mysite.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/youngjin.han/django/mysite/mysite/settings.pyc b/youngjin.han/django/mysite/mysite/settings.pyc index afdd15f..0773e2d 100644 Binary files a/youngjin.han/django/mysite/mysite/settings.pyc and b/youngjin.han/django/mysite/mysite/settings.pyc differ diff --git a/youngjin.han/django/mysite/polls/__pycache__/admin.cpython-37.pyc b/youngjin.han/django/mysite/polls/__pycache__/admin.cpython-37.pyc index c4feb4f..773cbe3 100644 Binary files a/youngjin.han/django/mysite/polls/__pycache__/admin.cpython-37.pyc and b/youngjin.han/django/mysite/polls/__pycache__/admin.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/polls/__pycache__/models.cpython-37.pyc b/youngjin.han/django/mysite/polls/__pycache__/models.cpython-37.pyc index b59588a..b443b18 100644 Binary files a/youngjin.han/django/mysite/polls/__pycache__/models.cpython-37.pyc and b/youngjin.han/django/mysite/polls/__pycache__/models.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/polls/__pycache__/tests.cpython-37.pyc b/youngjin.han/django/mysite/polls/__pycache__/tests.cpython-37.pyc new file mode 100644 index 0000000..6277b12 Binary files /dev/null and b/youngjin.han/django/mysite/polls/__pycache__/tests.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/polls/__pycache__/urls.cpython-37.pyc b/youngjin.han/django/mysite/polls/__pycache__/urls.cpython-37.pyc index d00d085..27ccfc6 100644 Binary files a/youngjin.han/django/mysite/polls/__pycache__/urls.cpython-37.pyc and b/youngjin.han/django/mysite/polls/__pycache__/urls.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/polls/__pycache__/views.cpython-37.pyc b/youngjin.han/django/mysite/polls/__pycache__/views.cpython-37.pyc index e1f4a9e..fc65d7a 100644 Binary files a/youngjin.han/django/mysite/polls/__pycache__/views.cpython-37.pyc and b/youngjin.han/django/mysite/polls/__pycache__/views.cpython-37.pyc differ diff --git a/youngjin.han/django/mysite/polls/admin.py b/youngjin.han/django/mysite/polls/admin.py index a753d0f..74eb2f9 100644 --- a/youngjin.han/django/mysite/polls/admin.py +++ b/youngjin.han/django/mysite/polls/admin.py @@ -4,6 +4,34 @@ from __future__ import unicode_literals from django.contrib import admin # Register your models here. -from .models import Question +from .models import Choice, Question -admin.site.register(Question) +#admin.site.register(Question) + +#class QuestionAdmin(admin.ModelAdmin): +# fields = ['pub_date', 'question_text'] + +#class QuestionAdmin(admin.ModelAdmin): +# fieldsets = [ +# (None, {'fields': ['question_text']}), +# ('Date information', {'fields': ['pub_date']}), +# ] + +#class ChoiceInline(admin.StackedInline): +class ChoiceInline(admin.TabularInline): + model = Choice + extra = 3 + +class QuestionAdmin(admin.ModelAdmin): + fieldsets = [ + (None, {'fields': ['question_text']}), + ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), + ] + inlines = [ChoiceInline] + #list_display = ('question_text', 'pub_date') + list_display = ('question_text', 'pub_date', 'was_published_recently') + list_filter = ['pub_date'] + search_fields = ['question_text'] + +admin.site.register(Question, QuestionAdmin) +admin.site.register(Choice) diff --git a/youngjin.han/django/mysite/polls/admin.pyc b/youngjin.han/django/mysite/polls/admin.pyc index 03cda8a..7a2fa1a 100644 Binary files a/youngjin.han/django/mysite/polls/admin.pyc and b/youngjin.han/django/mysite/polls/admin.pyc differ diff --git a/youngjin.han/django/mysite/polls/models.py b/youngjin.han/django/mysite/polls/models.py index c6f43bd..ab1b487 100644 --- a/youngjin.han/django/mysite/polls/models.py +++ b/youngjin.han/django/mysite/polls/models.py @@ -19,6 +19,9 @@ class Question(models.Model): # return self.pub_date >= timezone.now() - datetime.timedelta(days=1) now = timezone.now() return now - datetime.timedelta(days=1) <= self.pub_date <= now + was_published_recently.admin_order_field = 'pub_date' + was_published_recently.boolean = True + was_published_recently.short_description = 'Published recently?' class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) diff --git a/youngjin.han/django/mysite/polls/models.pyc b/youngjin.han/django/mysite/polls/models.pyc index c3c7fd5..15dca98 100644 Binary files a/youngjin.han/django/mysite/polls/models.pyc and b/youngjin.han/django/mysite/polls/models.pyc differ diff --git a/youngjin.han/django/mysite/polls/templates/admin/base_site.html b/youngjin.han/django/mysite/polls/templates/admin/base_site.html new file mode 100644 index 0000000..e1b6a8a --- /dev/null +++ b/youngjin.han/django/mysite/polls/templates/admin/base_site.html @@ -0,0 +1,10 @@ +{% extends "admin/base.html" %} + +{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} + +{% block branding %} +

Polls Administration +

+{% endblock %} + +{% block nav-global %}{% endblock %} diff --git a/youngjin.han/ipv6/ipv6.org b/youngjin.han/ipv6/ipv6.org new file mode 100644 index 0000000..982f221 --- /dev/null +++ b/youngjin.han/ipv6/ipv6.org @@ -0,0 +1,3 @@ +* 2020-07-22 +** note + - none diff --git a/youngjin.han/ipv6/source/overlap.py b/youngjin.han/ipv6/source/overlap.py new file mode 100644 index 0000000..506ed71 --- /dev/null +++ b/youngjin.han/ipv6/source/overlap.py @@ -0,0 +1,17 @@ +from sys import argv +import ipaddress + +script, ip1, ip2 = argv + + +network_1 = ipaddress.ip_network(ip1) +network_2 = ipaddress.ip_network(ip2) + +#print(list(network_1)) +#print(list(network_2)) + +if True == network_1.overlaps(network_2): + print('overlap') +else: + print('no overlap') + diff --git a/youngjin.han/learning-node02-2020.org b/youngjin.han/learning-node02-2020.org index 4c34b04..0e90c5f 100644 --- a/youngjin.han/learning-node02-2020.org +++ b/youngjin.han/learning-node02-2020.org @@ -1,13 +1,33 @@ +* 2020-07-22 +*** IPv6 #1: IPv6 address uniqueness +**** DONE Lecture content + CLOSED: [2020-07-23 목 00:06] + - Ensure Uniqueness + - Every IPv6 address we register should REPRESENT a /48 + - We need to ensure that we don't register overlapping networks + - Write a python script that checks whether two IPv6 networks are overlapping + - *overlap.py ip1 ip2* + - It should output "overlap" or "no overlap" + - Use the following test IPv6 addresses: + - 2001:db8:: + - 2001:db8:0:2:: + - 2001:db8:1:: + - Assume a netmask of /48 for all of them + - Step 2: Make your script parse ipv6 networks (like + 2001:db8::/48 and 2001:db8::/64) ) and check whether they overlap + - Make use of the python3 module *ipaddress* * 2020-07-15 *** Django #7: Tutorial 6 -**** Lecture content +**** DONE Lecture content + CLOSED: [2020-07-22 수 22:25] - Environment like in Django 1 and Django 3 - Ensure your nginx is working - Paste the URL of your Django server into the chat - Ensure you can reach the other Django servers - Follow steps on https://docs.djangoproject.com/en/3.0/intro/tutorial06/ *** Django #8: Tutorial 7 -**** Lecture content +**** DONE Lecture content + CLOSED: [2020-07-22 수 22:25] - Environment like in Django 1 and Django 3 - Ensure your nginx is working - Paste the URL of your Django server into the chat diff --git a/youngjin.han/python-the-hard-way/__pycache__/mystuff.cpython-38.pyc b/youngjin.han/python-the-hard-way/__pycache__/mystuff.cpython-38.pyc new file mode 100644 index 0000000..aa138ca Binary files /dev/null and b/youngjin.han/python-the-hard-way/__pycache__/mystuff.cpython-38.pyc differ