[birds] Add birding location scrobbling
This commit is contained in:
@ -12,6 +12,7 @@ import pytz
|
||||
from beers.models import Beer
|
||||
from boardgames.models import BoardGame
|
||||
from books.koreader import process_koreader_sqlite_file
|
||||
from birds.models import BirdingLocation
|
||||
from books.models import Book, BookLogData, BookPageLogData, Paper
|
||||
from bricksets.models import BrickSet
|
||||
from charts.utils import build_charts
|
||||
@ -368,6 +369,7 @@ class ScrobbleQuerySet(models.QuerySet):
|
||||
"life_event",
|
||||
"mood",
|
||||
"brick_set",
|
||||
"birding_location",
|
||||
)
|
||||
|
||||
|
||||
@ -398,6 +400,7 @@ class Scrobble(TimeStampedModel):
|
||||
MOOD = "Mood", "Mood"
|
||||
BRICKSET = "BrickSet", "Brick set"
|
||||
CHANNEL = "Channel", "Channel"
|
||||
BIRDING_LOCATION = "BirdingLocation", "Birding location"
|
||||
|
||||
@classmethod
|
||||
def list(cls):
|
||||
@ -425,8 +428,11 @@ class Scrobble(TimeStampedModel):
|
||||
life_event = models.ForeignKey(LifeEvent, on_delete=models.DO_NOTHING, **BNULL)
|
||||
mood = models.ForeignKey(Mood, on_delete=models.DO_NOTHING, **BNULL)
|
||||
brick_set = models.ForeignKey(BrickSet, on_delete=models.DO_NOTHING, **BNULL)
|
||||
birding_location = models.ForeignKey(
|
||||
BirdingLocation, on_delete=models.DO_NOTHING, **BNULL
|
||||
)
|
||||
media_type = models.CharField(
|
||||
max_length=14, choices=MediaType.choices, default=MediaType.VIDEO
|
||||
max_length=20, choices=MediaType.choices, default=MediaType.VIDEO
|
||||
)
|
||||
user = models.ForeignKey(User, blank=True, null=True, on_delete=models.DO_NOTHING)
|
||||
|
||||
@ -979,6 +985,8 @@ class Scrobble(TimeStampedModel):
|
||||
media_obj = self.food
|
||||
if self.channel:
|
||||
media_obj = self.channel
|
||||
if self.birding_location:
|
||||
media_obj = self.birding_location
|
||||
return media_obj
|
||||
|
||||
def __str__(self):
|
||||
|
||||
Reference in New Issue
Block a user