commit 65702e15ef115988ef0fb5162433230338205c30 Author: daviddoji Date: Sat Jan 1 18:21:32 2022 +0100 Initial commit diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..5f22db7 Binary files /dev/null and b/db.sqlite3 differ diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..88fe1f7 --- /dev/null +++ b/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.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) + + +if __name__ == '__main__': + main() diff --git a/portfolio/.DS_Store b/portfolio/.DS_Store new file mode 100644 index 0000000..38734ca Binary files /dev/null and b/portfolio/.DS_Store differ diff --git a/portfolio/__init__.py b/portfolio/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/portfolio/settings.py b/portfolio/settings.py new file mode 100644 index 0000000..fd7498c --- /dev/null +++ b/portfolio/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for portfolio project. + +Generated by 'django-admin startproject' using Django 2.2.1. + +For more information on this file, see +https://docs.djangoproject.com/en/2.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.2/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.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '@iih%1707hbf-10fd1n#tyqdrm^b_4efos5ufz-w5et)*_smm5' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + # my apps + 'projects', +] + +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 = 'portfolio.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + os.path.join(BASE_DIR, 'projects/templates'), + ], + '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 = 'portfolio.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.2/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.2/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.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.2/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/portfolio/urls.py b/portfolio/urls.py new file mode 100644 index 0000000..59475f5 --- /dev/null +++ b/portfolio/urls.py @@ -0,0 +1,22 @@ +"""portfolio URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.2/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('admin/', admin.site.urls), + path('projects/', include('projects.urls')), +] diff --git a/portfolio/wsgi.py b/portfolio/wsgi.py new file mode 100644 index 0000000..fc349dd --- /dev/null +++ b/portfolio/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for portfolio 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.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.settings') + +application = get_wsgi_application() diff --git a/projects/.DS_Store b/projects/.DS_Store new file mode 100644 index 0000000..a1d4728 Binary files /dev/null and b/projects/.DS_Store differ diff --git a/projects/__init__.py b/projects/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/projects/admin.py b/projects/admin.py new file mode 100644 index 0000000..d80028b --- /dev/null +++ b/projects/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from projects.models import Project + + +# Register your models here. +admin.site.register(Project) \ No newline at end of file diff --git a/projects/apps.py b/projects/apps.py new file mode 100644 index 0000000..3ef44de --- /dev/null +++ b/projects/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ProjectsConfig(AppConfig): + name = 'projects' diff --git a/projects/migrations/0001_initial.py b/projects/migrations/0001_initial.py new file mode 100644 index 0000000..eee8838 --- /dev/null +++ b/projects/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.1 on 2019-05-31 04:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=100)), + ('description', models.TextField()), + ('technology', models.CharField(max_length=20)), + ('image', models.FilePathField(path='/img')), + ], + ), + ] diff --git a/projects/migrations/0002_auto_20190531_0533.py b/projects/migrations/0002_auto_20190531_0533.py new file mode 100644 index 0000000..acf1d7a --- /dev/null +++ b/projects/migrations/0002_auto_20190531_0533.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.1 on 2019-05-31 05:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='project', + name='image', + field=models.FilePathField(path='/projects/img'), + ), + ] diff --git a/projects/migrations/0003_auto_20190601_0333.py b/projects/migrations/0003_auto_20190601_0333.py new file mode 100644 index 0000000..32fcdee --- /dev/null +++ b/projects/migrations/0003_auto_20190601_0333.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.1 on 2019-06-01 03:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0002_auto_20190531_0533'), + ] + + operations = [ + migrations.AlterField( + model_name='project', + name='image', + field=models.CharField(max_length=100), + ), + ] diff --git a/projects/migrations/__init__.py b/projects/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/projects/migrations/__pycache__/0001_initial.cpython-37.pyc b/projects/migrations/__pycache__/0001_initial.cpython-37.pyc new file mode 100644 index 0000000..f2e80c8 Binary files /dev/null and b/projects/migrations/__pycache__/0001_initial.cpython-37.pyc differ diff --git a/projects/migrations/__pycache__/0002_auto_20190531_0533.cpython-37.pyc b/projects/migrations/__pycache__/0002_auto_20190531_0533.cpython-37.pyc new file mode 100644 index 0000000..5f70258 Binary files /dev/null and b/projects/migrations/__pycache__/0002_auto_20190531_0533.cpython-37.pyc differ diff --git a/projects/migrations/__pycache__/0003_auto_20190601_0333.cpython-37.pyc b/projects/migrations/__pycache__/0003_auto_20190601_0333.cpython-37.pyc new file mode 100644 index 0000000..b728335 Binary files /dev/null and b/projects/migrations/__pycache__/0003_auto_20190601_0333.cpython-37.pyc differ diff --git a/projects/migrations/__pycache__/__init__.cpython-37.pyc b/projects/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..fd181ef Binary files /dev/null and b/projects/migrations/__pycache__/__init__.cpython-37.pyc differ diff --git a/projects/models.py b/projects/models.py new file mode 100644 index 0000000..c690e1d --- /dev/null +++ b/projects/models.py @@ -0,0 +1,9 @@ +from django.db import models + + +# Create your models here. +class Project(models.Model): + title = models.CharField(max_length=100) + description = models.TextField() + technology = models.CharField(max_length=20) + image = models.CharField(max_length=100) diff --git a/projects/static/.DS_Store b/projects/static/.DS_Store new file mode 100644 index 0000000..ec66e16 Binary files /dev/null and b/projects/static/.DS_Store differ diff --git a/projects/static/projects/.DS_Store b/projects/static/projects/.DS_Store new file mode 100644 index 0000000..fd8a907 Binary files /dev/null and b/projects/static/projects/.DS_Store differ diff --git a/projects/static/projects/img/.DS_Store b/projects/static/projects/img/.DS_Store new file mode 100644 index 0000000..8c326fc Binary files /dev/null and b/projects/static/projects/img/.DS_Store differ diff --git a/projects/static/projects/img/daily.png b/projects/static/projects/img/daily.png new file mode 100644 index 0000000..4f78ff3 Binary files /dev/null and b/projects/static/projects/img/daily.png differ diff --git a/projects/static/projects/img/testproject.png b/projects/static/projects/img/testproject.png new file mode 100644 index 0000000..c8e678d Binary files /dev/null and b/projects/static/projects/img/testproject.png differ diff --git a/projects/static/projects/img/todo.png b/projects/static/projects/img/todo.png new file mode 100644 index 0000000..bf8232f Binary files /dev/null and b/projects/static/projects/img/todo.png differ diff --git a/projects/templates/.DS_Store b/projects/templates/.DS_Store new file mode 100644 index 0000000..699d641 Binary files /dev/null and b/projects/templates/.DS_Store differ diff --git a/projects/templates/projects/all_projects.html b/projects/templates/projects/all_projects.html new file mode 100644 index 0000000..4f47708 --- /dev/null +++ b/projects/templates/projects/all_projects.html @@ -0,0 +1,25 @@ +{% extends 'projects/base.html' %} + +{% load static %} + +{% block content %} + +
+

Projects

+
+ {% for project in projects %} +
+
+ {{ project.description }} +
+
{{ project.title }}
+

{{ project.description }}

+ Read More +
+
+
+ {% endfor %} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/projects/templates/projects/base.html b/projects/templates/projects/base.html new file mode 100644 index 0000000..41a3836 --- /dev/null +++ b/projects/templates/projects/base.html @@ -0,0 +1,35 @@ + + + + + Portfolio + + + + + + + +
+ {% block content %} + + {% endblock %} +
+ + + \ No newline at end of file diff --git a/projects/templates/projects/detail.html b/projects/templates/projects/detail.html new file mode 100644 index 0000000..428ab8b --- /dev/null +++ b/projects/templates/projects/detail.html @@ -0,0 +1,20 @@ +{% extends 'projects/base.html' %} + +{% load static %} + +{% block content %} + +

{{ project.title }}

+
+
+ {{ project.description }} +
+
+
About the project
+

{{ project.description }}

+
Built with:
+

{{ project.technology }}

+
+
+ +{% endblock %} \ No newline at end of file diff --git a/projects/tests.py b/projects/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/projects/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/projects/urls.py b/projects/urls.py new file mode 100644 index 0000000..638a2ac --- /dev/null +++ b/projects/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from projects import views + + +app_name = 'projects' + +urlpatterns = [ + path('', views.all_projects, name='all_projects'), + path('', views.project_detail, name='project_detail'), +] \ No newline at end of file diff --git a/projects/views.py b/projects/views.py new file mode 100644 index 0000000..5204bfb --- /dev/null +++ b/projects/views.py @@ -0,0 +1,16 @@ +from django.shortcuts import render +from projects.models import Project + + +# Create your views here. +def all_projects(request): + # query the db to return all project objects + projects = Project.objects.all() + return render(request, 'projects/all_projects.html', + {'projects': projects}) + + +def project_detail(request, pk): + project = Project.objects.get(pk=pk) + return render(request, 'projects/detail.html', + {'project': project}) \ No newline at end of file