diff options
Diffstat (limited to 'bak/unused_apps')
-rw-r--r-- | bak/unused_apps/people/build.py | 35 | ||||
-rw-r--r-- | bak/unused_apps/people/models.py | 19 | ||||
-rw-r--r-- | bak/unused_apps/people/views.py | 2 |
3 files changed, 7 insertions, 49 deletions
diff --git a/bak/unused_apps/people/build.py b/bak/unused_apps/people/build.py deleted file mode 100644 index 35fdb19..0000000 --- a/bak/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/bak/unused_apps/people/models.py b/bak/unused_apps/people/models.py index 1a07b16..538c9b3 100644 --- a/bak/unused_apps/people/models.py +++ b/bak/unused_apps/people/models.py @@ -1,27 +1,26 @@ 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) + last_name = models.CharField(max_length=200, null=True, blank=True) email = models.EmailField(max_length=120, null=True, blank=True) + address = models.TextField(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) + 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) + notes = models.TextField(null=True, blank=True) location_met = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) + contact_frequency = models.BigIntegerField(help_text="In days") next_contact_date = models.DateField(null=True, blank=True) + date_added = models.DateField(auto_now_add=True) class Meta: ordering = ('-last_name',) @@ -30,7 +29,7 @@ class Person(models.Model): return "%s %s" %(self.first_name, self.last_name) def get_absolute_url(self): - return reverse("people:detail", kwargs={"slug": self.slug}) + return reverse("people:detail", kwargs={"pk": self.pk}) @property def get_previous_admin_url(self): @@ -46,9 +45,5 @@ class Person(models.Model): 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/bak/unused_apps/people/views.py b/bak/unused_apps/people/views.py index 36c0657..88bd87e 100644 --- a/bak/unused_apps/people/views.py +++ b/bak/unused_apps/people/views.py @@ -7,12 +7,10 @@ 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 |