Skip to content

Commit

Permalink
forigas la kampojn latitudo kaj longitudo de modelo Place (closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
interDist committed Jan 20, 2024
1 parent e1ff20a commit c4c7e48
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
21 changes: 21 additions & 0 deletions hosting/migrations/0067_remove_place_lat_lng.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.20 on 2024-01-17 20:37

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('hosting', '0066_hosting_conditions'),
]

operations = [
migrations.RemoveField(
model_name='place',
name='latitude',
),
migrations.RemoveField(
model_name='place',
name='longitude',
),
]
31 changes: 0 additions & 31 deletions hosting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,6 @@ class Place(TrackingModel, TimeStampedModel):
location_confidence = models.PositiveSmallIntegerField(
_("confidence"),
default=0)
latitude = models.FloatField(
_("latitude"),
null=True, blank=True)
longitude = models.FloatField(
_("longitude"),
null=True, blank=True)
max_guest = RangeIntegerField(
_("maximum number of guests"),
min_value=1, max_value=50,
Expand Down Expand Up @@ -817,31 +811,6 @@ def profile(self):
"""Proxy for self.owner. Rename 'owner' to 'profile' if/as possible."""
return self.owner

@property
def lat(self):
if not self.location or self.location.empty:
return 0
return round(self.location.y, 2)

@property
def lng(self):
if not self.location or self.location.empty:
return 0
return round(self.location.x, 2)

@property
def bbox(self):
"""
Returns an OpenStreetMap-formatted bounding box.
See http://wiki.osm.org/wiki/Bounding_Box
"""
dx, dy = 0.007, 0.003 # Delta lng and delta lat around position
if self.location and not self.location.empty:
boundingbox = (self.lng - dx, self.lat - dy, self.lng + dx, self.lat + dy)
return ",".join([str(coord) for coord in boundingbox])
else:
return ""

@cached_property
def subregion(self):
try:
Expand Down
8 changes: 0 additions & 8 deletions locale/eo/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2248,14 +2248,6 @@ msgstr "Ŝtato / Provinco"
msgid "confidence"
msgstr "certeco"

#: hosting/models.py
msgid "latitude"
msgstr "latitudo"

#: hosting/models.py
msgid "longitude"
msgstr "longitudo"

#: hosting/models.py
msgid "maximum number of guests"
msgstr "maksimuma nombro de gastoj"
Expand Down

0 comments on commit c4c7e48

Please sign in to comment.