diff options
Diffstat (limited to 'app/unused_apps/people')
-rw-r--r-- | app/unused_apps/people/__init__.py | 0 | ||||
-rw-r--r-- | app/unused_apps/people/admin.py | 8 | ||||
-rw-r--r-- | app/unused_apps/people/build.py | 35 | ||||
-rw-r--r-- | app/unused_apps/people/migrations/0001_initial.py | 42 | ||||
-rw-r--r-- | app/unused_apps/people/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/unused_apps/people/models.py | 54 | ||||
-rw-r--r-- | app/unused_apps/people/urls.py | 36 | ||||
-rw-r--r-- | app/unused_apps/people/views.py | 38 |
8 files changed, 0 insertions, 213 deletions
diff --git a/app/unused_apps/people/__init__.py b/app/unused_apps/people/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/app/unused_apps/people/__init__.py +++ /dev/null diff --git a/app/unused_apps/people/admin.py b/app/unused_apps/people/admin.py deleted file mode 100644 index ea0b463..0000000 --- a/app/unused_apps/people/admin.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.contrib import admin -from .models import Person - - -@admin.register(Person) -class PersonAdmin(admin.ModelAdmin): - list_display = ('last_name', 'first_name', 'location_met', ) - diff --git a/app/unused_apps/people/build.py b/app/unused_apps/people/build.py deleted file mode 100644 index 35fdb19..0000000 --- a/app/unused_apps/people/build.py +++ /dev/null @@ -1,35 +0,0 @@ -import os -from django.urls import reverse -from builder.base import BuildNew - - -class BuildBooks(BuildNew): - - def build(self): - self.build_detail_view() - self.build_list_view( - base_path=reverse("books:live_redirect"), - paginate_by=24 - ) - print("building books") - - def get_model_queryset(self): - return self.model.objects.all() - - def build_detail_view(self): - ''' - write out all the expenses for each trip - ''' - for obj in self.get_model_queryset(): - url = obj.get_absolute_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 builder(): - j = BuildBooks("books", "book") - j.build() diff --git a/app/unused_apps/people/migrations/0001_initial.py b/app/unused_apps/people/migrations/0001_initial.py deleted file mode 100644 index 6f21bea..0000000 --- a/app/unused_apps/people/migrations/0001_initial.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 2.0.1 on 2018-04-05 09:06 - -from django.db import migrations, models -import django.db.models.deletion -import taggit.managers - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('locations', '0003_auto_20180307_1027'), - ('taggit', '0002_auto_20150616_2121'), - ] - - operations = [ - migrations.CreateModel( - name='Person', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('first_name', models.CharField(max_length=200)), - ('last_name', models.CharField(max_length=200)), - ('email', models.EmailField(blank=True, max_length=120, null=True)), - ('street', models.CharField(blank=True, max_length=355, null=True)), - ('city', models.CharField(blank=True, max_length=200, null=True)), - ('state', models.CharField(blank=True, max_length=200, null=True)), - ('postal_code', models.CharField(blank=True, max_length=20, null=True)), - ('country', models.CharField(max_length=200, null=True)), - ('phone', models.CharField(blank=True, max_length=22, null=True)), - ('slug', models.CharField(blank=True, max_length=50)), - ('body_markdown', models.TextField(blank=True, null=True)), - ('body_html', models.TextField(blank=True, null=True)), - ('next_contact_date', models.DateField(blank=True, null=True)), - ('location_met', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), - ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')), - ], - options={ - 'ordering': ('-last_name',), - }, - ), - ] diff --git a/app/unused_apps/people/migrations/__init__.py b/app/unused_apps/people/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/app/unused_apps/people/migrations/__init__.py +++ /dev/null diff --git a/app/unused_apps/people/models.py b/app/unused_apps/people/models.py deleted file mode 100644 index 1a07b16..0000000 --- a/app/unused_apps/people/models.py +++ /dev/null @@ -1,54 +0,0 @@ -from django.db import models -from django.template.defaultfilters import slugify - -from taggit.managers import TaggableManager -from locations.models import Location -from utils.util import markdown_to_html - - -class Person(models.Model): - first_name = models.CharField(max_length=200) - last_name = models.CharField(max_length=200) - email = models.EmailField(max_length=120, null=True, blank=True) - street = models.CharField(max_length=355, null=True, blank=True) - city = models.CharField(max_length=200, null=True, blank=True) - state = models.CharField(max_length=200, null=True, blank=True) - postal_code = models.CharField(max_length=20, null=True, blank=True) - country = models.CharField(max_length=200, null=True) - phone = models.CharField(max_length=22, blank=True, null=True) - slug = models.CharField(max_length=50, blank=True) - body_markdown = models.TextField(null=True, blank=True) - body_html = models.TextField(null=True, blank=True) - tags = TaggableManager(blank=True) - location_met = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) - next_contact_date = models.DateField(null=True, blank=True) - - class Meta: - ordering = ('-last_name',) - - def __str__(self): - return "%s %s" %(self.first_name, self.last_name) - - def get_absolute_url(self): - return reverse("people:detail", kwargs={"slug": self.slug}) - - @property - def get_previous_admin_url(self): - n = self.get_previous_by_pub_date() - return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[n.id] ) - - @property - def get_next_admin_url(self): - model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name) - try: - return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[self.get_next_by_pub_date().pk] ) - except model.DoesNotExist: - return '' - - def save(self, *args, **kwargs): - if not self.slug: - self.slug = slugify(("%s-%s")[:50] %(self.last_name, self.first_name)) - if self.body_markdown: - self.body_html = markdown_to_html(self.body_markdown) - super(Person, self).save() - diff --git a/app/unused_apps/people/urls.py b/app/unused_apps/people/urls.py deleted file mode 100644 index 0ae38eb..0000000 --- a/app/unused_apps/people/urls.py +++ /dev/null @@ -1,36 +0,0 @@ -from django.urls import path, re_path -from django.views.generic.base import RedirectView - -from . import views - -app_name = "people" - -urlpatterns = [ - re_path( - r'^tag/(?P<slug>[-\w]+)/$', - views.PersonTagListView.as_view(), - {'page':1}, - name='list-tag' - ), - re_path( - r'tag/(?P<slug>[-\w]+)/(?P<page>\d+)/$', - views.PersonTagListView.as_view(), - name='list-tag' - ), - re_path( - r'^(?P<page>\d+)/$', - views.PersonListView.as_view(), - name="list" - ), - path( - r'', - views.PersonListView.as_view(), - {'page':1}, - name="list" - ), - path( - r'<str:slug>/', - views.PersonDetailView.as_view(), - name='detail', - ), -] diff --git a/app/unused_apps/people/views.py b/app/unused_apps/people/views.py deleted file mode 100644 index 36c0657..0000000 --- a/app/unused_apps/people/views.py +++ /dev/null @@ -1,38 +0,0 @@ -from django.views.generic.detail import DetailView -from utils.views import PaginatedListView - -from taggit.models import Tag -from .models import Person - - -class PersonListView(PaginatedListView): - model = Person - template_name = 'archives/people.html' - - def get_context_data(self, **kwargs): - # Call the base implementation first to get a context - context = super(PersonListView, self).get_context_data(**kwargs) - context['tags'] = Person.tags.all() - return context - - -class PersonDetailView(DetailView): - model = Person - template_name = "details/person.html" - slug_field = "slug" - - -class PersonTagListView(PaginatedListView): - model = Person - template_name = 'archives/people.html' - - def get_queryset(self): - print(self.kwargs['slug']) - return Person.objects.filter(tags__slug=self.kwargs['slug']) - - def get_context_data(self, **kwargs): - # Call the base implementation first to get a context - context = super(PersonTagListView, self).get_context_data(**kwargs) - context['tag'] = Tag.objects.get(slug__exact=self.kwargs['slug']) - context['tags'] = Person.tags.all() - return context |