nkdsu.apps.vote package#
Subpackages#
- nkdsu.apps.vote.management package
- Subpackages
- nkdsu.apps.vote.management.commands package
- Submodules
- nkdsu.apps.vote.management.commands.import_2013 module
- nkdsu.apps.vote.management.commands.import_show_from_itunes_playlist module
- nkdsu.apps.vote.management.commands.migrate_away_from module
- nkdsu.apps.vote.management.commands.non_ascii_tracks module
- nkdsu.apps.vote.management.commands.popular_tracks module
- nkdsu.apps.vote.management.commands.update_anime_pictures module
- nkdsu.apps.vote.management.commands.update_background_art module
- nkdsu.apps.vote.management.commands.update_emoji_lists module
- nkdsu.apps.vote.management.commands.update_library module
- nkdsu.apps.vote.management.commands.update_local_data module
- nkdsu.apps.vote.management.commands.update_mastodon_instances module
- nkdsu.apps.vote.management.commands package
- Subpackages
- nkdsu.apps.vote.templatetags package
- nkdsu.apps.vote.tests package
- Submodules
- nkdsu.apps.vote.tests.test_library_update module
TrackMeta
LibraryUpdateTest
LibraryUpdateDryRunTest
LibraryUpdateDryRunTest.test_new_track_matching_artist()
LibraryUpdateDryRunTest.test_new_track_non_matching_artist_and_anime()
LibraryUpdateDryRunTest.test_new_track_almost_matching_artist()
LibraryUpdateDryRunTest.test_new_track_artist_wrong_order()
LibraryUpdateDryRunTest.test_new_track_artist_almost_wrong_order()
LibraryUpdateDryRunTest.test_new_track_matching_anime()
LibraryUpdateDryRunTest.test_new_track_almost_matching_anime()
LibraryUpdateDryRunTest.test_new_track_almost_matching_artist_and_anime()
LibraryUpdateDryRunTest.test_removing_track()
LibraryUpdateDryRunTest.test_new_track_has_parsing_error()
LibraryUpdateDryRunTest._classSetupFailed
LibraryUpdateDryRunTest._class_cleanups
LibraryUpdateWetRunTest
MetadataConsistencyCheckTest
MetadataConsistencyCheckTest.test_anime_and_role_required_if_inudesu_false()
MetadataConsistencyCheckTest.test_slight_artist_mismatch()
MetadataConsistencyCheckTest.test_multiple_artists()
MetadataConsistencyCheckTest.test_lexer_error()
MetadataConsistencyCheckTest._classSetupFailed
MetadataConsistencyCheckTest._class_cleanups
- nkdsu.apps.vote.tests.test_local_data module
- nkdsu.apps.vote.tests.test_models module
- nkdsu.apps.vote.tests.test_parsers module
- nkdsu.apps.vote.tests.tests module
mkutc()
ShowTest
ShowTest.setUp()
ShowTest.test_make_show()
ShowTest.test_get_show()
ShowTest.test_get_show_far_in_future()
ShowTest.test_cannot_make_overlapping_shows()
ShowTest.test_calling_next_or_prev_on_only_show_returns_none()
ShowTest.test_showtime_date_constraint()
ShowTest._classSetupFailed
ShowTest._class_cleanups
TrackTest
PlayTest
- nkdsu.apps.vote.views package
IndexView
Browse
BrowseAnime
BrowseArtists
BrowseComposers
BrowseYears
BrowseRoles
Archive
ShowDetail
ListenRedirect
Roulette
Search
TrackSpecificMixin
TrackDetail
VoterDetail
TwitterUserDetail
UpdateVoteView
Year
Artist
Anime
AnimePicture
Composer
Added
Stats
Info
APIDocs
Privacy
TermsOfService
ReportBadMetadata
RequestAddition
TracksFromGetParamMixin
VoteView
AddToListView
SetDarkModeView
- Submodules
- nkdsu.apps.vote.views.admin module
AdminMixin
TrackSpecificAdminMixin
AdminActionMixin
AdminAction
DestructiveAdminAction
SelectionAdminAction
Play
PostAboutPlay
Archive
Unarchive
Hide
Unhide
LockMetadata
UnlockMetadata
ManualVote
MakeBlock
Unblock
MakeBlockWithReason
MakeShortlist
MakeDiscard
OrderShortlist
ResetShortlistAndDiscard
LibraryUploadView
LibraryUploadConfirmView
MyriadExportUploadView
ToggleAbuser
ToggleTwitterAbuser
ToggleLocalAbuser
HiddenTracks
ArchivedTracks
TracksWithNoMediaId
InuDesuTracks
ArtlessTracks
ShortlistSelection
ArchiveSelection
UnarchiveSelection
HideSelection
UnhideSelection
DiscardSelection
ResetShortlistAndDiscardSelection
MakeNote
RemoveNote
MigrateAwayFrom
Throw500
- nkdsu.apps.vote.views.api module
- nkdsu.apps.vote.views.elf module
- nkdsu.apps.vote.views.js module
- nkdsu.apps.vote.views.profiles module
Submodules#
nkdsu.apps.vote.admin module#
- class nkdsu.apps.vote.admin.UserAdmin(model, admin_site)[source]#
Bases:
UserAdmin
- list_display = ('username', 'display_name', 'email', 'is_elf', 'is_staff', 'is_superuser', 'has_usable_password')#
- property media#
- class nkdsu.apps.vote.admin.ShowAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('showtime', 'end', 'voting_allowed')#
- property media#
- class nkdsu.apps.vote.admin.TwitterUserAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('screen_name', 'is_abuser', 'is_patron')#
- list_filter = ('is_abuser', 'is_patron')#
- property media#
- class nkdsu.apps.vote.admin.UserBadgeAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('profile', 'twitter_user', 'badge')#
- list_filter = ('profile', 'twitter_user', 'badge')#
- property media#
- class nkdsu.apps.vote.admin.VoteAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('__str__', 'date', 'vote_kind')#
- list_filter = ('kind', 'twitter_user')#
- filter_horizontal = ('tracks',)#
- property media#
- class nkdsu.apps.vote.admin.TrackAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('id3_title', 'id3_artist')#
- property media#
- class nkdsu.apps.vote.admin.PlayAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('track', 'date')#
- property media#
- class nkdsu.apps.vote.admin.BlockAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('track', 'reason', 'show')#
- property media#
- class nkdsu.apps.vote.admin.DiscardShortlistAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('track', 'show')#
- property media#
- class nkdsu.apps.vote.admin.ProfileAdmin(model, admin_site)[source]#
Bases:
ModelAdmin
- list_display = ('__str__', 'is_patron', 'is_abuser')#
- property media#
nkdsu.apps.vote.anime module#
- class nkdsu.apps.vote.anime.Anime(*, title: str, picture: Url, thumbnail: Url, synonyms: list[str], sources: list[Url], relations: list[Url], anime_season: Season, type: Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN'])[source]#
Bases:
BaseModel
- model_config: ClassVar[ConfigDict] = {'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- picture: HttpUrl#
- thumbnail: HttpUrl#
- type: Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN']#
- inclusion_ranking() tuple[int, float] [source]#
Return an estimated representation of how likely this anime is to be something in the library, in the form of a tuple of numbers that you can sort by. Helpful for situations where we have multiple matches for the same name. Lower is more likely.
- _abc_impl = <_abc._abc_data object>#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_fields: ClassVar[dict[str, FieldInfo]] = {'anime_season': FieldInfo(annotation=Season, required=True), 'picture': FieldInfo(annotation=Url, required=True, metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'relations': FieldInfo(annotation=list[Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]], required=True), 'sources': FieldInfo(annotation=list[Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]], required=True), 'synonyms': FieldInfo(annotation=list[str], required=True), 'thumbnail': FieldInfo(annotation=Url, required=True, metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'title': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN'], required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- nkdsu.apps.vote.anime.get_anime(title: str) Anime | None [source]#
>>> get_anime('Machikado Mazoku').title 'Machikado Mazoku' >>> get_anime('The Demon Girl Next Door').title 'Machikado Mazoku' >>> get_anime('shamiko')
- nkdsu.apps.vote.anime.fuzzy_nkdsu_aliases() dict[str, str] [source]#
Return a dict of
{alias: nkdsu_title}
wherenkdsu_title
is an anime included in the nkd.su database, andalias
is a lowercased alternative title for thenkdsu_title
it points to.>>> from pprint import pprint >>> from nkdsu.apps.vote.models import Track >>> from django.utils.timezone import now >>> defaults = dict( ... id3_artist='someone', hidden=False, inudesu=False, added=now(), revealed=now() ... )
With some anime titles that don’t have very many synonyms:
>>> Track.objects.create(**defaults, id='1', id3_title='song (Eiji OP1)') <Track: ‘song’ (Eiji OP1) - someone> >>> Track.objects.create(**defaults, id='2', id3_title='ditty (◯ ED1)') <Track: ‘ditty’ (◯ ED1) - someone> >>> pprint(fuzzy_nkdsu_aliases()) {'"eiji"': 'Eiji', 'circle': '◯', 'eiji': 'Eiji', 'o (sawako kabuki)': '◯', '°': '◯', '○': '◯', '◯': '◯', '「エイジ」': 'Eiji', 'エイジ': 'Eiji'}
nkdsu.apps.vote.api_utils module#
- class nkdsu.apps.vote.api_utils.SerializableModelMeta(name, bases, namespace, /, **kwargs)[source]#
Bases:
_ProtocolMeta
,ModelBase
- class nkdsu.apps.vote.api_utils.SerializableBase(*args, **kwargs)[source]#
Bases:
Protocol
- api_dict(verbose: bool = False) dict[str, None | bool | int | float | str | datetime | dict[str, None | bool | int | float | str | datetime | dict[str, JsonEncodable] | list[JsonEncodable]] | list[None | bool | int | float | str | datetime | dict[str, JsonEncodable] | list[JsonEncodable]]] [source]#
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = True#
nkdsu.apps.vote.apps module#
nkdsu.apps.vote.context_processors module#
nkdsu.apps.vote.elfs module#
- nkdsu.apps.vote.elfs.ELFS_NAME = 'Elfs'#
The name of the group that elfs belong to
nkdsu.apps.vote.emoji module#
nkdsu.apps.vote.forms module#
- class nkdsu.apps.vote.forms.ClearableFileInput(attrs=None)[source]#
Bases:
ClearableFileInput
The stock clearable file widget generates HTML that cannot be easily laid out in a reasonable way with CSS. In particular, the way the ‘clear’ checkbox is not put in any kind of elements makes intentional layout basically impossible. Here, we aim to fix that.
- template_name = 'widgets/clearable_file_input.html'#
- property media#
- class nkdsu.apps.vote.forms.SearchForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
- base_fields = {'q': <django.forms.fields.CharField object>}#
- declared_fields = {'q': <django.forms.fields.CharField object>}#
- property media#
- class nkdsu.apps.vote.forms.TriviaForm(*args, **kwargs)[source]#
Bases:
Form
A form protected by a trivia question.
- base_fields = {'trivia': <django.forms.fields.CharField object>, 'trivia_question': <django.forms.fields.CharField object>}#
- declared_fields = {'trivia': <django.forms.fields.CharField object>, 'trivia_question': <django.forms.fields.CharField object>}#
- property media#
- class nkdsu.apps.vote.forms.BadMetadataForm(*args, track: Track, **kwargs)[source]#
Bases:
Form
- base_fields = {'details': <django.forms.fields.CharField object>}#
- declared_fields = {'details': <django.forms.fields.CharField object>}#
- property media#
- class nkdsu.apps.vote.forms.RequestForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
A form for requesting that a track be added to the library.
- base_fields = {'artist': <django.forms.fields.CharField object>, 'details': <django.forms.fields.CharField object>, 'role': <django.forms.fields.CharField object>, 'show': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
- declared_fields = {'artist': <django.forms.fields.CharField object>, 'details': <django.forms.fields.CharField object>, 'role': <django.forms.fields.CharField object>, 'show': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
- property media#
- class nkdsu.apps.vote.forms.VoteForm(*args, tracks: Sequence[Track], **kwargs)[source]#
Bases:
ModelForm
A form for creating a
models.Vote
.- class Meta[source]#
Bases:
object
- fields = ['text']#
- widgets = {'text': <django.forms.widgets.TextInput object>}#
- _meta = <django.forms.models.ModelFormOptions object>#
- base_fields = {'text': <django.forms.fields.CharField object>}#
- declared_fields = {}#
- property media#
- class nkdsu.apps.vote.forms.CheckMetadataForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
- base_fields = {'composer': <django.forms.fields.CharField object>, 'id3_artist': <django.forms.fields.CharField object>, 'id3_title': <django.forms.fields.CharField object>, 'year': <django.forms.fields.IntegerField object>}#
- declared_fields = {'composer': <django.forms.fields.CharField object>, 'id3_artist': <django.forms.fields.CharField object>, 'id3_title': <django.forms.fields.CharField object>, 'year': <django.forms.fields.IntegerField object>}#
- property media#
- class nkdsu.apps.vote.forms.LibraryUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
- base_fields = {'inudesu': <django.forms.fields.BooleanField object>, 'library_xml': <django.forms.fields.FileField object>}#
- declared_fields = {'inudesu': <django.forms.fields.BooleanField object>, 'library_xml': <django.forms.fields.FileField object>}#
- property media#
- class nkdsu.apps.vote.forms.MyriadExportUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
- base_fields = {'myriad_csv': <django.forms.fields.FileField object>}#
- declared_fields = {'myriad_csv': <django.forms.fields.FileField object>}#
- property media#
- class nkdsu.apps.vote.forms.NoteForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]#
Bases:
ModelForm
- _meta = <django.forms.models.ModelFormOptions object>#
- base_fields = {'content': <django.forms.fields.CharField object>, 'just_for_current_show': <django.forms.fields.BooleanField object>, 'public': <django.forms.fields.BooleanField object>}#
- declared_fields = {'just_for_current_show': <django.forms.fields.BooleanField object>}#
- property media#
- class nkdsu.apps.vote.forms.DarkModeForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#
Bases:
Form
- base_fields = {'mode': <django.forms.fields.ChoiceField object>}#
- declared_fields = {'mode': <django.forms.fields.ChoiceField object>}#
- property media#
nkdsu.apps.vote.managers module#
- class nkdsu.apps.vote.managers.NoteQuerySet(model=None, query=None, using=None, hints=None)[source]#
Bases:
QuerySet
- class nkdsu.apps.vote.managers.TrackQuerySet(model=None, query=None, using=None, hints=None)[source]#
Bases:
QuerySet
- _everything(show_secret_tracks: bool = False) TrackQuerySet [source]#
- for_decade(start_year: int) TrackQuerySet [source]#
- public() TrackQuerySet [source]#
- by_artist(artist: str, show_secret_tracks: bool = False) list[Track] [source]#
Filters with Python, so does not return a queryset and is not lazy.
- by_anime(anime: str, show_secret_tracks: bool = False) list[Track] [source]#
Behaves similarly to by_artist.
- search(query: str, show_secret_tracks: bool = False) TrackQuerySet [source]#
nkdsu.apps.vote.mastodon_instances module#
nkdsu.apps.vote.mixcloud module#
nkdsu.apps.vote.mixins module#
- class nkdsu.apps.vote.mixins.CurrentShowMixin[source]#
Bases:
ContextMixin
- class nkdsu.apps.vote.mixins.LetMemoizeGetObject[source]#
Bases:
SingleObjectMixin
A view mixin that allows objects to be memoized if, and only if, the base queryset is not overridden, so we can be confident that sequential retrievals would have been the same.
Helpful for views where
get_object()
is particularly expensive.
- class nkdsu.apps.vote.mixins.TrackListWithAnimeGrouping[source]#
Bases:
ContextMixin
- get_track_queryset() Sequence[Track] | TrackQuerySet [source]#
- class nkdsu.apps.vote.mixins.TrackListWithAnimeGroupingListView(**kwargs)[source]#
Bases:
TrackListWithAnimeGrouping
,ListView
- get_queryset() Sequence[Track] | TrackQuerySet [source]#
- class nkdsu.apps.vote.mixins.ShowDetailMixin[source]#
Bases:
LetMemoizeGetObject
A view that will find a show for any date in the past, redirect to the showtime date if necessary, and then render a view with the correct show in context.
- default_to_current = False#
- get_memoizable_object() Show [source]#
Get the show relating to
date
or, ifdate
isNone
, the most recent complete show. If self.default_to_current is True, get the show in progress rather than the most recent complete show.Doesn’t use
Show.at()
because I don’t want views creatingShow
instances in the database.
- class nkdsu.apps.vote.mixins.ThisShowDetailMixin[source]#
Bases:
ShowDetailMixin
Like ShowDetailMixin, but defaults to the show in progress when no date is provided.
- class nkdsu.apps.vote.mixins.ShowDetail(**kwargs)[source]#
Bases:
ShowDetailMixin
,DetailView
- class nkdsu.apps.vote.mixins.TwitterUserDetailMixin[source]#
Bases:
LetMemoizeGetObject
- model#
alias of
TwitterUser
- get_memoizable_object() TwitterUser [source]#
- class nkdsu.apps.vote.mixins.BrowseCategory(**kwargs)[source]#
Bases:
BreadcrumbMixin
,TemplateView
- template_name = 'browse_category.html'#
- context_category_name = 'items'#
- contents_required = True#
- searchable = True#
- abstract get_categories() Iterable[BrowsableItem] [source]#
- filter_categories(items: Iterable[BrowsableItem]) Iterable[BrowsableItem] [source]#
nkdsu.apps.vote.models module#
- class nkdsu.apps.vote.models.Show(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Serializable
,Model
A broadcast of the show and, by extention, the week leading up to it.
- showtime#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- end#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- message#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- voting_allowed#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod _at(time: datetime, create: bool = True) Show | None [source]#
Get (or create, if necessary) the show for time. Use .at() instead.
- classmethod at(time: datetime) Show [source]#
Get the show for the date specified, creating every intervening show in the process if necessary.
- broadcasting(time: datetime | None = None) bool [source]#
Return
True
if the time specified is during this week’s show.
- next(*a, **k)#
- prev(*a, **k)#
- _date_kwargs(attr: str = 'date') dict[str, datetime] [source]#
The kwargs you would hand to a queryset to find objects applicable to this show. Should not be used unless you’re doing something that can’t use a .show ForeignKey.
- tracks_sorted_by_votes(*a, **k)#
- revealed(*a, **k)#
- cloudcasts(*a, **k)#
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- _meta = <Options for Show>#
- block_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- discard_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)#
- get_next_by_showtime(*, field=<django.db.models.fields.DateTimeField: showtime>, is_next=True, **kwargs)#
- get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)#
- get_previous_by_showtime(*, field=<django.db.models.fields.DateTimeField: showtime>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- note_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>#
- play_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- proroulettecommitment_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- shortlist_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- vote_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class nkdsu.apps.vote.models.TwitterUser(id, screen_name, user_id, name, is_patron, is_abuser, updated)[source]#
Bases:
Voter
,CleanOnSaveMixin
,Model
- is_twitteruser = True#
- screen_name#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name: str | CharField#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_patron: bool | BooleanField#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_abuser: bool | BooleanField#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- _meta = <Options for TwitterUser>#
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)#
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- profile#
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- userbadge_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- vote_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class nkdsu.apps.vote.models.Profile(id, user, twitter_user, avatar, display_name, is_patron, is_abuser)[source]#
Bases:
Voter
,CleanOnSaveMixin
,Model
- user#
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- twitter_user#
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- avatar#
Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
- display_name#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_patron: bool | BooleanField#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_abuser: bool | BooleanField#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_websites() Iterable[UserWebsite] [source]#
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- _meta = <Options for Profile>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- twitter_user_id#
- user_id#
- userbadge_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- websites#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class nkdsu.apps.vote.models.UserWebsite(id, url, profile)[source]#
Bases:
CleanOnSaveMixin
,Model
- url#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- profile#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- property kind: Literal['_website', 'anilist', 'bsky', 'cohost', 'facebook', 'instagram', 'linkedin', 'mastodon', 'myanimelist', 'nkdsu', 'threads', 'tumblr', 'twitch', 'twitter', 'x', 'youtube']#
Return an appropriate identify for for what kind of URL this is.
>>> UserWebsite(url='https://someone.tumblr.com').kind 'tumblr' >>> UserWebsite(url='https://tumblr.com/someone').kind 'tumblr' >>> UserWebsite(url='https://cohost.org/someone').kind 'cohost' >>> UserWebsite(url='https://www.instagram.com/someone').kind 'instagram' >>> UserWebsite(url='https://plush.city/@someone').kind 'mastodon' >>> UserWebsite(url='https://website.tld').kind '_website'
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for UserWebsite>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- profile_id#
- class nkdsu.apps.vote.models.UserTrackList(id, user, name, description, public, icon)[source]#
Bases:
CleanOnSaveMixin
,Model
- user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- name#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- public#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- icon#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- tracks: ManyToManyField#
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for UserTrackList>#
- get_icon_display(*, field=<django.db.models.fields.CharField: icon>)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- user_id#
- usertracklisttrack_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class nkdsu.apps.vote.models.UserTrackListTrack(id, track, track_list, index)[source]#
Bases:
CleanOnSaveMixin
,Model
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track_list#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- index#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for UserTrackListTrack>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- track_id#
- track_list_id#
- class nkdsu.apps.vote.models.Track(id, id3_title, id3_artist, id3_album, msec, added, composer, label, year, media_id, has_hook, revealed, archived, hidden, inudesu, background_art, metadata_locked)[source]#
Bases:
CleanOnSaveMixin
,Serializable
,Model
- objects = <django.db.models.manager.ManagerFromTrackQuerySet object>#
- note_set: RelatedManager[Note]#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- play_set: RelatedManager[Play]#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- vote_set: RelatedManager[Vote]#
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id3_title#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id3_artist#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id3_album#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- msec#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- added#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- composer#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- label#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- year#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- media_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- has_hook#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- revealed#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- archived#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- inudesu#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- background_art#
Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
- metadata_locked#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- artists(*a, **k)#
- composers(*a, **k)#
- ineligible() str | None [source]#
Return a string describing why a track is ineligible, or
None
if it is not.
- votes_for(*a, **k)#
- notes() NoteQuerySet [source]#
- public_notes() NoteQuerySet [source]#
- musicbrainz_release(*a, **k)#
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- _meta = <Options for Track>#
- block_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- discard_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)#
- get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)#
- proroulettecommitment_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- request_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- shortlist_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- usertracklist_set#
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- usertracklisttrack_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- nkdsu.apps.vote.models.MANUAL_VOTE_KINDS = (('email', 'email'), ('discord', 'discord'), ('text', 'text'), ('tweet', 'tweet'), ('person', 'in person'), ('phone', 'on the phone'))#
The kinds of vote that can be imported manually
- class nkdsu.apps.vote.models.VoteKind(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- local = 1#
A request made using the website’s built-in requesting machinery.
- twitter = 2#
A historical request, initially derived from a tweet we received via the Twitter API.
- manual = 3#
A request manually created by an admin to reflect, for example, an email.
- class nkdsu.apps.vote.models.Vote(id, date, show, text, user, twitter_user, tweet_id, name, kind)[source]#
Bases:
SetShowBasedOnDateMixin
,CleanOnSaveMixin
,Model
- tracks: ManyToManyField#
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- show: ForeignKey#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- text#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- twitter_user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- tweet_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- kind#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property hat: UserBadge | None#
Get the most important badge for a given vote, where the most important badge is the last one defined in
BADGES
that we are currently within the time range of.
- success(*a, **k)#
- weight(*a, **k)#
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Vote>#
- get_kind_display(*, field=<django.db.models.fields.CharField: kind>)#
- get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)#
- get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- twitter_user_id#
- user_id#
- class nkdsu.apps.vote.models.Play(*args, **kwargs)[source]#
Bases:
SetShowBasedOnDateMixin
,CleanOnSaveMixin
,Model
A record that a
Track
was played on the show.- date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- show: ForeignKey#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- tweet_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Play>#
- get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)#
- get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- track_id#
- class nkdsu.apps.vote.models.Block(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
A particular track that we are not going to allow to be voted for on particular show.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- reason#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- show#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Block>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- track_id#
- class nkdsu.apps.vote.models.Shortlist(id, show, track, index)[source]#
Bases:
CleanOnSaveMixin
,Model
- show#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- index#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Shortlist>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- track_id#
- class nkdsu.apps.vote.models.Discard(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
A track that we’re not going to play, but that we don’t want to make public that we’re not going to play.
- show#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Discard>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- track_id#
- class nkdsu.apps.vote.models.Request(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
A request for a database addition or modification.
- METADATA_KEYS = ['trivia', 'trivia_question', 'contact']#
keys of
blob
that no longer get set, but which may exist on historicRequest
s
- created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- blob#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- submitted_by#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- filled#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- filled_by#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- claimant#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- property active_shelving: ElfShelving | None#
- property is_shelved: bool#
>>> from django.utils import timezone >>> user = User.objects.create() >>> request = Request(blob='{}') >>> request.save() >>> request.is_shelved False >>> shelving = ElfShelving.objects.create(request=request, created_by=user) >>> del request.active_shelving # to make @cached_property forget the cached response >>> request.is_shelved True >>> shelving.disabled_at = timezone.now() >>> shelving.save() >>> del request.active_shelving >>> request.is_shelved False
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Request>#
- claimant_id#
- filled_by_id#
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)#
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- shelvings#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- submitted_by_id#
- track_id#
- class nkdsu.apps.vote.models.ElfShelving(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
An expression by a elf that a
Request
cannot befilled
at the moment.- request#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_at#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- reason_created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- disabled_at#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- disabled_by#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- reason_disabled#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for ElfShelving>#
- created_by_id#
- disabled_by_id#
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)#
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- request_id#
- class nkdsu.apps.vote.models.Note(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
A note about whatever for a particular track.
- objects = <django.db.models.manager.ManagerFromNoteQuerySet object>#
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- show#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- public#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for Note>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- show_id#
- track_id#
- class nkdsu.apps.vote.models.ProRouletteCommitment(*args, **kwargs)[source]#
Bases:
CleanOnSaveMixin
,Model
A commitment from a given user to only use
Roulette
in ‘pro’ mode until the current show ends. Retains the track they committed to and when the commitment was made.- show#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- track#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_at#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for ProRouletteCommitment>#
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)#
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- show_id#
- track_id#
- user_id#
- class nkdsu.apps.vote.models.Badge(slug: 'str', description_fmt: 'str', summary: 'str', icon: 'str', url: 'str', start: 'Optional[datetime.datetime]', finish: 'Optional[datetime.datetime]')[source]#
Bases:
object
- info(user: Voter) BadgeInfoForUser [source]#
- nkdsu.apps.vote.models.BADGES: list[Badge] = [Badge(slug='tblc', description_fmt='{name} bought Take Back Love City for the RSPCA.', summary='put up with bad music for animals', icon='headphones', url='https://desus.bandcamp.com/album/take-back-love-city', start=None, finish=datetime.datetime(1990, 1, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2016', description_fmt='{name} donated to the Very Scary Scenario charity streams for Special Effect in 2016.', summary='likes fun, hates exclusion', icon='heart', url='https://www.justgiving.com/fundraising/very-scary-scenario', start=datetime.datetime(2016, 10, 15, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2016, 11, 15, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2017', description_fmt='{name} donated to the Very Scary Scenario charity streams and Neko Desu All-Nighter for Cancer Research UK in 2017.', summary='likes depriving people of sleep, hates cancer', icon='heart', url='https://www.justgiving.com/fundraising/very-charity-scenario-2017', start=datetime.datetime(2017, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2017, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2018', description_fmt='{name} donated to the Very Scary Scenario charity streams for Cancer Research UK in 2018.', summary='likes depriving people of sleep, hates cancer', icon='medkit', url='https://www.justgiving.com/fundraising/very-charity-scenario-2018', start=datetime.datetime(2018, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2018, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2019', description_fmt='{name} donated to the Very Scary Scenario charity streams for Samaritans in 2019.', summary='likes depriving people of sleep, fan of good mental health', icon='life-ring', url='https://www.justgiving.com/fundraising/very-charity-scenario-2019', start=datetime.datetime(2019, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2019, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2020', description_fmt='{name} donated to the Very Scary Scenario charity streams for Cancer Research UK in 2020.', summary='donated to the 2020 Very Scary Scenario charity streams', icon='heartbeat', url='https://www.justgiving.com/fundraising/very-charity-scenario-2020', start=datetime.datetime(2020, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2020, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2021', description_fmt='{name} donated to the Very Scary Scenario charity streams for Mind in 2021.', summary='donated to the 2021 Very Scary Scenario charity streams', icon='brain', url='https://www.justgiving.com/fundraising/very-charity-scenario-2021', start=datetime.datetime(2021, 10, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2021, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2022', description_fmt='{name} donated to the Very Scary Scenario charity streams for akt in 2022.', summary='donated to the 2022 Very Scary Scenario charity streams', icon='home', url='https://www.justgiving.com/fundraising/very-charity-scenario-2022', start=datetime.datetime(2022, 10, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2022, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2023', description_fmt='{name} donated to the Very Scary Scenario charity streams and Neko Desu All-Nighter for the National Autistic Society in 2023.', summary='donated to the 2023 Very Scary Scenario charity streams', icon='infinity', url='https://www.justgiving.com/page/very-charity-scenario-2023', start=datetime.datetime(2023, 9, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2023, 12, 2, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')))]#
A list of accolades we can give to users for showing off on user pages and, during a specified time range, against every
Vote
they make.
- class nkdsu.apps.vote.models.UserBadge(id, badge, twitter_user, profile)[source]#
Bases:
CleanOnSaveMixin
,Model
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- _meta = <Options for UserBadge>#
- get_badge_display(*, field=<django.db.models.fields.CharField: badge>)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- profile_id#
- twitter_user_id#
- badge#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- twitter_user#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- profile#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- property badge_info: BadgeInfoForUser#
nkdsu.apps.vote.myriad_export module#
Tools for interacting with CSV exports of the library from Myriad Playout.
nkdsu.apps.vote.parsers module#
- class nkdsu.apps.vote.parsers.ParsedArtist(chunks: list[nkdsu.apps.vote.parsers.ArtistChunk], should_collapse: bool)[source]#
Bases:
object
- chunks: list[ArtistChunk]#
- class nkdsu.apps.vote.parsers.ArtistLexer[source]#
Bases:
Lexer
- tokens = {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}#
- SPECIAL_CASE = '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$'#
- VIA = "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+"#
- LPAREN = '(?<=\\s)\\('#
- RPAREN = '\\)(?=\\s|,|\\)|$)'#
- CV = '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|='#
- COMMA = ',(\\sand)?\\s+'#
- SPACE = '\\s+'#
- ARTIST_COMPONENT = "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)"#
- _attributes = {'ARTIST_COMPONENT': "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)", 'COMMA': ',(\\sand)?\\s+', 'CV': '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|=', 'LPAREN': '(?<=\\s)\\(', 'RPAREN': '\\)(?=\\s|,|\\)|$)', 'SPACE': '\\s+', 'SPECIAL_CASE': '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$', 'VIA': "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+", '__module__': 'nkdsu.apps.vote.parsers', '__qualname__': 'ArtistLexer', 'tokens': {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}}#
- _before = {}#
- _delete = ['_', 'before']#
- _ignored_tokens = {}#
- _master_re = re.compile("(?P<SPECIAL_CASE>^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$)|(?P<VIA>\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+)|(?)#
- _remap = {}#
- _remapping = {}#
- _rules = [('SPECIAL_CASE', '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$'), ('VIA', "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+"), ('LPAREN', '(?<=\\s)\\('), ('RPAREN', '\\)(?=\\s|,|\\)|$)'), ('CV', '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|='), ('COMMA', ',(\\sand)?\\s+'), ('SPACE', '\\s+'), ('ARTIST_COMPONENT', "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)")]#
- _token_funcs = {}#
- _token_names = {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}#
- nkdsu.apps.vote.parsers.handle_special_case(token) Iterable[ArtistChunk] [source]#
- nkdsu.apps.vote.parsers.chunk_artist(string: str, fail_silently: bool = True) Iterable[ArtistChunk] [source]#
Return a bunch of
ArtistChunk
s which, when combined, reform the string handed in.
- nkdsu.apps.vote.parsers.parse_artist(string: str, fail_silently: bool = True) ParsedArtist [source]#
nkdsu.apps.vote.placeholder_avatars module#
nkdsu.apps.vote.signals module#
nkdsu.apps.vote.trivia module#
nkdsu.apps.vote.twitter_auth module#
- exception nkdsu.apps.vote.twitter_auth.DoNotAuthThroughTwitterPlease(msg: str)[source]#
Bases:
BaseException
- class nkdsu.apps.vote.twitter_auth.NkdsuTwitterAuth(*args, **kwargs)[source]#
Bases:
TwitterOAuth
- auth_allowed(response: dict, details: UserDetailsDict) bool [source]#
- get_user_details(response: dict) UserDetailsDict [source]#
Like super().get_user_details(), but doesn’t try to split names into first and last parts.
- class nkdsu.apps.vote.twitter_auth.NkdsuStrategy(storage, request=None, tpl=None)[source]#
Bases:
DjangoStrategy
Django social auth respects the “PIPELINE” Django setting, which we’re already using for django-pipeline, so we need to override that behaviour to ignore it.
- nkdsu.apps.vote.twitter_auth.link_twitteruser(uid: int, user: User, is_new: bool, *args, **kwargs) None [source]#
- nkdsu.apps.vote.twitter_auth.adopt_twitter_metadata(request: HttpRequest, user: User, details: UserDetailsDict, *args, **kwargs) None [source]#
nkdsu.apps.vote.update_library module#
- nkdsu.apps.vote.update_library.check_closeness_against_list(name, canonical_names: Iterable[str], reverse: bool = False) str | None [source]#
- class nkdsu.apps.vote.update_library.MetadataWarning[source]#
Bases:
TypedDict
A warning about a potential problem with a proposed metadata update.
- class nkdsu.apps.vote.update_library.MetadataChange[source]#
Bases:
TypedDict
- changes: list[FieldAlteration]#
- warnings: list[MetadataWarning]#
- nkdsu.apps.vote.update_library.check_artist_consistency(track_artists: Iterable[str], all_artists: Iterable[str], field: Literal['added', 'album', 'anime', 'artist', 'composer', 'msec', 'role', 'title', 'year']) list[MetadataWarning] [source]#
- nkdsu.apps.vote.update_library.metadata_consistency_checks(db_track: Track, all_anime_titles: Iterable[str], all_artists: Iterable[str], all_composers: Iterable[str]) list[MetadataWarning] [source]#
Take a proposed update to the library, and check it for various types of things that might be wrong with it.
nkdsu.apps.vote.urls module#
nkdsu.apps.vote.utils module#
- class nkdsu.apps.vote.utils.BrowsableItem(url: 'Optional[str]', name: 'str', visible: 'bool' = True)[source]#
Bases:
object
- class nkdsu.apps.vote.utils.BrowsableYear(url: 'Optional[str]', name: 'str', visible: 'bool' = True)[source]#
Bases:
BrowsableItem
- nkdsu.apps.vote.utils.length_str(msec: float) str [source]#
Convert a number of milliseconds into a human-readable representation of the length of a track.
>>> length_str(999) '0:00' >>> length_str(1000) '0:01' >>> length_str(1000 * (60 + 15)) '1:15' >>> length_str(1000 * (60 + 15)) '1:15' >>> length_str((60 * 60 * 1000) + (1000 * (60 + 15))) '1:01:15'
- nkdsu.apps.vote.utils.camel_to_snake(camel: str) str [source]#
>>> camel_to_snake('camelCaseABCD') 'camel_case_a_b_c_d'
- nkdsu.apps.vote.utils.track_with_get_param_url(tracks: Iterable[Track], url: str) str [source]#
Generate a URL for a view that uses
TracksFromGetParamMixin
.
- nkdsu.apps.vote.utils.split_id3_title(id3_title: str) tuple[str, str | None] [source]#
Take a ‘Title (role)’-style ID3 title and return
(title, role)
.>>> split_id3_title('title') ('title', None) >>> split_id3_title('title (role)') ('title', 'role')
The role will be populated if we’re able to find a set of matching brackets starting with the final character:
>>> split_id3_title('title ((role)') ('title (', 'role') >>> split_id3_title('title ((r(o)(l)e)') ('title (', 'r(o)(l)e')
But no role will be returned if the brackets close more than they open, or if the final character is not a
)
:>>> split_id3_title('title (role) ') ('title (role) ', None) >>> split_id3_title('title (role))') ('title (role))', None)
- nkdsu.apps.vote.utils.split_query_into_keywords(query: str) list[str] [source]#
Split the query into keywords. Where keywords are double quoted together, use as one keyword.
>>> split_query_into_keywords('hello there, how are you doing') ['hello', 'there,', 'how', 'are', 'you', 'doing'] >>> split_query_into_keywords('hello there, "how are you doing"') ['how are you doing', 'hello', 'there,']
nkdsu.apps.vote.voter module#
- class nkdsu.apps.vote.voter.ModelVoterMeta(name, bases, namespace, /, **kwargs)[source]#
Bases:
_ProtocolMeta
,ModelBase
- class nkdsu.apps.vote.voter.Voter(*args, **kwargs)[source]#
Bases:
Protocol
- property voter_id: tuple[int | None, int | None]#
A unique identifier that will be the same for TwitterUser and Profile instances that represent the same accounts.
- get_websites() Iterable[UserWebsite] [source]#
- batting_average(minimum_weight: float = 1) float | None [source]#
Return a user’s batting average for the past six months.
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = True#