From dcb89fb0cd2b7d734a01819c0990d04833e53975 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Sun, 24 Feb 2019 20:01:04 -0600 Subject: [PATCH] now with buttons! --- django/db.sqlite3 | Bin 0 -> 135168 bytes django/links/__init__.py | 0 django/links/settings.py | 125 ++++++++++++++++++ django/links/urls.py | 22 +++ django/links/wsgi.py | 16 +++ django/linkstore/__init__.py | 0 django/linkstore/admin.py | 5 + django/linkstore/apps.py | 5 + django/linkstore/migrations/0001_initial.py | 21 +++ .../migrations/0002_link_friendly_name.py | 19 +++ .../migrations/0003_auto_20190224_1838.py | 18 +++ django/linkstore/migrations/__init__.py | 0 django/linkstore/models.py | 8 ++ .../linkstore/templates/linkstore/index.html | 19 +++ django/linkstore/tests.py | 3 + django/linkstore/urls.py | 8 ++ django/linkstore/views.py | 9 ++ django/manage.py | 15 +++ django/static/linkstore/styles.css | 30 +++++ 19 files changed, 323 insertions(+) create mode 100644 django/db.sqlite3 create mode 100644 django/links/__init__.py create mode 100644 django/links/settings.py create mode 100644 django/links/urls.py create mode 100644 django/links/wsgi.py create mode 100644 django/linkstore/__init__.py create mode 100644 django/linkstore/admin.py create mode 100644 django/linkstore/apps.py create mode 100644 django/linkstore/migrations/0001_initial.py create mode 100644 django/linkstore/migrations/0002_link_friendly_name.py create mode 100644 django/linkstore/migrations/0003_auto_20190224_1838.py create mode 100644 django/linkstore/migrations/__init__.py create mode 100644 django/linkstore/models.py create mode 100644 django/linkstore/templates/linkstore/index.html create mode 100644 django/linkstore/tests.py create mode 100644 django/linkstore/urls.py create mode 100644 django/linkstore/views.py create mode 100644 django/manage.py create mode 100644 django/static/linkstore/styles.css diff --git a/django/db.sqlite3 b/django/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..301233c0cbcdc3d6e903bc3e6bd098d47fa43372 GIT binary patch literal 135168 zcmeI5d5jy^dBA6um#AHGR>zvQC1tsk))uo~a%Olf*DxGPqE@uETxlg)S_Q&nNY0Y8 zJLFKDp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DJp5t~`i}<+=#qf00e*l5C8%|00_K|2*ghMD0+52a8H)D1mkDG&Wo)m4o8jfQzwv2 zoC}~|E|zr3F4d12$UWJYGk#murmY`i%0-_*a;N74Xr^aZhJvQV+~Y`MKIbP^8NaNG zf0uh;nGqMok;w=W=AQK%=DEZT6CD{I>t`_RbY(DXwP%P=p$u~wKQ`DUjg7X8o;;33 zr=Ru_%ki&g4ot>@=rNRfdd_Ef z;OqoSolAL$71r;44otD4o*74y$(+Zq$4bDmhEZ1JGl%=qhGkX)mNv|@BA*H(={V=X zHd?V*6dP*A%pO8=Pjh3$TJ*!vXky*j9@vT^q9i6BKw@*5F~d~5pkb&b>hFshcG^V^ zD+i*deModRIfjk2%V84-LMOaFDmeXg-$3-Mrj~IiFzrE!r{_$wjAYX!EHFj{Ok)fI z(-0JVf<^+TW{C+#Dk&b_Z_d-?k9&D%>?*_EZ2~>$W^y9Q_PPFPjnq8HMOk#Tf?wph1e;EA85aNl|1|Su3jKi(5C8%|00;m9AOHk_01yBI zKmZ5;0U+=WByifZ9NceJq(A>h=l|g(|2wdT!DJu+1b_e#00KY&2mk>f00e*l5C8%u Pfm5D>@of#G_W%D6uEV-N literal 0 HcmV?d00001 diff --git a/django/links/__init__.py b/django/links/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django/links/settings.py b/django/links/settings.py new file mode 100644 index 0000000..01a0f02 --- /dev/null +++ b/django/links/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for links project. + +Generated by 'django-admin startproject' using Django 2.1.7. + +For more information on this file, see +https://docs.djangoproject.com/en/2.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.1/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +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/2.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '8uw5(^_ba75wy=u2w*+f&hk1^0(4@8bn)eq%f7@@lc5h1u!#l#' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'linkstore.apps.LinkstoreConfig', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'links.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'links.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/2.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'America/Chicago' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.1/howto/static-files/ + +STATIC_URL = '/static/' +STATICFILES_DIRS = [ + os.path.join(BASE_DIR,'static') +] +# print(STATICFILES_DIRS) \ No newline at end of file diff --git a/django/links/urls.py b/django/links/urls.py new file mode 100644 index 0000000..a66504c --- /dev/null +++ b/django/links/urls.py @@ -0,0 +1,22 @@ +"""links URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.1/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') +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') +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')) +""" +from django.contrib import admin +from django.urls import include,path + +urlpatterns = [ + path('links/',include('linkstore.urls')), + path('admin/', admin.site.urls), +] diff --git a/django/links/wsgi.py b/django/links/wsgi.py new file mode 100644 index 0000000..89a7a57 --- /dev/null +++ b/django/links/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for links 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/2.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'links.settings') + +application = get_wsgi_application() diff --git a/django/linkstore/__init__.py b/django/linkstore/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django/linkstore/admin.py b/django/linkstore/admin.py new file mode 100644 index 0000000..e9e3170 --- /dev/null +++ b/django/linkstore/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +# Register your models here. +from .models import Link +admin.site.register(Link) \ No newline at end of file diff --git a/django/linkstore/apps.py b/django/linkstore/apps.py new file mode 100644 index 0000000..be95dc9 --- /dev/null +++ b/django/linkstore/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class LinkstoreConfig(AppConfig): + name = 'linkstore' diff --git a/django/linkstore/migrations/0001_initial.py b/django/linkstore/migrations/0001_initial.py new file mode 100644 index 0000000..124202d --- /dev/null +++ b/django/linkstore/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.7 on 2019-02-24 23:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Link', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('url', models.CharField(max_length=255)), + ], + ), + ] diff --git a/django/linkstore/migrations/0002_link_friendly_name.py b/django/linkstore/migrations/0002_link_friendly_name.py new file mode 100644 index 0000000..91ace44 --- /dev/null +++ b/django/linkstore/migrations/0002_link_friendly_name.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-02-25 00:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('linkstore', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='link', + name='friendly_name', + field=models.CharField(default=None, max_length=40), + preserve_default=False, + ), + ] diff --git a/django/linkstore/migrations/0003_auto_20190224_1838.py b/django/linkstore/migrations/0003_auto_20190224_1838.py new file mode 100644 index 0000000..97fdba5 --- /dev/null +++ b/django/linkstore/migrations/0003_auto_20190224_1838.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.7 on 2019-02-25 00:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('linkstore', '0002_link_friendly_name'), + ] + + operations = [ + migrations.AlterField( + model_name='link', + name='friendly_name', + field=models.CharField(max_length=40, null=True), + ), + ] diff --git a/django/linkstore/migrations/__init__.py b/django/linkstore/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django/linkstore/models.py b/django/linkstore/models.py new file mode 100644 index 0000000..78b0c67 --- /dev/null +++ b/django/linkstore/models.py @@ -0,0 +1,8 @@ +from django.db import models + +# Create your models here. +class Link(models.Model): + friendly_name = models.CharField(max_length=40) + url = models.CharField(max_length = 255) + def __str__(self): + return self.url \ No newline at end of file diff --git a/django/linkstore/templates/linkstore/index.html b/django/linkstore/templates/linkstore/index.html new file mode 100644 index 0000000..659ec1e --- /dev/null +++ b/django/linkstore/templates/linkstore/index.html @@ -0,0 +1,19 @@ + + + Useful links + {% load static %} + + + +

Useful Links

+ {% if linklist %} + + {% else %} +

No links inputted

+ {% endif %} + + \ No newline at end of file diff --git a/django/linkstore/tests.py b/django/linkstore/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/django/linkstore/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/django/linkstore/urls.py b/django/linkstore/urls.py new file mode 100644 index 0000000..10b51ee --- /dev/null +++ b/django/linkstore/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), + # path('/static/*' +] \ No newline at end of file diff --git a/django/linkstore/views.py b/django/linkstore/views.py new file mode 100644 index 0000000..1155043 --- /dev/null +++ b/django/linkstore/views.py @@ -0,0 +1,9 @@ +from django.shortcuts import render +from django.http import HttpResponse +# Create your views here. +from .models import Link +def index(request): + # return HttpResponse("links will show up here...") + linklist = Link.objects.all() + context = {'linklist':linklist} + return render(request,'linkstore/index.html',context) \ No newline at end of file diff --git a/django/manage.py b/django/manage.py new file mode 100644 index 0000000..304729a --- /dev/null +++ b/django/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'links.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 + execute_from_command_line(sys.argv) diff --git a/django/static/linkstore/styles.css b/django/static/linkstore/styles.css new file mode 100644 index 0000000..cc5a5f3 --- /dev/null +++ b/django/static/linkstore/styles.css @@ -0,0 +1,30 @@ +.button { + /* margin: 25px 50px 75px 100px; */ + background-color: white; + color: black; + padding: 15px 32px; + font-size: 16px; + text-align: center; + border: 2px solid #4CAF50; /* Green */ + -webkit-transition-duration: 0.2s; /* Safari */ + transition-duration: 0.2s; + text-decoration: none; +} + +.button:hover { + background-color: #4CAF50; /* Green */ + color: white; +} + +li.button-div { + background: white; + margin-bottom: 50px; +} + +li.button-div:last-child { + margin-bottom: 0px; +} + +ul { + list-style-type: none; +} \ No newline at end of file