summaryrefslogtreecommitdiff
path: root/bak/unused_apps/resume
diff options
context:
space:
mode:
Diffstat (limited to 'bak/unused_apps/resume')
-rw-r--r--bak/unused_apps/resume/admin.py59
-rw-r--r--bak/unused_apps/resume/build.py75
-rw-r--r--bak/unused_apps/resume/migrations/0001_initial.py49
-rw-r--r--bak/unused_apps/resume/migrations/0002_auto_20151207_2105.py25
-rw-r--r--bak/unused_apps/resume/migrations/0003_auto_20151211_1925.py19
-rw-r--r--bak/unused_apps/resume/migrations/0004_job_resume.py37
-rw-r--r--bak/unused_apps/resume/migrations/0005_job_slug.py18
-rw-r--r--bak/unused_apps/resume/migrations/0006_auto_20190112_1257.py22
-rw-r--r--bak/unused_apps/resume/migrations/0007_auto_20190113_1128.py18
-rw-r--r--bak/unused_apps/resume/migrations/0008_auto_20190113_1139.py24
-rw-r--r--bak/unused_apps/resume/migrations/0009_job_body_html.py18
-rw-r--r--bak/unused_apps/resume/migrations/0010_auto_20190113_1147.py25
-rw-r--r--bak/unused_apps/resume/migrations/0011_auto_20190114_0227.py23
-rw-r--r--bak/unused_apps/resume/migrations/__init__.py0
-rw-r--r--bak/unused_apps/resume/models.py98
-rw-r--r--bak/unused_apps/resume/urls.py48
-rw-r--r--bak/unused_apps/resume/views.py60
17 files changed, 618 insertions, 0 deletions
diff --git a/bak/unused_apps/resume/admin.py b/bak/unused_apps/resume/admin.py
new file mode 100644
index 0000000..8646cca
--- /dev/null
+++ b/bak/unused_apps/resume/admin.py
@@ -0,0 +1,59 @@
+from django.contrib import admin
+
+from utils.widgets import LGEntryForm
+from .models import Publisher, PubItem, Job, Resume
+
+
+@admin.register(Job)
+class JobAdmin(admin.ModelAdmin):
+ pass
+
+
+@admin.register(Resume)
+class ResumeAdmin(admin.ModelAdmin):
+ fieldsets = (
+ ('', {
+ 'fields': (
+ 'title',
+ 'profile',
+ 'skills',
+ 'jobs',
+ 'slug',
+ ),
+ 'classes': (
+ 'show',
+ 'extrapretty',
+ 'wide'
+ )
+ }
+ ),
+ )
+
+
+@admin.register(Publisher)
+class PublisherAdmin(admin.ModelAdmin):
+ pass
+
+
+@admin.register(PubItem)
+class PubItemAdmin(admin.ModelAdmin):
+ form = LGEntryForm
+ list_display = ('title', 'pub_date', 'publisher', 'admin_link')
+ fieldsets = (
+ ('', {
+ 'fields': (
+ 'title',
+ 'body_markdown',
+ 'slug',
+ 'pub_date',
+ 'url',
+ 'publisher',
+ ),
+ 'classes': (
+ 'show',
+ 'extrapretty',
+ 'wide'
+ )
+ }
+ ),
+ )
diff --git a/bak/unused_apps/resume/build.py b/bak/unused_apps/resume/build.py
new file mode 100644
index 0000000..4f051d5
--- /dev/null
+++ b/bak/unused_apps/resume/build.py
@@ -0,0 +1,75 @@
+import os
+from django.urls import reverse
+from builder.base import BuildNew
+from pages.models import Page
+
+from .models import Publisher
+
+
+class BuildPubs(BuildNew):
+
+ def build(self):
+ self.build_detail_view()
+ self.build_publisher_list()
+ self.build_list_view(
+ base_path=reverse("resume:list"),
+ paginate_by=9999
+ )
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+ def build_detail_view(self):
+ for obj in self.get_model_queryset():
+ url = obj.get_absolute_url()
+ print(url)
+ path, slug = os.path.split(url)
+ path = '%s/' % path
+ # write html
+ response = self.client.get(url)
+ print(path, slug)
+ self.write_file(path, response.content, filename=slug)
+
+ def build_publisher_list(self):
+ publishers = Publisher.objects.all()
+ for publisher in publishers:
+ self.build_list_view(
+ base_path=reverse("resume:list_by_publisher", kwargs={'publisher': publisher.slug, }),
+ paginate_by=9999
+ )
+
+
+class BuildResume(BuildNew):
+
+ def build(self):
+ self.build_pages()
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+ def build_pages(self):
+ '''
+ build out /work/index.html and work/resume.html
+ '''
+ pages = self.get_model_queryset().filter(app="resume", build=True)
+ for obj in pages:
+ path = "work/"
+ if obj.slug == "profile":
+ url = '/work/'
+ slug = "index"
+ else:
+ url = "/%s%s/" % (path, obj.slug)
+ slug = obj.slug
+ # write html
+ response = self.client.get(url, HTTP_HOST='127.0.0.1')
+ self.write_file(path, response.content, filename=slug)
+
+
+def pub_builder():
+ j = BuildPubs("resume", "pubitem")
+ j.build()
+
+
+def resume_builder():
+ j = BuildResume("pages", "page")
+ j.build()
diff --git a/bak/unused_apps/resume/migrations/0001_initial.py b/bak/unused_apps/resume/migrations/0001_initial.py
new file mode 100644
index 0000000..14c9348
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0001_initial.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2015-12-07 21:04
+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='PubItem',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200)),
+ ('slug', models.CharField(max_length=50)),
+ ('body_markdown', models.TextField(blank=True, null=True)),
+ ('body_html', models.TextField(blank=True, null=True)),
+ ('url', models.CharField(blank=True, max_length=200, null=True)),
+ ('pub_date', models.DateTimeField(verbose_name='Date published')),
+ ],
+ options={
+ 'ordering': ('-pub_date',),
+ },
+ ),
+ migrations.CreateModel(
+ name='Publisher',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=200)),
+ ('slug', models.SlugField()),
+ ('body_markdown', models.TextField(blank=True, null=True)),
+ ('body_html', models.TextField(blank=True, null=True)),
+ ('url', models.CharField(blank=True, max_length=200, null=True)),
+ ('payment_time', models.DecimalField(decimal_places=0, max_digits=2)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='pubitem',
+ name='publisher',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resume.Publisher'),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0002_auto_20151207_2105.py b/bak/unused_apps/resume/migrations/0002_auto_20151207_2105.py
new file mode 100644
index 0000000..7ac653f
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0002_auto_20151207_2105.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2015-12-07 21:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='publisher',
+ options={'ordering': ('-order',)},
+ ),
+ migrations.AddField(
+ model_name='publisher',
+ name='order',
+ field=models.DecimalField(decimal_places=0, default=1, max_digits=1),
+ preserve_default=False,
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0003_auto_20151211_1925.py b/bak/unused_apps/resume/migrations/0003_auto_20151211_1925.py
new file mode 100644
index 0000000..77e3049
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0003_auto_20151211_1925.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2015-12-11 19:25
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0002_auto_20151207_2105'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='publisher',
+ options={'ordering': ('order',)},
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0004_job_resume.py b/bak/unused_apps/resume/migrations/0004_job_resume.py
new file mode 100644
index 0000000..e056fec
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0004_job_resume.py
@@ -0,0 +1,37 @@
+# Generated by Django 2.1.1 on 2019-01-12 12:45
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0003_auto_20151211_1925'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Job',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200)),
+ ('employer', models.CharField(max_length=200)),
+ ('date_start', models.DateField(verbose_name='Date Start')),
+ ('date_end', models.DateField(blank=True, null=True, verbose_name='Date End')),
+ ('body_markdown', models.TextField(blank=True, null=True)),
+ ],
+ options={
+ 'ordering': ('-date_end',),
+ },
+ ),
+ migrations.CreateModel(
+ name='Resume',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200)),
+ ('profile', models.TextField()),
+ ('skills', models.TextField()),
+ ('experience', models.ManyToManyField(to='resume.Job')),
+ ],
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0005_job_slug.py b/bak/unused_apps/resume/migrations/0005_job_slug.py
new file mode 100644
index 0000000..d18baeb
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0005_job_slug.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.1 on 2019-01-12 12:56
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0004_job_resume'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='job',
+ name='slug',
+ field=models.CharField(blank=True, max_length=50),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0006_auto_20190112_1257.py b/bak/unused_apps/resume/migrations/0006_auto_20190112_1257.py
new file mode 100644
index 0000000..9ee8f1b
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0006_auto_20190112_1257.py
@@ -0,0 +1,22 @@
+# Generated by Django 2.1.1 on 2019-01-12 12:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0005_job_slug'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='job',
+ name='slug',
+ ),
+ migrations.AddField(
+ model_name='resume',
+ name='slug',
+ field=models.CharField(blank=True, max_length=50),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0007_auto_20190113_1128.py b/bak/unused_apps/resume/migrations/0007_auto_20190113_1128.py
new file mode 100644
index 0000000..a635258
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0007_auto_20190113_1128.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.1 on 2019-01-13 11:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0006_auto_20190112_1257'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='job',
+ name='employer',
+ field=models.CharField(max_length=200, null=True),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0008_auto_20190113_1139.py b/bak/unused_apps/resume/migrations/0008_auto_20190113_1139.py
new file mode 100644
index 0000000..29d975d
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0008_auto_20190113_1139.py
@@ -0,0 +1,24 @@
+# Generated by Django 2.1.1 on 2019-01-13 11:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0007_auto_20190113_1128'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='resume',
+ old_name='experience',
+ new_name='jobs',
+ ),
+ migrations.AlterField(
+ model_name='job',
+ name='employer',
+ field=models.CharField(blank=True, default='', max_length=200),
+ preserve_default=False,
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0009_job_body_html.py b/bak/unused_apps/resume/migrations/0009_job_body_html.py
new file mode 100644
index 0000000..fdeea15
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0009_job_body_html.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.1 on 2019-01-13 11:46
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0008_auto_20190113_1139'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='job',
+ name='body_html',
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0010_auto_20190113_1147.py b/bak/unused_apps/resume/migrations/0010_auto_20190113_1147.py
new file mode 100644
index 0000000..879bd55
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0010_auto_20190113_1147.py
@@ -0,0 +1,25 @@
+# Generated by Django 2.1.1 on 2019-01-13 11:47
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0009_job_body_html'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='job',
+ name='body_html',
+ field=models.TextField(blank=True, default=''),
+ preserve_default=False,
+ ),
+ migrations.AlterField(
+ model_name='job',
+ name='body_markdown',
+ field=models.TextField(blank=True, default=''),
+ preserve_default=False,
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/0011_auto_20190114_0227.py b/bak/unused_apps/resume/migrations/0011_auto_20190114_0227.py
new file mode 100644
index 0000000..7656c6e
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/0011_auto_20190114_0227.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.1.1 on 2019-01-14 02:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resume', '0010_auto_20190113_1147'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='resume',
+ name='profile_html',
+ field=models.TextField(blank=True),
+ ),
+ migrations.AddField(
+ model_name='resume',
+ name='skills_html',
+ field=models.TextField(blank=True),
+ ),
+ ]
diff --git a/bak/unused_apps/resume/migrations/__init__.py b/bak/unused_apps/resume/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bak/unused_apps/resume/migrations/__init__.py
diff --git a/bak/unused_apps/resume/models.py b/bak/unused_apps/resume/models.py
new file mode 100644
index 0000000..bac3115
--- /dev/null
+++ b/bak/unused_apps/resume/models.py
@@ -0,0 +1,98 @@
+from django.db import models
+from django.utils.encoding import force_str
+from django.urls import reverse
+from django.template.defaultfilters import slugify
+
+from utils.util import markdown_to_html
+
+
+class Publisher(models.Model):
+ name = models.CharField(max_length=200)
+ slug = models.SlugField(max_length=50)
+ body_markdown = models.TextField(null=True, blank=True)
+ body_html = models.TextField(null=True, blank=True)
+ url = models.CharField(max_length=200, blank=True, null=True)
+ payment_time = models.DecimalField(max_digits=2, decimal_places=0)
+ order = models.DecimalField(max_digits=1, decimal_places=0)
+
+ class Meta:
+ ordering = ('order',)
+
+ def __str__(self):
+ return self.name
+
+ def save(self, *args, **kwargs):
+ if self.body_markdown:
+ self.body_html = markdown_to_html(self.body_markdown)
+ super(Publisher, self).save()
+
+
+class PubItem(models.Model):
+ title = models.CharField(max_length=200)
+ slug = models.CharField(max_length=50)
+ body_markdown = models.TextField(null=True, blank=True)
+ body_html = models.TextField(null=True, blank=True)
+ url = models.CharField(max_length=200, blank=True, null=True)
+ pub_date = models.DateTimeField('Date published')
+ publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE)
+
+ class Meta:
+ ordering = ('-pub_date',)
+
+ def __str__(self):
+ return self.title
+
+ def get_absolute_url(self):
+ return reverse("resume:detail", kwargs={"publisher": self.publisher.slug, "slug": self.slug})
+
+ def admin_link(self):
+ return force_str('<a href="%s">Visit Site</a>' % (self.url))
+ admin_link.allow_tags = True
+ admin_link.short_description = 'Live Article'
+
+ def save(self, *args, **kwargs):
+ if self.body_markdown:
+ self.body_html = markdown_to_html(self.body_markdown)
+ super(PubItem, self).save()
+
+
+class Job(models.Model):
+ title = models.CharField(max_length=200)
+ employer = models.CharField(max_length=200, blank=True)
+ date_start = models.DateField('Date Start')
+ date_end = models.DateField('Date End', null=True, blank=True)
+ body_markdown = models.TextField(blank=True)
+ body_html = models.TextField(blank=True)
+
+ class Meta:
+ ordering = ('-date_end',)
+
+ def __str__(self):
+ return '{} - {}'.format(self.title, self.employer) # py3.1+ only
+
+ def save(self, *args, **kwargs):
+ if self.body_markdown:
+ self.body_html = markdown_to_html(self.body_markdown)
+ super(Job, self).save()
+
+
+class Resume(models.Model):
+ title = models.CharField(max_length=200)
+ slug = models.CharField(max_length=50, blank=True)
+ profile = models.TextField()
+ profile_html = models.TextField(blank=True)
+ skills = models.TextField()
+ skills_html = models.TextField(blank=True)
+ jobs = models.ManyToManyField(Job)
+
+ def __str__(self):
+ return self.title
+
+ def save(self, *args, **kwargs):
+ if self._state.adding and not self.slug:
+ self.slug = slugify(self.title)
+ if self.skills:
+ self.skills_html = markdown_to_html(self.skills)
+ if self.profile:
+ self.profile_html = markdown_to_html(self.profile)
+ super(Resume, self).save()
diff --git a/bak/unused_apps/resume/urls.py b/bak/unused_apps/resume/urls.py
new file mode 100644
index 0000000..de95866
--- /dev/null
+++ b/bak/unused_apps/resume/urls.py
@@ -0,0 +1,48 @@
+from django.urls import path, re_path
+from django.views.generic.base import RedirectView
+
+from . import views
+
+app_name = "resume"
+
+urlpatterns = [
+ path(
+ r'pubs/<str:publisher>/<int:page>/',
+ views.ByPublisherListView.as_view(),
+ name='list_by_publisher',
+ ),
+ path(
+ r'pubs/<str:publisher>/',
+ views.ByPublisherListView.as_view(),
+ {'page': 1},
+ name='list_by_publisher',
+ ),
+ path(
+ r'pubs/<str:page>/',
+ views.PublisherListView.as_view(),
+ name='list',
+ ),
+ path(
+ r'pubs/',
+ views.PublisherListView.as_view(),
+ {'page': 1},
+ name="list"
+ ),
+ path(
+ r'pubs/<str:publisher>/<str:slug>',
+ views.PubItemDetailView.as_view(),
+ name='detail',
+ ),
+ path(
+ r'<str:slug>/',
+ views.PageView.as_view(),
+ {'path': 'work'},
+ name="pages"
+ ),
+ path(
+ r'',
+ views.PageView.as_view(),
+ {'path': 'work', 'slug': 'profile'},
+ name="pages"
+ ),
+]
diff --git a/bak/unused_apps/resume/views.py b/bak/unused_apps/resume/views.py
new file mode 100644
index 0000000..3d0cd8d
--- /dev/null
+++ b/bak/unused_apps/resume/views.py
@@ -0,0 +1,60 @@
+from django.views.generic.detail import DetailView
+from django.views.generic.base import TemplateView
+from django.shortcuts import get_object_or_404
+from utils.views import PaginatedListView
+
+from .models import PubItem, Publisher, Resume
+from pages.models import Page
+
+
+class PublisherListView(PaginatedListView):
+ model = Publisher
+ template_name = 'archives/resume-pubs.html'
+
+ def get_queryset(self):
+ return PubItem.objects.all()
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(PublisherListView, self).get_context_data(**kwargs)
+ context['pub_list'] = Publisher.objects.all()
+ return context
+
+
+class ByPublisherListView(PaginatedListView):
+ template_name = 'archives/resume-pubs-by-pub.html'
+
+ def get_queryset(self):
+ print(self.kwargs['publisher'])
+ return PubItem.objects.filter(publisher__slug=self.kwargs['publisher'])
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(ByPublisherListView, self).get_context_data(**kwargs)
+ context['publisher'] = Publisher.objects.get(slug=self.kwargs['publisher'])
+ return context
+
+
+class PubItemDetailView(DetailView):
+ model = PubItem
+ template_name = "details/pubs.html"
+ slug_field = "slug"
+
+
+class PageView(DetailView):
+ model = Page
+ slug_field = "slug"
+
+ def get_object(self, **kwargs):
+ print("calling page view")
+ return get_object_or_404(Page, path=self.kwargs['path'], slug=self.kwargs['slug'])
+
+ def get_template_names(self):
+ return ["details/%s.html" % self.object.slug, 'details/page.html']
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(PageView, self).get_context_data(**kwargs)
+ if self.kwargs['slug'] == 'resume':
+ context['resume'] = Resume.objects.get(title='base')
+ return context