Set of django apps for teams and invitations
This library uses django-rest-auth
, djangorestframework
, and djangorestframework-jsonapi
.
krit-authentication
is also a dependency so you do not need to install it seperately.
Current version: 0.1.3
Until djangorestframework-jsonapi
supports Django 2.0, only Django 1.11 is supported. django-json-api/django-rest-framework-json-api#397
pip install git+https://github.com/builtbykrit/[email protected] --process-dependency-links
- Add
krit.teams
,krit.invitations
,krit.authentication
andkrit.registration
to your apps - Add
krit.teams.urls
,krit.authentication.urls
,krit.registration.urls
, andkrit.invitations.urls
to your urlpatterns. Add them to the bottom of the list if you need to override them.
Models
- Invitations
Serializers
- InvitationCreateSerializer
- InvitationRetrieveSerializer
Views
- InvitationDetailView
URLS
url(r'^(?P<pk>[0-9]+)/$', InvitationDetailView.as_view(), name='invitations-detail')
Settings None
Models
- Team
- Membership
Both of these models inherit from a base class. If you want to extend these models, you can subclass BaseTeam
or BaseMembership
and add your properties and methods. Make sure your subclass is an abstract model. Then in your settings, set KRIT_TEAMS_BASE_TEAM_MODEL
or KRIT_TEAMS_BASE_MEMBERSHIP_MODEL
to the path of your subclass. To store the migrations in your project instead of the library add MIGRATION_MODULES = {'krit_teams': 'krit_teams.migrations'}
to your settings and add a krit_teams
folder in your project.
Serializers
- TeamSerializer
- MembershipSerializer
If you extend the existing models, you'll need to subclass the serializers to add your new fields.
Views
- TeamCreateView
- TeamInviteView
- TeamRetrieveView
URLS
url(r'^$', TeamCreateView.as_view(), name="teams-create"),
url(r"^(?P<pk>[0-9]+)/$", TeamRetrieveView.as_view(), name="teams-detail"),
url(r"^(?P<pk>[0-9]+)/invite-user/$", TeamInviteView.as_view(), name="teams-invite-user")
Settings
- KRIT_TEAMS_BASE_TEAM_MODEL
- KRIT_TEAMS_BASE_MEMBERSHIP_MODEL
- KRIT_TEAMS_ROLE_MEMBER
- KRIT_TEAMS_ROLE_OWNER
- KRIT_TEAMS_ROLE_CHOICES
- You can provide an array of custom roles. Make sure to include
KRIT_TEAMS_ROLE_MEMBER
andKRIT_TEAMS_ROLE_OWNER
in your choices.
- You can provide an array of custom roles. Make sure to include