{{ content.title }}
+ {{ content.subtitle}}
+ Date: {{ content.pub_date }}
+diff --git a/asst1/asst1.py b/asst1/asst1.py new file mode 100644 index 0000000..6864241 --- /dev/null +++ b/asst1/asst1.py @@ -0,0 +1,44 @@ +def swapchars(phrase): + import collections + onlyalpha= ''.join(c for c in phrase if c.isalpha()) + onlyalpha=onlyalpha.lower() + m_common=collections.Counter(onlyalpha).most_common(1) + l_common=collections.Counter(onlyalpha).most_common()[:-2:-1] + new_phrase="" + for i in range(0, len(phrase)): + if phrase[i] is m_common[0][0]: + new_phrase += l_common[0][0] + elif phrase[i] == m_common[0][0].upper(): + new_phrase += l_common[0][0].upper() + elif phrase[i] is l_common[0][0]: + new_phrase += m_common[0][0] + elif phrase[i] == l_common[0][0].upper(): + new_phrase += m_common[0][0].upper() + else: + new_phrase += phrase[i] + return new_phrase + +def sortcat(n, *args): + new_list=sorted(args, key=len, reverse=True) + outputstring="" + if n is -1: + for i in new_list: + outputstring+=new_list[i] + else: + for i in range(0, n): + outputstring+=new_list[i] + return outputstring + +states_dict={} +with open("states.txt") as f: + for line in f: + (val, key) = line.split(",") + states_dict[key.strip("\n")] = val + +def bluesclues(abbrev): + return states_dict[abbrev] + +def bluesbooze(name): + for key, val in states_dict.items(): + if val == name: + return key diff --git a/asst1/test.py b/asst1/test.py new file mode 100644 index 0000000..ea42442 --- /dev/null +++ b/asst1/test.py @@ -0,0 +1,21 @@ +def swapchars(phrase): + import collections + onlyalpha= ''.join(c for c in phrase if c.isalpha()) + onlyalpha=onlyalpha.lower() + m_common=collections.Counter(onlyalpha).most_common(1) + l_common=collections.Counter(onlyalpha).most_common()[:-2:-1] + new_phrase="" + for i in range(0, len(phrase)): + if phrase[i] is m_common[0][0]: + new_phrase += l_common[0][0] + elif phrase[i] == m_common[0][0].upper(): + new_phrase += l_common[0][0].upper() + elif phrase[i] is l_common[0][0]: + new_phrase += m_common[0][0] + elif phrase[i] == l_common[0][0].upper(): + new_phrase += m_common[0][0].upper() + else: + new_phrase += phrase[i] + return new_phrase + +print swapchars("I\'m just a chi-town coder with a nice flow.") diff --git a/asst2/asst2.py b/asst2/asst2.py new file mode 100644 index 0000000..e69de29 diff --git a/asst2/models.py b/asst2/models.py index 483d302..48e00d0 100644 --- a/asst2/models.py +++ b/asst2/models.py @@ -12,7 +12,13 @@ def __init__(self, year, month, day, contributors): # TODO: Delete the following line and replace it with a line # that stores the year, month, and day (hint: check out datetime.date) - self.creation_date = None + self.year = year + self.month = month + self.day = day + + #year = datetime.date.self.strftime("%Y") + #month = datetime.date.self.strftime("%B") + #day = datetime.date.self.strftime("%d") # list of contirbutors self.contributors = contributors @@ -21,8 +27,51 @@ def __init__(self, year, month, day, contributors): def show(self): raise NotImplementedError - # TODO: Define an Article class that extends the Content class +class Article(Content): + def __init__(self, year, month, day, contributors, headline, content, show): + super(Article, self).__init__(year, month, day, contributors) + self.headline = headline + self.content = content + def show(self): + print "headline: " + headline + "\ncontributors: " + a = 0 + while a != (len(contributors) - 1): + print contributors[a] + " , " + print contributor[len(contributor)-1] + "\ndate: " + if month > 9: + print month + "/" + else: + print "0" + month + "/" + if day > 9: + print day + else: + print "0" + day + print "/" + "year\n\n" + content # TODO: Define a Picture class that extends the Content class +class Picture(Content): + def __init__(self, year, month, day, contributors, title, caption, path, show): + super(Picture, self).__init__(year, month, day, contributors) + self.caption = caption + self.path = path + + def show(self): + print "headline: " + headline + "\ncontributors: " + a = 0 + while a != (len(contributors)-1): + print contributors[a] + " , " + print contributor[leng(contributor)-1] + "\ndate: " + if month > 9: + print month + "/" + else: + print "0" + month + "/" + if day > 9: + print day + else: + print "0" + day + print "/" + "year\n\n" + from PIL import Image + Image.open(path).show + print caption diff --git a/asst3/.DS_Store b/asst3/.DS_Store new file mode 100644 index 0000000..ecac280 Binary files /dev/null and b/asst3/.DS_Store differ diff --git a/asst3/newspaper/content/__init__.py b/asst3/newspaper/content/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asst3/newspaper/content/__init__.pyc b/asst3/newspaper/content/__init__.pyc new file mode 100644 index 0000000..a27e663 Binary files /dev/null and b/asst3/newspaper/content/__init__.pyc differ diff --git a/asst3/newspaper/content/admin.py b/asst3/newspaper/content/admin.py new file mode 100644 index 0000000..13be29d --- /dev/null +++ b/asst3/newspaper/content/admin.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.contrib import admin + +# Register your models here. diff --git a/asst3/newspaper/content/admin.pyc b/asst3/newspaper/content/admin.pyc new file mode 100644 index 0000000..db2a8cd Binary files /dev/null and b/asst3/newspaper/content/admin.pyc differ diff --git a/asst3/newspaper/content/apps.py b/asst3/newspaper/content/apps.py new file mode 100644 index 0000000..7196651 --- /dev/null +++ b/asst3/newspaper/content/apps.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class ContentConfig(AppConfig): + name = 'content' diff --git a/asst3/newspaper/content/migrations/0001_initial.py b/asst3/newspaper/content/migrations/0001_initial.py new file mode 100644 index 0000000..1a263a3 --- /dev/null +++ b/asst3/newspaper/content/migrations/0001_initial.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-22 01:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Content', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=500)), + ('subtitle', models.CharField(max_length=500)), + ('pub_date', models.DateTimeField(verbose_name='date published')), + ], + ), + migrations.CreateModel( + name='Contributor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_name', models.CharField(max_length=500)), + ('last_name', models.CharField(max_length=500)), + ], + ), + migrations.CreateModel( + name='Article', + fields=[ + ('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='content.Content')), + ('text', models.TextField()), + ], + bases=('content.content',), + ), + migrations.AddField( + model_name='content', + name='contributors', + field=models.ManyToManyField(related_name='content', to='content.Contributor'), + ), + ] diff --git a/asst3/newspaper/content/migrations/0001_initial.pyc b/asst3/newspaper/content/migrations/0001_initial.pyc new file mode 100644 index 0000000..87efab7 Binary files /dev/null and b/asst3/newspaper/content/migrations/0001_initial.pyc differ diff --git a/asst3/newspaper/content/migrations/__init__.py b/asst3/newspaper/content/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asst3/newspaper/content/migrations/__init__.pyc b/asst3/newspaper/content/migrations/__init__.pyc new file mode 100644 index 0000000..04c98d6 Binary files /dev/null and b/asst3/newspaper/content/migrations/__init__.pyc differ diff --git a/asst3/newspaper/content/models.py b/asst3/newspaper/content/models.py new file mode 100644 index 0000000..71011ce --- /dev/null +++ b/asst3/newspaper/content/models.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models + +# Create your models here. + +class Content(models.Model): + title = models.CharField(max_length=500) + subtitle = models.CharField(max_length=500) + contributors = models.ManyToManyField('Contributor', + related_name='content') + pub_date = models.DateTimeField('date published') + + +class Article(Content): + text = models.TextField() + + +class Contributor(models.Model): + first_name = models.CharField(max_length=500) + last_name = models.CharField(max_length=500) + + def __die__(self): + self.delete(using=DEFAULT_DB_ALIAS, keep_parents=False) \ No newline at end of file diff --git a/asst3/newspaper/content/models.pyc b/asst3/newspaper/content/models.pyc new file mode 100644 index 0000000..3f39a7b Binary files /dev/null and b/asst3/newspaper/content/models.pyc differ diff --git a/asst3/newspaper/content/tests.py b/asst3/newspaper/content/tests.py new file mode 100644 index 0000000..5982e6b --- /dev/null +++ b/asst3/newspaper/content/tests.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.test import TestCase + +# Create your tests here. diff --git a/asst3/newspaper/content/views.py b/asst3/newspaper/content/views.py new file mode 100644 index 0000000..e784a0b --- /dev/null +++ b/asst3/newspaper/content/views.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.shortcuts import render + +# Create your views here. diff --git a/asst3/newspaper/db.sqlite3 b/asst3/newspaper/db.sqlite3 new file mode 100644 index 0000000..c56fe3d Binary files /dev/null and b/asst3/newspaper/db.sqlite3 differ diff --git a/asst3/newspaper/manage.py b/asst3/newspaper/manage.py new file mode 100755 index 0000000..b7defc3 --- /dev/null +++ b/asst3/newspaper/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "newspaper.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + 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?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/asst3/newspaper/newspaper/__init__.py b/asst3/newspaper/newspaper/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asst3/newspaper/newspaper/__init__.pyc b/asst3/newspaper/newspaper/__init__.pyc new file mode 100644 index 0000000..4979024 Binary files /dev/null and b/asst3/newspaper/newspaper/__init__.pyc differ diff --git a/asst3/newspaper/newspaper/settings.py b/asst3/newspaper/newspaper/settings.py new file mode 100644 index 0000000..fe5d0ff --- /dev/null +++ b/asst3/newspaper/newspaper/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for newspaper project. + +Generated by 'django-admin startproject' using Django 1.11.6. + +For more information on this file, see +https://docs.djangoproject.com/en/1.11/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.11/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/1.11/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'm2(3a(&2=kv@#361(ai(k_d)&uwu=i-cfdd+rlv@r(mtl@iy79' + +# 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', + 'content', +] + +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 = 'newspaper.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 = 'newspaper.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.11/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/1.11/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/1.11/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/1.11/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/asst3/newspaper/newspaper/settings.pyc b/asst3/newspaper/newspaper/settings.pyc new file mode 100644 index 0000000..1210f97 Binary files /dev/null and b/asst3/newspaper/newspaper/settings.pyc differ diff --git a/asst3/newspaper/newspaper/urls.py b/asst3/newspaper/newspaper/urls.py new file mode 100644 index 0000000..95cc943 --- /dev/null +++ b/asst3/newspaper/newspaper/urls.py @@ -0,0 +1,21 @@ +"""newspaper URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf.urls import url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), +] diff --git a/asst3/newspaper/newspaper/urls.pyc b/asst3/newspaper/newspaper/urls.pyc new file mode 100644 index 0000000..5ad304a Binary files /dev/null and b/asst3/newspaper/newspaper/urls.pyc differ diff --git a/asst3/newspaper/newspaper/wsgi.py b/asst3/newspaper/newspaper/wsgi.py new file mode 100644 index 0000000..e98cdae --- /dev/null +++ b/asst3/newspaper/newspaper/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for newspaper 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/1.11/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "newspaper.settings") + +application = get_wsgi_application() diff --git a/asst3/newspaper/newspaper/wsgi.pyc b/asst3/newspaper/newspaper/wsgi.pyc new file mode 100644 index 0000000..d830bf9 Binary files /dev/null and b/asst3/newspaper/newspaper/wsgi.pyc differ diff --git a/asst4/newspaper/.DS_Store b/asst4/newspaper/.DS_Store new file mode 100644 index 0000000..811c2d4 Binary files /dev/null and b/asst4/newspaper/.DS_Store differ diff --git a/asst4/newspaper/README.txt b/asst4/newspaper/README.txt new file mode 100644 index 0000000..a8d8f87 --- /dev/null +++ b/asst4/newspaper/README.txt @@ -0,0 +1,5 @@ +the url of the homepage: +- http://127.0.0.1:8000/ +the urls of the articles: +- http://127.0.0.1:8000/post/1/ +- http://127.0.0.1:8000/post/2/ \ No newline at end of file diff --git a/asst4/newspaper/content/.DS_Store b/asst4/newspaper/content/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/asst4/newspaper/content/.DS_Store differ diff --git a/asst4/newspaper/content/__init__.py b/asst4/newspaper/content/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asst4/newspaper/content/__init__.pyc b/asst4/newspaper/content/__init__.pyc new file mode 100644 index 0000000..a27e663 Binary files /dev/null and b/asst4/newspaper/content/__init__.pyc differ diff --git a/asst4/newspaper/content/admin.py b/asst4/newspaper/content/admin.py new file mode 100644 index 0000000..34a3302 --- /dev/null +++ b/asst4/newspaper/content/admin.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.contrib import admin + +# Register your models here. + +from content.models import Content +from content.models import Contributor + +admin.site.register(Content) +admin.site.register(Contributor) \ No newline at end of file diff --git a/asst4/newspaper/content/admin.pyc b/asst4/newspaper/content/admin.pyc new file mode 100644 index 0000000..7a60d3a Binary files /dev/null and b/asst4/newspaper/content/admin.pyc differ diff --git a/asst4/newspaper/content/apps.py b/asst4/newspaper/content/apps.py new file mode 100644 index 0000000..4364f02 --- /dev/null +++ b/asst4/newspaper/content/apps.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class ContentConfig(AppConfig): + name = 'content' + +class ContributorConfig(AppConfig): + name = 'contributor' diff --git a/asst4/newspaper/content/migrations/0001_initial.py b/asst4/newspaper/content/migrations/0001_initial.py new file mode 100644 index 0000000..ce9a2a4 --- /dev/null +++ b/asst4/newspaper/content/migrations/0001_initial.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-22 01:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Content', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=500)), + ('subtitle', models.CharField(max_length=500)), + ('pub_date', models.DateTimeField(verbose_name='date published')), + ], + ), + migrations.CreateModel( + name='Contributor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_name', models.CharField(max_length=500)), + ('last_name', models.CharField(max_length=500)), + ], + ), + migrations.AddField( + model_name='content', + name='contributors', + field=models.ManyToManyField(related_name='content', to='content.Contributor'), + ), + ] diff --git a/asst4/newspaper/content/migrations/0001_initial.pyc b/asst4/newspaper/content/migrations/0001_initial.pyc new file mode 100644 index 0000000..d32a5f2 Binary files /dev/null and b/asst4/newspaper/content/migrations/0001_initial.pyc differ diff --git a/asst4/newspaper/content/migrations/0002_auto_20171027_2104.py b/asst4/newspaper/content/migrations/0002_auto_20171027_2104.py new file mode 100644 index 0000000..e85e22f --- /dev/null +++ b/asst4/newspaper/content/migrations/0002_auto_20171027_2104.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-27 21:04 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='content', + name='text', + field=models.TextField(default=0), + preserve_default=False, + ), + ] diff --git a/asst4/newspaper/content/migrations/0002_auto_20171027_2104.pyc b/asst4/newspaper/content/migrations/0002_auto_20171027_2104.pyc new file mode 100644 index 0000000..97ef113 Binary files /dev/null and b/asst4/newspaper/content/migrations/0002_auto_20171027_2104.pyc differ diff --git a/asst4/newspaper/content/migrations/0003_auto_20171028_0126.py b/asst4/newspaper/content/migrations/0003_auto_20171028_0126.py new file mode 100644 index 0000000..e9c05da --- /dev/null +++ b/asst4/newspaper/content/migrations/0003_auto_20171028_0126.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-28 01:26 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0002_auto_20171027_2104'), + ] + + operations = [ + migrations.AlterField( + model_name='content', + name='contributors', + field=models.ManyToManyField(to='content.Contributor'), + ), + ] diff --git a/asst4/newspaper/content/migrations/0003_auto_20171028_0126.pyc b/asst4/newspaper/content/migrations/0003_auto_20171028_0126.pyc new file mode 100644 index 0000000..3ca3e38 Binary files /dev/null and b/asst4/newspaper/content/migrations/0003_auto_20171028_0126.pyc differ diff --git a/asst4/newspaper/content/migrations/__init__.py b/asst4/newspaper/content/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/asst4/newspaper/content/migrations/__init__.pyc b/asst4/newspaper/content/migrations/__init__.pyc new file mode 100644 index 0000000..04c98d6 Binary files /dev/null and b/asst4/newspaper/content/migrations/__init__.pyc differ diff --git a/asst4/newspaper/content/models.py b/asst4/newspaper/content/models.py new file mode 100644 index 0000000..25fefc9 --- /dev/null +++ b/asst4/newspaper/content/models.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models + +# Create your models here. + +class Contributor(models.Model): + first_name = models.CharField(max_length=500) + last_name = models.CharField(max_length=500) + + def __die__(self): + self.delete(using=DEFAULT_DB_ALIAS, keep_parents=False) + +class Content(models.Model): + title = models.CharField(max_length=500) + subtitle = models.CharField(max_length=500) + contributors = models.ManyToManyField(Contributor) + text = models.TextField() + pub_date = models.DateTimeField('date published') diff --git a/asst4/newspaper/content/models.pyc b/asst4/newspaper/content/models.pyc new file mode 100644 index 0000000..239b826 Binary files /dev/null and b/asst4/newspaper/content/models.pyc differ diff --git a/asst4/newspaper/content/static/css/blog.css b/asst4/newspaper/content/static/css/blog.css new file mode 100644 index 0000000..d2ba78a --- /dev/null +++ b/asst4/newspaper/content/static/css/blog.css @@ -0,0 +1,57 @@ +.page-header { + background-color: #5e0231; + margin-top: 0; + padding: 20px 20px 20px 40px; +} + +.page-header h1, .page-header h1 a, .page-header h1 a:visited, .page-header h1 a:active { + color: #f6f1ed; + font-size: 58pt; + text-decoration: none; +} + + +.page-header h4, .page-header h4 a, .page-header h4 a:visited, .page-header h4 a:active { + color: #c3bdb9; + font-size: 12pt; + text-decoration: none; +} + +.content { + margin-left: 40px; +} + +h1, h4{ + font-family: 'Poiret One', cursive; +} + +.post h2, .post h2 a, .post h2 a:visited, .post h2 a:active { + color: #6d6a6a; + font-size: 20pt; + text-decoration: none; +} + +h2, h3, p{ + font-family: 'Asap', sans-serif; +} + +h3 { + font-family: 'Asap', sans-serif; + font-size: 13pt; + color: #a8abab; +} + +p { + font-family: 'Asap', sans-serif; + font-size: 13pt; + color: #a8abab; +} + +.save { + float: right; +} + + +.post { + margin-bottom: 70px; +} diff --git a/asst4/newspaper/content/templates/.DS_Store b/asst4/newspaper/content/templates/.DS_Store new file mode 100644 index 0000000..ad1c1c4 Binary files /dev/null and b/asst4/newspaper/content/templates/.DS_Store differ diff --git a/asst4/newspaper/content/templates/content/.DS_Store b/asst4/newspaper/content/templates/content/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/asst4/newspaper/content/templates/content/.DS_Store differ diff --git a/asst4/newspaper/content/templates/content/homepage.html b/asst4/newspaper/content/templates/content/homepage.html new file mode 100644 index 0000000..ae1cde6 --- /dev/null +++ b/asst4/newspaper/content/templates/content/homepage.html @@ -0,0 +1,30 @@ +{% load staticfiles %} + +
+Date: {{ content.pub_date }}
+{{ content.text|linebreaksbr }}
+