Base ticket app for Django projects
Project description
Base tickets application for Django projects
Setup
1. Install using pip:
pip install ngits-tickets
2. Change your settings file:
INSTALLED_APPS = [
...
"rest_framework",
"rest_framework.authtoken",
"tickets"
]
...
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.TokenAuthentication",
],
# Optional path to custom TextChoices class
"DEFAULT_SCHEMA_CLASS": "myapp.consts.MyTypes",
}
...
# Optional
TYPE_CHOICES_PATH = "path.to.MyCustomTypeChoices"
3. Create custom ticket types (optional):
./consts.py
from django.db.model import TextChoices
class MyTypes(TextChoices):
foo = "foo"
bar = "bar"
4. Add paths to your urls.py file:
from django.urls import path, include
urlpatterns = [
...
path("/", include("tickets.urls")),
]
5. Run migrations:
py manage.py migrate
6. Optional redoc configuration:
pip install drf-spectacular==0.23.*
settings.py:
INSTALLED_APPS = [
...
"drf_spectacular"
]
SPECTACULAR_SETTINGS = {
"TITLE": "<proj_name> API",
"VERSION": "1.0.0",
}
TEMPLATES = [
...
'DIRS': [ BASE_DIR / "templates"],
...
]
../<django_project>/templates/redoc.html:
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<!-- ReDoc doesn't change outer page styles -->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='{% url schema_url %}'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ngits_tickets-2.0.1.tar.gz
(5.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ngits_tickets-2.0.1.tar.gz.
File metadata
- Download URL: ngits_tickets-2.0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a56a2741f75fae2fb499785a85e2dc3cedcf7473f8526afb54c722c6bde4a3f8
|
|
| MD5 |
8bd3b4545254f9a0b75022136862c54a
|
|
| BLAKE2b-256 |
3092e9c8c066e10134db0fe09e4a3345b382d8037242859a00fe7c670dac5ca7
|
File details
Details for the file ngits_tickets-2.0.1-py3-none-any.whl.
File metadata
- Download URL: ngits_tickets-2.0.1-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b76ad481f875532f61af76be27f9e9146eb8ee9adff9ee2f08ece78debd9e27
|
|
| MD5 |
a316cbf4796f6ac97767e15404da79f4
|
|
| BLAKE2b-256 |
10fedf5c2c2d240a150a2a0ab501138df4c228d5a112b21f8de443ca6050b4fa
|