diff options
Diffstat (limited to 'app/unused_apps/notes')
-rw-r--r-- | app/unused_apps/notes/__init__.py | 0 | ||||
-rw-r--r-- | app/unused_apps/notes/admin.py | 28 | ||||
-rw-r--r-- | app/unused_apps/notes/build.py | 36 | ||||
-rw-r--r-- | app/unused_apps/notes/migrations/0001_initial.py | 26 | ||||
-rw-r--r-- | app/unused_apps/notes/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/unused_apps/notes/models.py | 50 | ||||
-rw-r--r-- | app/unused_apps/notes/urls.py | 55 | ||||
-rw-r--r-- | app/unused_apps/notes/views.py | 39 |
8 files changed, 0 insertions, 234 deletions
diff --git a/app/unused_apps/notes/__init__.py b/app/unused_apps/notes/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/app/unused_apps/notes/__init__.py +++ /dev/null diff --git a/app/unused_apps/notes/admin.py b/app/unused_apps/notes/admin.py deleted file mode 100644 index eafd0dc..0000000 --- a/app/unused_apps/notes/admin.py +++ /dev/null @@ -1,28 +0,0 @@ -from django.contrib import admin -from notes.models import Note -from utils.widgets import LGEntryForm, OLAdminBase - - -@admin.register(Note) -class NoteAdmin(OLAdminBase): - form = LGEntryForm - prepopulated_fields = {"slug": ('title',)} - list_display = ('slug', 'pub_date') - fieldsets = ( - ('Note', { - 'fields': ( - ('title', 'slug'), - 'body_markdown', - 'pub_date', - ), - 'classes': ( - 'show', - 'extrapretty', - 'wide' - ) - } - ), - ) - - class Media: - js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/unused_apps/notes/build.py b/app/unused_apps/notes/build.py deleted file mode 100644 index dc0654e..0000000 --- a/app/unused_apps/notes/build.py +++ /dev/null @@ -1,36 +0,0 @@ -import os -from django.urls import reverse -from builder.base import BuildNew - - -class BuildNotes(BuildNew): - - def build(self): - self.build_detail_view() - self.build_list_view( - base_path=reverse("notes:live_redirect"), - paginate_by=24 - ) - self.build_year_view("notes:list_year") - self.build_month_view("notes:list_month") - - 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 = BuildNotes("notes", "luxnote") - j.build() diff --git a/app/unused_apps/notes/migrations/0001_initial.py b/app/unused_apps/notes/migrations/0001_initial.py deleted file mode 100644 index ea67ad1..0000000 --- a/app/unused_apps/notes/migrations/0001_initial.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 2.0.1 on 2018-05-09 09:35 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Note', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(blank=True, max_length=250, null=True)), - ('slug', models.SlugField(blank=True, unique_for_date='pub_date')), - ('pub_date', models.DateTimeField(default=django.utils.timezone.now)), - ('body_html', models.TextField(blank=True)), - ('body_markdown', models.TextField(verbose_name='Note')), - ], - ), - ] diff --git a/app/unused_apps/notes/migrations/__init__.py b/app/unused_apps/notes/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/app/unused_apps/notes/migrations/__init__.py +++ /dev/null diff --git a/app/unused_apps/notes/models.py b/app/unused_apps/notes/models.py deleted file mode 100644 index 8735056..0000000 --- a/app/unused_apps/notes/models.py +++ /dev/null @@ -1,50 +0,0 @@ -from django import forms -from django.contrib.gis.db import models -from django.utils import timezone -from django.conf import settings -from django.urls import reverse -from locations.models import Location - -from locations.models import CheckIn -from utils.util import markdown_to_html, render_images - - -class Note(models.Model): - title = models.CharField(max_length=250, null=True, blank=True) - slug = models.SlugField(unique_for_date='pub_date', blank=True) - pub_date = models.DateTimeField(default=timezone.now) - body_html = models.TextField(blank=True) - body_markdown = models.TextField('Note') - - def __str__(self): - return self.title - - def get_absolute_url(self): - return reverse("notes:detail", kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) - - @property - def region(self): - return self.location.state.country.lux_region - - @property - def longitude(self): - '''Get the site's longitude.''' - return round(self.point.x, 2) - - @property - def latitude(self): - '''Get the site's latitude.''' - return round(self.point.y, 2) - - @property - def get_previous_published(self): - return self.get_previous_by_pub_date() - - @property - def get_next_published(self): - return self.get_next_by_pub_date() - - def save(self, *args, **kwargs): - md = render_images(self.body_markdown) - self.body_html = markdown_to_html(md) - super(Note, self).save() diff --git a/app/unused_apps/notes/urls.py b/app/unused_apps/notes/urls.py deleted file mode 100644 index 3c47c3d..0000000 --- a/app/unused_apps/notes/urls.py +++ /dev/null @@ -1,55 +0,0 @@ -from django.conf.urls import url -from django.views.generic.base import RedirectView - -from . import views - -app_name = "notes" - -urlpatterns = [ - url( - r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+).txt$', - views.NoteDetailViewTXT.as_view(), - name="detail-txt" - ), - url( - r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', - views.NoteDetailView.as_view(), - name="detail" - ), - url( - r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', - views.NoteMonthArchiveView.as_view(month_format='%m'), - name="list_month" - ), - url( - r'(?P<year>\d{4})/$', - views.NoteYearArchiveView.as_view(), - name="list_year" - ), - url( - r'(?P<year>\d{4})/(?P<month>\d{2})/$', - views.date_list, - name="notes_by_month" - ), - url( - r'(?P<year>\d{4})/$', - views.date_list, - name="notes_by_year" - ), - url( - r'(?P<page>\d+)/$', - views.NoteList.as_view(), - name="list" - ), - # redirect / to /1/ for live server - url( - r'', - RedirectView.as_view(url="/field-notes/1/", permanent=False), - name="live_redirect" - ), - url( - r'^$', - views.entry_list, - name="notes_archive" - ), -] diff --git a/app/unused_apps/notes/views.py b/app/unused_apps/notes/views.py deleted file mode 100644 index 05fe18e..0000000 --- a/app/unused_apps/notes/views.py +++ /dev/null @@ -1,39 +0,0 @@ -from django.views.generic.dates import YearArchiveView, MonthArchiveView -from django.views.generic.detail import DetailView - -from utils.views import PaginatedListView - -from notes.models import Note - - -class NoteList(PaginatedListView): - """ - Return a list of Notes in reverse chronological order - """ - queryset = Note.objects.all().order_by('-pub_date') - template_name = "archives/notes.html" - - -class NoteDetailView(DetailView): - model = Note - template_name = "details/note.html" - slug_field = "slug" - - -class NoteDetailViewTXT(NoteDetailView): - template_name = "details/entry.txt" - - -class NoteYearArchiveView(YearArchiveView): - queryset = Note.objects.all() - date_field = "pub_date" - make_object_list = True - allow_future = True - template_name = "archives/notes_date.html" - - -class NoteMonthArchiveView(MonthArchiveView): - queryset = Note.objects.all() - date_field = "pub_date" - allow_future = True - template_name = "archives/notes_date.html" |