diff options
author | luxagraf <sng@luxagraf.net> | 2019-02-18 15:21:42 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-02-18 15:21:42 -0600 |
commit | e7af8a1e0f71d38b7e83a22a822fb9d971a41ec2 (patch) | |
tree | e424d7d4e9031c9d3d09e629ce331bf882bb392c /app/jrnl | |
parent | 5da1a1e66a38c0d7185a90424d0bb9f3c3c7875d (diff) |
redid sightings design and moved all location defered things to location
objects
Diffstat (limited to 'app/jrnl')
-rw-r--r-- | app/jrnl/migrations/0028_auto_20190218_1614.py | 33 | ||||
-rw-r--r-- | app/jrnl/models.py | 10 | ||||
-rw-r--r-- | app/jrnl/views.py | 4 |
3 files changed, 35 insertions, 12 deletions
diff --git a/app/jrnl/migrations/0028_auto_20190218_1614.py b/app/jrnl/migrations/0028_auto_20190218_1614.py new file mode 100644 index 0000000..aff2331 --- /dev/null +++ b/app/jrnl/migrations/0028_auto_20190218_1614.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.5 on 2019-02-18 16:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0027_entry_country_slug'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='country_name', + ), + migrations.RemoveField( + model_name='entry', + name='country_slug', + ), + migrations.RemoveField( + model_name='entry', + name='location_name', + ), + migrations.RemoveField( + model_name='entry', + name='region_name', + ), + migrations.RemoveField( + model_name='entry', + name='state_name', + ), + ] diff --git a/app/jrnl/models.py b/app/jrnl/models.py index dca4cd4..6c334ae 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -45,11 +45,6 @@ class Entry(models.Model): enable_comments = models.BooleanField(default=False) point = models.PointField(null=True, blank=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) - location_name = models.CharField(max_length=200, blank=True, null=True) - state_name = models.CharField(max_length=200, blank=True, null=True) - country_name = models.CharField(max_length=200, blank=True, null=True) - country_slug = models.CharField(max_length=200, blank=True, null=True) - region_name = models.CharField(max_length=200, blank=True, null=True) PUB_STATUS = ( (0, 'Draft'), (1, 'Published'), @@ -177,11 +172,6 @@ class Entry(models.Model): 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)) - self.location_name = self.location.name - self.state_name = self.location.state.name - self.country_name = self.location.state.country.name - self.country_slug = self.location.state.country.slug - self.region_name = self.location.state.country.lux_region.name if created and not self.featured_image: self.featured_image = LuxImage.objects.latest() old = type(self).objects.get(pk=self.pk) if self.pk else None diff --git a/app/jrnl/views.py b/app/jrnl/views.py index d1c4159..95b5c64 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -23,7 +23,7 @@ class EntryList(PaginatedListView): def get_queryset(self): queryset = super(EntryList, self).get_queryset() print(queryset) - return queryset.filter(status__exact=1).order_by('-pub_date').select_related('location').prefetch_related('featured_image') + return queryset.filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') class EntryCountryList(PaginatedListView): @@ -115,7 +115,7 @@ class HomepageList(ListView): def get_queryset(self): queryset = super(HomepageList, self).get_queryset() self.home = self.get_home() - return queryset.filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[1:9] + return queryset.filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[2:10] def get_template_names(self): return ['%s' % self.home.template_name] |