summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-01-19 16:05:18 -0500
committerluxagraf <sng@luxagraf.net>2016-01-19 16:05:18 -0500
commit6f7dddb428ca4db098ffbf65570db6c41109515d (patch)
tree10cb08cd7a3a18e2e598c4af484381d2a1f75da4
parent944d8bc9972abd3cede92d1a30fc0a1875a439fe (diff)
made the daily admin section a bit nicer
-rw-r--r--app/daily/admin.py1
-rw-r--r--app/daily/migrations/0007_auto_20160119_1604.py21
-rw-r--r--app/daily/models.py2
-rw-r--r--app/daily/retriever.py2
4 files changed, 25 insertions, 1 deletions
diff --git a/app/daily/admin.py b/app/daily/admin.py
index 210aabc..3ef76c0 100644
--- a/app/daily/admin.py
+++ b/app/daily/admin.py
@@ -11,6 +11,7 @@ class WeatherAdmin(OSMGeoAdmin):
class DailyAdmin(OSMGeoAdmin):
+ list_display = ('date', 'location')
form = LGEntryForm
fieldsets = (
(None, {
diff --git a/app/daily/migrations/0007_auto_20160119_1604.py b/app/daily/migrations/0007_auto_20160119_1604.py
new file mode 100644
index 0000000..1acd5de
--- /dev/null
+++ b/app/daily/migrations/0007_auto_20160119_1604.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-01-19 16:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('daily', '0006_daily_weather_human'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='daily',
+ name='location',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location'),
+ ),
+ ]
diff --git a/app/daily/models.py b/app/daily/models.py
index 43c1a85..8fcce7f 100644
--- a/app/daily/models.py
+++ b/app/daily/models.py
@@ -66,7 +66,7 @@ class Weather(models.Model):
class Daily(models.Model):
- location = models.ForeignKey(Location, blank=True)
+ location = models.ForeignKey(Location, blank=True, null=True)
weather = models.ForeignKey(Weather, blank=True, null=True)
weather_human = models.TextField(blank=True, null=True)
title = models.CharField(max_length=200, blank=True, null=True)
diff --git a/app/daily/retriever.py b/app/daily/retriever.py
index d5b023f..86a6fd9 100644
--- a/app/daily/retriever.py
+++ b/app/daily/retriever.py
@@ -12,6 +12,8 @@ def create_daily():
d, created = Daily.objects.get_or_create(
date=timezone.now()
)
+ if not created:
+ print("already existed")
def get_yesterday_weather():