No project description provided
Project description
Garpix Company
Company module for Django/DRF projects.
Quickstart
Install with pip:
pip install garpix_company
Add the garpix_company
to your INSTALLED_APPS
:
# settings.py
# ...
INSTALLED_APPS = [
# ...
'garpix_company',
]
and to migration modules:
# settings.py
# ...
MIGRATION_MODULES = {
'garpix_company': 'app.migrations.garpix_company',
}
Add to urls.py
:
# ...
urlpatterns = [
# ...
# garpix_user
path('', include(('garpix_company.urls', 'garpix_company'), namespace='garpix_company')),
]
Add Company model to your project using abstract AbstractCompany
from the model:
from garpix_company.models import AbstractCompany
class Company(AbstractCompany):
pass
Add GARPIX_COMPANY_MODEL
to settings.py
:
# settings.py
GARPIX_COMPANY_MODEL = 'app.Company'
Use CompanyAdmin
as base in your admin panel:
from django.contrib import admin
from app.models import Company
from garpix_company.admin import CompanyAdmin
@admin.register(Company)
class CompanyAdmin(CompanyAdmin):
pass
Invite and create user
You can add fields to company_invite/create_and_invite
endpoint.
To do it override CreateAndInviteToCompanySerializer
by adding field and add it to settings
:
# settings.py
GARPIX_COMPANY_CREATE_AND_INVITE_SERIALIZER = 'app.serializers.CustomInviteCompanySerializer'
# app.serializers.py
from rest_framework import serializers
from garpix_company.serializers import CreateAndInviteToCompanySerializer
class CustomInviteCompanySerializer(CreateAndInviteToCompanySerializer):
username = serializers.CharField(write_only=True)
class Meta(CreateAndInviteToCompanySerializer.Meta):
fields = CreateAndInviteToCompanySerializer.Meta.fields + ('username',)
See garpix_company/tests/test_company.py
for examples.
Changelog
Смотри CHANGELOG.md.
Contributing
Смотри CONTRIBUTING.md.
License
Developed by Garpix / https://garpix.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for garpix_company-1.0.0rc3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f96b09651e9de8337b0d6666a8c49cab93828416e85c81ec13ff975b19a7502c |
|
MD5 | 8e8e07724bd327b7d85230b491910bb8 |
|
BLAKE2b-256 | fffe76f89ef97ff9377fc86b5da95d6ec0509ba5998d2757a7ed8b773735898c |