summaryrefslogtreecommitdiff
path: root/app/ebay
diff options
context:
space:
mode:
Diffstat (limited to 'app/ebay')
-rw-r--r--app/ebay/admin.py3
-rw-r--r--app/ebay/migrations/0005_auto_20161231_1444.py24
-rw-r--r--app/ebay/models.py14
3 files changed, 39 insertions, 2 deletions
diff --git a/app/ebay/admin.py b/app/ebay/admin.py
index 52d14ea..80d3a84 100644
--- a/app/ebay/admin.py
+++ b/app/ebay/admin.py
@@ -10,5 +10,6 @@ class ItemAdmin(admin.ModelAdmin):
@admin.register(TrackedItem)
class TrackedItemAdmin(admin.ModelAdmin):
- list_display = ('title', 'get_latest_price' )
+ list_display = ('title', 'date_ending', 'get_latest_price', 'amount_desired' )
+ list_filter = ('amount_desired',)
diff --git a/app/ebay/migrations/0005_auto_20161231_1444.py b/app/ebay/migrations/0005_auto_20161231_1444.py
new file mode 100644
index 0000000..a7a48ac
--- /dev/null
+++ b/app/ebay/migrations/0005_auto_20161231_1444.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-12-31 14:44
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ebay', '0004_trackeditem_date_ending'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='trackeditem',
+ options={'get_latest_by': 'date_ending', 'ordering': ('-date_ending', 'amount_desired')},
+ ),
+ migrations.AddField(
+ model_name='trackeditem',
+ name='amount_desired',
+ field=models.IntegerField(choices=[(0, '1'), (1, '2'), (2, '3'), (3, '4'), (4, '5')], default=0),
+ ),
+ ]
diff --git a/app/ebay/models.py b/app/ebay/models.py
index 38f8e1c..26b004e 100644
--- a/app/ebay/models.py
+++ b/app/ebay/models.py
@@ -21,10 +21,22 @@ class Item(models.Model):
class TrackedItem(models.Model):
- url = models.CharField(max_length=200)
title = models.CharField(max_length=200)
+ url = models.CharField(max_length=200)
+ DESIRE = (
+ (0, '1'),
+ (1, '2'),
+ (2, '3'),
+ (3, '4'),
+ (4, '5'),
+ )
+ amount_desired = models.IntegerField(choices=DESIRE, default=0)
date_ending = models.DateTimeField(default=timezone.now)
+ class Meta:
+ ordering = ('-date_ending', 'amount_desired')
+ get_latest_by = 'date_ending'
+
def save(self, **kwargs):
super(TrackedItem, self).save()