Add wikidata ID and year for editions
This commit is contained in:
parent
77293f03e9
commit
c3d4697470
|
@ -1,5 +1,6 @@
|
|||
## Unreleased
|
||||
|
||||
* Add wikidata ID and year for editions
|
||||
* Allow filtering by game, edition, purchase from the session list
|
||||
* Add icons for the above
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ textarea {
|
|||
|
||||
#session-table {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr repeat(3, 1fr) 0.5fr 1fr;
|
||||
grid-template-columns: 3fr 2fr repeat(2, 1fr) 0.5fr 1fr;
|
||||
}
|
||||
|
||||
.purchase-name > span:nth-child(2) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class PurchaseForm(forms.ModelForm):
|
|||
class EditionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Edition
|
||||
fields = ["game", "name", "platform"]
|
||||
fields = ["game", "name", "platform", "year_released", "wikidata"]
|
||||
|
||||
|
||||
class GameForm(forms.ModelForm):
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 4.1.5 on 2023-02-20 14:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("games", "0014_device_session_device"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="edition",
|
||||
name="wikidata",
|
||||
field=models.CharField(blank=True, default=None, max_length=50, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="edition",
|
||||
name="year_released",
|
||||
field=models.IntegerField(default=2023),
|
||||
),
|
||||
]
|
|
@ -20,6 +20,8 @@ class Edition(models.Model):
|
|||
game = models.ForeignKey("Game", on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=255)
|
||||
platform = models.ForeignKey("Platform", on_delete=models.CASCADE)
|
||||
year_released = models.IntegerField(default=datetime.today().year)
|
||||
wikidata = models.CharField(max_length=50, null=True, blank=True, default=None)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -56,7 +58,10 @@ class Purchase(models.Model):
|
|||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.edition} ({self.platform}, {self.get_ownership_type_display()})"
|
||||
platform_info = self.platform
|
||||
if self.platform != self.edition.platform:
|
||||
platform_info = f"{self.edition.platform} version on {self.platform}"
|
||||
return f"{self.edition} ({platform_info}, {self.edition.year_released}, {self.get_ownership_type_display()})"
|
||||
|
||||
|
||||
class Platform(models.Model):
|
||||
|
|
|
@ -56,7 +56,15 @@
|
|||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"><a class="hover:underline" href="{% url 'list_sessions_by_platform' data.purchase.platform.id %}">{{ data.purchase.platform }}</a></div>
|
||||
<div class="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
<a class="hover:underline" href="{% url 'list_sessions_by_platform' data.purchase.platform.id %}">
|
||||
{% if data.purchase.platform != data.purchase.edition.platform %}
|
||||
{{data.purchase.edition.platform}} on {{ data.purchase.platform }}
|
||||
{% else %}
|
||||
{{ data.purchase.platform }}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="dark:text-slate-400 text-center">{{ data.timestamp_start | date:"d/m/Y H:i" }}</div>
|
||||
<div class="dark:text-slate-400 text-center">
|
||||
{% if data.unfinished %}
|
||||
|
|
Loading…
Reference in New Issue