mirror of
https://github.com/task-17-lct/backend.git
synced 2024-11-27 11:33:48 +03:00
added shops
This commit is contained in:
parent
a94771d421
commit
ed8721b94d
3067934
data/osm/shops.json
Normal file
3067934
data/osm/shops.json
Normal file
File diff suppressed because it is too large
Load Diff
40
parsers/osm/artwork.py
Normal file
40
parsers/osm/artwork.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
import json
|
||||
|
||||
with open("data/osm/artwork.json") as f:
|
||||
data = json.load(f)
|
||||
|
||||
|
||||
ress = []
|
||||
|
||||
for el in data["elements"]:
|
||||
if "tags" in el and "name" in el["tags"] and "lat" in el and "lon" in el:
|
||||
info = el["tags"]
|
||||
if "tourism" in info:
|
||||
del info["tourism"]
|
||||
res = {
|
||||
"title": info["name:ru"] if "name:ru" in info else info["name"],
|
||||
"type": "artwork",
|
||||
"parser_source": "openstreetmap.org",
|
||||
"lat": el["lat"],
|
||||
"lon": el["lon"],
|
||||
"extra_kwargs": info,
|
||||
}
|
||||
if "addr:full" in info:
|
||||
res["address"] = info["addr:full"]
|
||||
else:
|
||||
res = []
|
||||
|
||||
if "description" in info:
|
||||
res["description"] = info["description"]
|
||||
|
||||
if "email" in info:
|
||||
res["email"] = info["email"]
|
||||
|
||||
ress.append(res)
|
||||
|
||||
|
||||
def get_artwork():
|
||||
return ress
|
||||
|
||||
|
||||
print([x for x in ress if "address" in x][:10])
|
|
@ -0,0 +1,54 @@
|
|||
# Generated by Django 4.2.1 on 2023-05-25 22:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("events", "0021_alter_hotel_type"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="restaurant",
|
||||
name="type",
|
||||
field=models.CharField(
|
||||
choices=[("restaurant", "ресторан"), ("bar", "бар"), ("cafe", "кафе")],
|
||||
db_index=True,
|
||||
default="restaurant",
|
||||
max_length=10,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="event",
|
||||
name="type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("fair", "ярмарка"),
|
||||
("boulevard", "бульвар"),
|
||||
("attraction", "достопримечательность"),
|
||||
("excursion", "экскурсия"),
|
||||
("theatre", "театр"),
|
||||
("museum", "музей"),
|
||||
("movie", "кино"),
|
||||
("concert", "концерт"),
|
||||
("plays", "спектакли"),
|
||||
("artwork", "произведение искусства"),
|
||||
("shop", "торговый центр"),
|
||||
("gallery", "галерея"),
|
||||
("theme_park", "тематический парк"),
|
||||
("viewpoint", "обзорная точка"),
|
||||
("zoo", "зоопарк"),
|
||||
("other", "другое"),
|
||||
],
|
||||
db_index=True,
|
||||
max_length=10,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="restaurant",
|
||||
name="address",
|
||||
field=models.CharField(blank=True, max_length=250, null=True),
|
||||
),
|
||||
]
|
|
@ -156,6 +156,13 @@ class EventType(models.TextChoices):
|
|||
kino = "movie", "кино"
|
||||
concert = "concert", "концерт"
|
||||
spektatli = "plays", "спектакли"
|
||||
artwork = "artwork", "произведение искусства"
|
||||
shop = "shop", "торговый центр"
|
||||
gallery = "gallery", "галерея"
|
||||
theme_park = "theme_park", "тематический парк"
|
||||
viewpoint = "viewpoint", "обзорная точка"
|
||||
zoo = "zoo", "зоопарк"
|
||||
other = "other", "другое"
|
||||
|
||||
address = models.CharField(max_length=250, null=True)
|
||||
payment_method = models.CharField(max_length=250, null=True, blank=True)
|
||||
|
@ -206,7 +213,18 @@ class HotelPhone(models.Model):
|
|||
|
||||
|
||||
class Restaurant(BasePoint):
|
||||
address = models.CharField(max_length=250)
|
||||
class RestaurantType(models.TextChoices):
|
||||
restaurant = "restaurant", "ресторан"
|
||||
bar = "bar", "бар"
|
||||
cafe = "cafe", "кафе"
|
||||
|
||||
type = models.CharField(
|
||||
db_index=True,
|
||||
default=RestaurantType.restaurant,
|
||||
choices=RestaurantType.choices,
|
||||
max_length=count_max_length(RestaurantType),
|
||||
)
|
||||
address = models.CharField(max_length=250, blank=True, null=True)
|
||||
bill = models.IntegerField(null=True)
|
||||
can_reserve = models.BooleanField(default=True)
|
||||
avg_time_visit = models.IntegerField(null=True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user