groups package

The app that handles groups.

Subpackages

Submodules

groups.admin module

Admin models for the groups app.

class groups.admin.MemberRoleInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.StackedInline

Inline admin model for Role.

model

alias of groups.models.Role

extra = 1
get_formset(request, obj, **kwargs)[source]

Return a BaseInlineFormSet class for use in admin add/change views.

Parameters
Return type

BaseInlineFormSet

class groups.admin.MemberAdmin(model, admin_site)[source]

Bases: django.contrib.admin.ModelAdmin

Admin model for Member.

inlines = (<class 'groups.admin.MemberRoleInline'>,)
ordering = (Lower(F(name)),)
sortable_by = ('name',)
list_display = ('name', '_twitter', 'discord', 'irc', '_reddit')
search_fields = ('name', 'twitter', 'discord', 'irc', 'reddit')
list_filter = (('roles__group__name', <class 'MangAdventure.filters.title_filter.<locals>._GenericFilter'>), ('roles__role', <class 'MangAdventure.filters.title_filter.<locals>._GenericFilter'>))
class groups.admin.GroupAdmin(model, admin_site)[source]

Bases: django.contrib.admin.ModelAdmin

Admin model for Group.

exclude = ('id',)
ordering = (Lower(F(name)),)
sortable_by = ('name',)
list_display = ('image', 'name', '_website', 'manager', 'description')
search_fields = ('name', 'website', 'description')
list_filter = (('manager', <class 'MangAdventure.filters.title_filter.<locals>._GenericFilter'>),)
empty_value_display = 'N/A'
get_form(request, obj=None, change=False, **kwargs)[source]

Return a Form class for use in the admin add view. This is used by add_view and change_view.

Parameters
Return type

ModelForm

image(obj)[source]

Get the logo of the group as an HTML <img>.

Parameters

obj (Group) – A Group model instance.

Return type

str

Returns

An <img> tag with the group’s logo.

has_change_permission(request, obj=None)[source]

Return True if editing the object is permitted.

Superusers can edit any group.
Scanlators can only edit groups they manage.
Parameters
Return type

bool

Returns

True if the user is allowed to edit the group.

has_delete_permission(request, obj=None)[source]

Return True if deleting the object is permitted.

Superusers can delete any group.
Scanlators can only delete groups they manage.
Parameters
Return type

bool

Returns

True if the user is allowed to delete the group.

groups.api module

API viewsets for the groups app.

class groups.api.GroupViewSet(**kwargs)[source]

Bases: api.v2.mixins.CORSMixin, rest_framework.viewsets.ModelViewSet

API endpoints for groups.

  • list: List groups.

  • read: View a certain group.

  • create: Create a new group.

  • update: Update the given author.

  • patch: Edit the given group.

  • delete: Delete the given group.

schema

OpenAPISchema – Custom OpenAPI schema class.

queryset = QuerySet
serializer_class

alias of groups.serializers.GroupSerializer

parser_classes = (<class 'rest_framework.parsers.MultiPartParser'>,)
basename = None
description = None
detail = None
name = None
suffix = None

groups.apps module

App configuration.

class groups.apps.GroupsConfig(app_name, app_module)[source]

Bases: django.apps.AppConfig

Configuration for the groups app.

name = 'groups'

str – The name of the app.

groups.feeds module

RSS and Atom feeds for the groups app.

class groups.feeds.GroupRSS[source]

Bases: django.contrib.syndication.views.Feed

RSS feed for a group’s releases.

ttl = 600
author_name = 'MangAdventure'
get_object(request, g_id)[source]

Get a Group object from the request.

Parameters
  • request (HttpRequest) – The original request.

  • g_id (int) – The id of the group.

Return type

Group

Returns

The group that has the given id.

Get the link of the feed’s page.

Parameters

obj (Group) – The object of the feed.

Return type

str

Returns

The URL of the group.

title(obj)[source]

Get the title of the feed.

Parameters

obj (Group) – The object of the feed.

Return type

str

Returns

The name of the group.

description(obj)[source]

Get the description of the feed.

Parameters

obj (Group) – The object of the feed.

Return type

str

Returns

A description with the name of the group.

items(obj)[source]

Get an iterable of the feed’s items.

Parameters

obj (Group) – The object of the feed.

Return type

Iterable[Chapter]

Returns

An iterable of Chapter objects.

item_description(item)[source]

Get the description of the item.

Parameters

item (Chapter) – A Chapter object.

Return type

str

Returns

The Chapter object as a string.

item_pubdate(item)[source]

Get the publication date of the item.

Parameters

item (Chapter) – A Chapter object.

Return type

datetime

Returns

The date the chapter was published.

item_updateddate(item)[source]

Get the update date of the item.

Parameters

item (Chapter) – A Chapter object.

Return type

datetime

Returns

The date the chapter was modified.

class groups.feeds.GroupAtom[source]

Bases: groups.feeds.GroupRSS

Atom feed for a group’s releases.

feed_type

alias of django.utils.feedgenerator.Atom1Feed

subtitle(obj)

Get the description of the feed.

Parameters

obj (Group) – The object of the feed.

Return type

str

Returns

A description with the name of the group.

groups.models module

Database models for the groups app.

class groups.models.Group(*args, **kwargs)[source]

Bases: django.db.models.Model

A model representing a group.

name

CharField – The group’s name.

website

URLField – The group’s website.

description

TextField – The group’s description.

email

EmailField – The group’s e-mail address.

discord

DiscordURLField – The Discord server URL of the group.

twitter

TwitterField – The Twitter username of the group.

irc

CharField – The group’s IRC.

reddit

RedditField – The Reddit username or subreddit name of the group.

ImageField – The group’s logo.

manager

ForeignKey – The person who manages this group.

get_absolute_url()[source]

Get the absolute URL of the object.

Return type

str

Returns

The URL of groups.views.group().

get_directory()[source]

Get the storage directory of the object.

Return type

PurePath

Returns

A path relative to MEDIA_ROOT.

__str__()[source]

Return a string representing the object.

Return type

str

Returns

The name of the group.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

objects = <django.db.models.manager.Manager object>
class groups.models.Member(*args, **kwargs)[source]

Bases: django.db.models.Model

A model representing a member.

name

CharField – The name of the member.

twitter

TwitterField – The member’s Twitter username.

discord

DiscordNameField – The member’s Discord username and discriminator.

irc

CharField – The member’s IRC username.

reddit

RedditField – The member’s Reddit username.

get_roles(group)[source]

Get the roles of the member in the given group.

Parameters

group (Group) – A group instance.

Return type

str

Returns

A comma-separated list of roles.

__str__()[source]

Return a string representing the object.

Return type

str

Returns

The name of the member.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

objects = <django.db.models.manager.Manager object>
class groups.models.Role(*args, **kwargs)[source]

Bases: django.db.models.Model

A model representing a role.

class Choices(value)[source]

Bases: enum.Enum

The possible role choices.

LD = 'Leader'
TL = 'Translator'
PR = 'Proofreader'
CL = 'Cleaner'
RD = 'Redrawer'
TS = 'Typesetter'
RP = 'Raw Provider'
QC = 'Quality Checker'
member

ForeignKey – The member this role belongs to.

group

ForeignKey – The group this role belongs to.

role

CharField – The value of the role.

__str__()[source]

Return a string representing the object.

Return type

str

Returns

The name and group of the role.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

get_role_display(*, field=<django.db.models.CharField: role>)
objects = <django.db.models.manager.Manager object>

groups.serializers module

Model serializers for the groups app.

TODO

Add a serializer for members.

class groups.serializers.GroupSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

Serializer for groups.

create(validated_data)[source]

Create a new Group instance.

Parameters

validated_data (Dict) –

Return type

Group

class Meta[source]

Bases: object

model

alias of groups.models.Group

fields = ('id', 'name', 'website', 'description', 'email', 'discord', 'twitter', 'reddit', 'irc', 'logo', 'members')
extra_kwargs = {'id': {'help_text': 'The unique ID of the group.', 'min_value': 1, 'read_only': True}}

groups.urls module

The URLconf of the groups app.

groups.urls.app_name = 'groups'

The URL namespace of the groups app.

groups.urls.urlpatterns = [<URLPattern '' [name='all_groups']>, <URLPattern '<int:g_id>/' [name='group']>, <URLPattern '<int:g_id>.atom' [name='group.atom']>, <URLPattern '<int:g_id>.rss' [name='group.rss']>]

The URL patterns of the groups app.

groups.views module

The views of the users app.

groups.views.all_groups(request)[source]

View that serves a page with all the groups.

Parameters

request (HttpRequest) – The original request.

Return type

HttpResponse

Returns

A response with the rendered all_groups.html template.

groups.views.group(request, g_id)[source]

View that serves a single group’s page.

Parameters
  • request (HttpRequest) – The original request.

  • g_id (int) – The ID of the group.

Return type

HttpResponse

Returns

A response with the rendered group.html template.

Raises

Http404 – If the group does not exist.