summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /app
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'app')
-rw-r--r--app/lib/django_comments/migrations/0004_alter_comment_content_type_alter_comment_user.py27
-rw-r--r--app/lttr/migrations/0023_alter_newslettermailing_options_and_more.py21
-rw-r--r--app/products/admin.py28
-rw-r--r--app/products/migrations/0001_initial.py36
-rw-r--r--app/products/migrations/0002_auto_20191008_0841.py29
-rw-r--r--app/products/migrations/0003_auto_20191008_0941.py30
-rw-r--r--app/products/migrations/0004_auto_20191109_0849.py23
-rw-r--r--app/products/migrations/0005_product_featured_image.py19
-rw-r--r--app/products/migrations/0006_remove_product_image.py17
-rw-r--r--app/products/migrations/__init__.py0
-rw-r--r--app/products/models.py92
-rw-r--r--app/products/static/product-loader.js10
-rw-r--r--app/products/templates/products/snippet.html41
-rw-r--r--app/products/views.py15
-rw-r--r--app/recordings/__init__.py0
-rw-r--r--app/recordings/admin.py38
-rw-r--r--app/recordings/migrations/0001_initial.py34
-rw-r--r--app/recordings/migrations/0002_auto_20190325_1417.py26
-rw-r--r--app/recordings/migrations/__init__.py0
-rw-r--r--app/recordings/models.py71
-rw-r--r--app/sightings/views.py6
-rw-r--r--app/utils/views.py1
22 files changed, 48 insertions, 516 deletions
diff --git a/app/lib/django_comments/migrations/0004_alter_comment_content_type_alter_comment_user.py b/app/lib/django_comments/migrations/0004_alter_comment_content_type_alter_comment_user.py
new file mode 100644
index 0000000..e2b86c5
--- /dev/null
+++ b/app/lib/django_comments/migrations/0004_alter_comment_content_type_alter_comment_user.py
@@ -0,0 +1,27 @@
+# Generated by Django 4.2.1 on 2023-05-23 15:25
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contenttypes', '0002_remove_content_type_name'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('django_comments', '0003_add_submit_date_index'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='comment',
+ name='content_type',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='content_type_set_for_%(class)s', to='contenttypes.contenttype', verbose_name='content type'),
+ ),
+ migrations.AlterField(
+ model_name='comment',
+ name='user',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_comments', to=settings.AUTH_USER_MODEL, verbose_name='user'),
+ ),
+ ]
diff --git a/app/lttr/migrations/0023_alter_newslettermailing_options_and_more.py b/app/lttr/migrations/0023_alter_newslettermailing_options_and_more.py
new file mode 100644
index 0000000..1a4f587
--- /dev/null
+++ b/app/lttr/migrations/0023_alter_newslettermailing_options_and_more.py
@@ -0,0 +1,21 @@
+# Generated by Django 4.2.1 on 2023-05-23 15:25
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('lttr', '0022_postcardsubscriber'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='newslettermailing',
+ options={'get_latest_by': 'pub_date', 'ordering': ('-pub_date', '-newsletter')},
+ ),
+ migrations.AlterModelOptions(
+ name='postcardsubscriber',
+ options={'verbose_name': 'Postcard Subscriber'},
+ ),
+ ]
diff --git a/app/products/admin.py b/app/products/admin.py
deleted file mode 100644
index 3a26358..0000000
--- a/app/products/admin.py
+++ /dev/null
@@ -1,28 +0,0 @@
-from django.contrib import admin
-
-from .models import Brand, Product
-from utils.widgets import AdminImageWidget, LGEntryForm
-
-
-@admin.register(Product)
-class ProductAdmin(admin.ModelAdmin):
- form = LGEntryForm
- list_display = ('name', 'admin_thumbnail', 'rating', 'pub_date')
- search_fields = ['name', 'body_markdown']
- list_filter = ('rating', 'pub_date')
-
- class Media:
- js = ('image-loader.js', 'next-prev-links.js')
- css = {
- "all": ("my_styles.css",)
- }
-
-
-@admin.register(Brand)
-class BrandAdmin(admin.ModelAdmin):
- list_display = ('name', )
- search_fields = ['name',]
- list_filter = ('pub_date',)
-
- class Media:
- js = ('next-prev-links.js',)
diff --git a/app/products/migrations/0001_initial.py b/app/products/migrations/0001_initial.py
deleted file mode 100644
index eb2a822..0000000
--- a/app/products/migrations/0001_initial.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated by Django 2.2.6 on 2019-10-08 07:46
-
-from django.db import migrations, models
-import products.models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Product',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ('slug', models.CharField(max_length=50)),
- ('pub_date', models.DateTimeField()),
- ('body_markdown', models.TextField(blank=True)),
- ('body_html', models.TextField(blank=True, null=True)),
- ('primary_offer_url', models.CharField(max_length=400)),
- ('primary_offer_price', models.IntegerField()),
- ('secondary_offer_url', models.CharField(blank=True, max_length=400, null=True)),
- ('secondar_offer_price', models.IntegerField(blank=True, null=True)),
- ('rating', models.IntegerField()),
- ('is_public', models.BooleanField(default=True)),
- ('image', models.FileField(blank=True, null=True, upload_to=products.models.get_upload_path)),
- ],
- options={
- 'ordering': ('-pub_date',),
- },
- ),
- ]
diff --git a/app/products/migrations/0002_auto_20191008_0841.py b/app/products/migrations/0002_auto_20191008_0841.py
deleted file mode 100644
index 11b2d59..0000000
--- a/app/products/migrations/0002_auto_20191008_0841.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated by Django 2.2.6 on 2019-10-08 08:41
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('products', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Brand',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=200)),
- ('slug', models.CharField(max_length=50)),
- ('pub_date', models.DateTimeField(auto_now_add=True)),
- ],
- ),
- migrations.AddField(
- model_name='product',
- name='brand',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.Brand'),
- preserve_default=False,
- ),
- ]
diff --git a/app/products/migrations/0003_auto_20191008_0941.py b/app/products/migrations/0003_auto_20191008_0941.py
deleted file mode 100644
index 085fd32..0000000
--- a/app/products/migrations/0003_auto_20191008_0941.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated by Django 2.2.6 on 2019-10-08 09:41
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('products', '0002_auto_20191008_0841'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='product',
- old_name='secondar_offer_price',
- new_name='secondary_offer_price',
- ),
- migrations.AddField(
- model_name='product',
- name='primary_offer_retailer',
- field=models.CharField(default='Amazon', max_length=400),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='product',
- name='secondary_offer_retailer',
- field=models.CharField(default='Amazon', max_length=400),
- preserve_default=False,
- ),
- ]
diff --git a/app/products/migrations/0004_auto_20191109_0849.py b/app/products/migrations/0004_auto_20191109_0849.py
deleted file mode 100644
index 1666a56..0000000
--- a/app/products/migrations/0004_auto_20191109_0849.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated by Django 2.2.6 on 2019-11-09 08:49
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('products', '0003_auto_20191008_0941'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='product',
- name='primary_offer_retailer',
- field=models.IntegerField(choices=[(0, 'Amazon'), (1, 'REI'), (2, 'eBay')], default=0),
- ),
- migrations.AlterField(
- model_name='product',
- name='secondary_offer_retailer',
- field=models.IntegerField(choices=[(0, 'Amazon'), (1, 'REI'), (2, 'eBay')], default=0),
- ),
- ]
diff --git a/app/products/migrations/0005_product_featured_image.py b/app/products/migrations/0005_product_featured_image.py
deleted file mode 100644
index 032bbfa..0000000
--- a/app/products/migrations/0005_product_featured_image.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated by Django 2.2.6 on 2019-11-09 09:35
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('products', '0004_auto_20191109_0849'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='product',
- name='featured_image',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='media.LuxImage'),
- ),
- ]
diff --git a/app/products/migrations/0006_remove_product_image.py b/app/products/migrations/0006_remove_product_image.py
deleted file mode 100644
index b05110d..0000000
--- a/app/products/migrations/0006_remove_product_image.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated by Django 2.2.6 on 2019-11-09 09:47
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('products', '0005_product_featured_image'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='product',
- name='image',
- ),
- ]
diff --git a/app/products/migrations/__init__.py b/app/products/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/products/migrations/__init__.py
+++ /dev/null
diff --git a/app/products/models.py b/app/products/models.py
deleted file mode 100644
index 4b7dbec..0000000
--- a/app/products/models.py
+++ /dev/null
@@ -1,92 +0,0 @@
-import os
-from PIL import Image
-from django.db import models
-from django.db.models.signals import post_save
-from django.contrib.sitemaps import Sitemap
-from django.dispatch import receiver
-from django.urls import reverse
-from django.apps import apps
-from django.utils.html import format_html
-from django.conf import settings
-from django.template.defaultfilters import slugify
-
-from media.models import LuxImage, LuxImageSize
-from media.utils import resize_image
-from utils.util import render_images, render_products, parse_video, markdown_to_html
-
-
-def get_upload_path(self, filename):
- return "images/products/%s" % (filename)
-
-class Brand(models.Model):
- name = models.CharField(max_length=200)
- slug = models.CharField(max_length=50)
- pub_date = models.DateTimeField(auto_now_add=True)
-
- def __str__(self):
- return self.name
-
-class Product(models.Model):
- name = models.CharField(max_length=200)
- brand = models.ForeignKey(Brand, on_delete=models.CASCADE)
- slug = models.CharField(max_length=50)
- pub_date = models.DateTimeField()
- body_markdown = models.TextField(blank=True)
- body_html = models.TextField(null=True, blank=True)
- RETAILER = (
- (0, 'Amazon'),
- (1, 'REI'),
- (2, 'eBay'),
- )
- primary_offer_retailer = models.IntegerField(choices=RETAILER, default=0)
- primary_offer_url = models.CharField(max_length=400)
- primary_offer_price = models.IntegerField()
- secondary_offer_retailer = models.IntegerField(choices=RETAILER, default=0)
- secondary_offer_url = models.CharField(max_length=400, blank=True, null=True)
- secondary_offer_price = models.IntegerField(blank=True, null=True)
- rating = models.IntegerField()
- is_public = models.BooleanField(default=True)
- featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True)
-
- class Meta:
- ordering = ('-pub_date',)
-
- def __str__(self):
- return self.name
-
- @property
- def get_previous_admin_url(self):
- n = self.get_previous_by_read_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_read_date().pk])
- except model.DoesNotExist:
- return ''
-
- def admin_thumbnail(self):
- return format_html('<img src="%s" width="100" style="width:100px" />' % (self.featured_image.get_thumbnail_url()))
- admin_thumbnail.short_description = 'Thumbnail'
-
- def get_full_name(self):
- return "%s %s" % (self.brand.name, self.name)
-
- def save(self, *args, **kwargs):
- md = render_images(self.body_markdown)
- prods = render_products(md)
- self.body_html = markdown_to_html(prods)
- super(Product, self).save()
-
-
-@receiver(post_save, sender=Product)
-def post_save_events(sender, update_fields, created, instance, **kwargs):
- #base_path = "%s/%s/" % (settings.MEDIA_ROOT, "/".join(str(i) for i in instance.image.name.split('/')[:-1]))
- #filename, file_extension = os.path.splitext(instance.image.path)
- #img = Image.open(instance.image.path)
- #resize_image(img, None, 160, 78, base_path, "%s_tn%s" % (filename.split('/')[-1], file_extension))
- #resize_image(img, None, 650, 78, base_path, "%s_small%s" % (filename.split('/')[-1], file_extension))
- pass
-
diff --git a/app/products/static/product-loader.js b/app/products/static/product-loader.js
deleted file mode 100644
index 6d04b61..0000000
--- a/app/products/static/product-loader.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function add_products(){
- var el = document.getElementById("images_frame");
- if (el){
- var iframe='<iframe frameborder="0" style="border: #dddddd 1px solid;margin-left: 20px;width:330px; height:720px;" src="/luxproduct/insert/?textarea='+el.id+'"></iframe>';
- el.insertAdjacentHTML('afterend', iframe);
- }
-}
-document.addEventListener("DOMContentLoaded", function(event) {
- add_products();
-});
diff --git a/app/products/templates/products/snippet.html b/app/products/templates/products/snippet.html
deleted file mode 100644
index 3fc9f6f..0000000
--- a/app/products/templates/products/snippet.html
+++ /dev/null
@@ -1,41 +0,0 @@
-{% load get_image_by_size %}
-{% load get_image_width %}
-{% with image=object.featured_image %}
-<div itemscope itemtype="http://schema.org/Product" class="product-card">
- <meta itemprop="brand" content="{{object.brand.name}}" />
- <figure itemscope itemtype="http://schema.org/ImageObject" class="picfull">
- <a href="{% get_image_by_size image 'original' %}" title="view larger image">
- <img class="u-photo" itemprop="contentUrl" sizes="(max-width: 750px) 100vw, (min-width: 751) 750px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.name%}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}" >
- </a>
- <figcaption>{% if image.caption %}{{image.caption|safe}}{% endif %}{% if image.photo_credit_source %}{%if image.caption %} | {%endif%}image: {% if image.photo_credit_url %}<a href="{{image.photo_credit_url}}" itemprop="author">{%endif%}{{image.photo_credit_source|lower}}{% if image.photo_credit_url %}</a>{%endif%}{%endif%}
- </figcaption>
- </figure>
- <div class="buy-btn-wrapper">
- <h4 class="product-header" itemprop="name">{{object.get_full_name}}</h4>
- <h5 class="product-link" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
- <a href="{{object.primary_offer_url}}" title="buy the {{object.get_full_name}} for ${{object.primary_offer_price}} from {{object.primary_offer_retailer.get_primary_offer_retailer_display}}" itemprop="url" rel="nofollow">
- Buy Now ({{object.get_primary_offer_retailer_display}}
- <span itemprop="priceCurrency" content="USD">$</span><span itemprop="price" content="{{object.primary_offer_price}}">{{object.primary_offer_price}}</span>)
- </a>
- <link itemprop="availability" href="http://schema.org/InStock" />
- </h5>{% if object.secondary_offer_url %}
- <h5 class="product-link" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
- <a href="{{object.secondary_offer_url}}" title="buy the {{object.get_full_name}} for ${{object.secondary_offer_price}} from {{object.secondary_offer_retailer.get_secondary_offer_retailer_display}}" itemprop="url">
- Buy Now ({{object.get_secondary_offer_retailer_display}}
- <span itemprop="priceCurrency" content="USD">$</span><span itemprop="price" content="{{object.secondary_offer_price}}">{{object.secondary_offer_price}}</span>)
- </a>
- <link itemprop="availability" href="http://schema.org/InStock" />
- </h5>{% endif %}
- </div>
- <span itemprop="review" itemscope itemtype="http://schema.org/Review">
- <meta itemprop="name" content="{{object.get_full_name}}" />
- <meta itemprop="author" content="Scott Gilbertson" />
- <meta itemprop="datePublished" content="{{object.pub_date}}" />
- <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
- <meta itemprop="worstRating" content = "1"/>
- <meta itemprop="ratingValue" content="{{object.rating}}" />
- <meta itemprop="bestRating" content="10" />
- </span>
- <meta itemprop="description" content="{{object.body_markdown}}" />
-</div>
-{% endwith %}
diff --git a/app/products/views.py b/app/products/views.py
deleted file mode 100644
index 30be542..0000000
--- a/app/products/views.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from django.shortcuts import render
-from .models import Product
-
-
-def insert_products(request):
- """
- The view that handles the admin insert products feature
- """
- object_list = Product.objects.all()
- #object_list = sorted(
- # chain(images, videos, audio),
- # key=lambda instance: instance.pub_date,
- # reverse=True
- #)
- return render(request, 'admin/insert_products.html', {'object_list': object_list, 'textarea_id': request.GET['textarea']})
diff --git a/app/recordings/__init__.py b/app/recordings/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/recordings/__init__.py
+++ /dev/null
diff --git a/app/recordings/admin.py b/app/recordings/admin.py
deleted file mode 100644
index d972497..0000000
--- a/app/recordings/admin.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from django.contrib import admin
-from django.contrib.contenttypes.admin import GenericTabularInline
-
-from .models import Audio
-from utils.widgets import LGEntryForm, OLAdminBase
-from utils.util import get_latlon
-
-@admin.register(Audio)
-class NoteAdmin(OLAdminBase):
- form = LGEntryForm
- prepopulated_fields = {"slug": ('title',)}
- list_display = ('title', 'pub_date', 'location')
- fieldsets = (
- ('Note', {
- 'fields': (
- 'title',
- 'subtitle',
- 'body_markdown',
- 'slug',
- 'pub_date',
- ('mp3', 'ogg'),
- 'point'
- ),
- 'classes': (
- 'show',
- 'extrapretty',
- 'wide'
- )
- }
- ),
- )
- lat, lon = get_latlon()
- default_lon = lon
- default_lat = lat
- default_zoom = 10
-
- class Media:
- js = ('image-loader.js', 'next-prev-links.js')
diff --git a/app/recordings/migrations/0001_initial.py b/app/recordings/migrations/0001_initial.py
deleted file mode 100644
index d70b7dc..0000000
--- a/app/recordings/migrations/0001_initial.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Generated by Django 2.1.7 on 2019-03-25 14:12
-
-import datetime
-from django.db import migrations, models
-import recordings.models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Audio',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=200)),
- ('subtitle', models.CharField(blank=True, max_length=200)),
- ('slug', models.SlugField(blank=True, unique_for_date='pub_date')),
- ('body_html', models.TextField(blank=True)),
- ('body_markdown', models.TextField(blank=True)),
- ('pub_date', models.DateTimeField(default=datetime.datetime.now)),
- ('mp3', models.FileField(blank=True, null=True, upload_to=recordings.models.get_upload_path)),
- ('ogg', models.FileField(blank=True, null=True, upload_to=recordings.models.get_upload_path)),
- ],
- options={
- 'get_latest_by': 'pub_date',
- 'ordering': ('-pub_date',),
- },
- ),
- ]
diff --git a/app/recordings/migrations/0002_auto_20190325_1417.py b/app/recordings/migrations/0002_auto_20190325_1417.py
deleted file mode 100644
index d5193d3..0000000
--- a/app/recordings/migrations/0002_auto_20190325_1417.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated by Django 2.1.7 on 2019-03-25 14:17
-
-import django.contrib.gis.db.models.fields
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0017_auto_20190217_1849'),
- ('recordings', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='audio',
- name='location',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location'),
- ),
- migrations.AddField(
- model_name='audio',
- name='point',
- field=django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326),
- ),
- ]
diff --git a/app/recordings/migrations/__init__.py b/app/recordings/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/app/recordings/migrations/__init__.py
+++ /dev/null
diff --git a/app/recordings/models.py b/app/recordings/models.py
deleted file mode 100644
index 8da5c36..0000000
--- a/app/recordings/models.py
+++ /dev/null
@@ -1,71 +0,0 @@
-import datetime
-from django.contrib.gis.db import models
-from django import forms
-from django.urls import reverse
-from django.apps import apps
-
-from utils.util import render_images, markdown_to_html
-
-from locations.models import Location, CheckIn
-
-
-def get_upload_path(self, filename):
- return "audio/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename)
-
-
-class Audio(models.Model):
- title = models.CharField(max_length=200)
- subtitle = models.CharField(max_length=200, blank=True)
- slug = models.SlugField(unique_for_date='pub_date', blank=True)
- body_html = models.TextField(blank=True)
- body_markdown = models.TextField(blank=True)
- pub_date = models.DateTimeField(default=datetime.datetime.now)
- mp3 = models.FileField(blank=True, null=True, upload_to=get_upload_path)
- ogg = models.FileField(blank=True, null=True, upload_to=get_upload_path)
- point = models.PointField(blank=True, null=True)
- location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True, null=True)
-
- class Meta:
- ordering = ('-pub_date',)
- get_latest_by = 'pub_date'
-
- def __str__(self):
- return self.title
-
- def get_absolute_url(self):
- return reverse("prompt:detail", kwargs={"slug": self.slug})
-
- @property
- def get_previous_published(self):
- return self.get_previous_by_pub_date(status__exact=1)
-
- @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_published(self):
- return self.get_next_by_pub_date(status__exact=1)
-
- @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 get_type(self):
- return str(self.__class__.__name__)
-
- def save(self, *args, **kwargs):
- md = render_images(self.body_markdown)
- self.body_html = markdown_to_html(md)
- if not self.point:
- self.point = CheckIn.objects.latest().point
- try:
- self.location = Location.objects.filter(geometry__contains=self.point).get()
- except Location.DoesNotExist:
- raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL))
- super(Audio, self).save(*args, **kwargs)
diff --git a/app/sightings/views.py b/app/sightings/views.py
index 0c1f296..5e4de57 100644
--- a/app/sightings/views.py
+++ b/app/sightings/views.py
@@ -47,10 +47,4 @@ class SightingDetailView(LuxDetailView):
context['sighting'] = Sighting.objects.filter(
ap__slug=self.kwargs['slug']
).prefetch_related('location')
- #try:
- # context['recording'] = SightingAudio.objects.get(
- # ap__slug=self.kwargs['slug']
- # )
- #except SightingAudio.DoesNotExist:
- # pass
return context
diff --git a/app/utils/views.py b/app/utils/views.py
index 19ada6f..76f1574 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -9,7 +9,6 @@ from django.template import RequestContext
from django.template.defaultfilters import slugify
from media.models import LuxImage, LuxVideo, LuxAudio
-from recordings.models import Audio
BREADCRUMBS = {