Skip to content

Commit

Permalink
Add tags to bars
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Jun 5, 2024
1 parent ea9fe15 commit e73d5e1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main/migrations/0004_bar_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.3 on 2024-06-05 11:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0003_alter_bar_latitude_alter_bar_longitude'),
]

operations = [
migrations.AddField(
model_name='bar',
name='tags',
field=models.CharField(default='', help_text='Komma separierte Liste an Tags', max_length=254),
),
]
6 changes: 6 additions & 0 deletions main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ class OpenModel(models.IntegerChoices):
street = models.CharField(max_length=70, help_text="Straße und Hausnummer")
latitude = models.DecimalField(max_digits=22, decimal_places=16, blank=True, null=True)
longitude = models.DecimalField(max_digits=22, decimal_places=16, blank=True, null=True)
tags = models.CharField(max_length=254, default="", help_text="Komma separierte Liste an Tags")

def __str__(self):
return self.name

def tag_list(self):
if len(self.tags) > 0:
return self.tags.split(',')
return []


class Event(models.Model):
name = models.CharField(max_length=254)
Expand Down
5 changes: 5 additions & 0 deletions main/templates/main/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ <h6 class="card-title">
{% endif %}
ab {{ bar.start_time }}
</h6>
<p>
{% for tag in bar.tag_list %}
<span class="badge rounded-pill text-bg-warning">{{ tag }}</span>
{% endfor %}
</p>
<p class="card-text">
<a target="_blank"
href="https://maps.google.com/?q={{ bar.name }}, {{ bar.street }}, {{ bar.zip_code }} {{ bar.city }}">{{ bar.street }}, {{ bar.zip_code }} {{ bar.city }}</a>
Expand Down

0 comments on commit e73d5e1

Please sign in to comment.