Compare commits

..

2 Commits

4 changed files with 73 additions and 6 deletions

70
django.yml Normal file
View File

@ -0,0 +1,70 @@
name: django
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- asgiref=3.8.1=py312h06a4308_0
- brotli-python=1.0.9=py312h6a678d5_8
- bzip2=1.0.8=h5eee18b_6
- ca-certificates=2024.12.31=h06a4308_0
- certifi=2025.1.31=py312h06a4308_0
- charset-normalizer=3.3.2=pyhd3eb1b0_0
- django=5.1.3=py312h06a4308_0
- expat=2.6.4=h6a678d5_0
- gunicorn=22.0.0=py312h06a4308_0
- idna=3.7=py312h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- libuuid=1.41.5=h5eee18b_0
- markdown=3.4.1=py312h06a4308_0
- ncurses=6.4=h6a678d5_0
- openssl=3.0.15=h5eee18b_0
- pip=24.2=py312h06a4308_0
- pysocks=1.7.1=py312h06a4308_0
- python=3.12.8=h5148396_0
- readline=8.2=h5eee18b_0
- requests=2.32.3=py312h06a4308_1
- setuptools=75.1.0=py312h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- sqlparse=0.4.4=py312h06a4308_0
- tk=8.6.14=h39e8969_0
- tzdata=2024b=h04d1e81_0
- urllib3=2.2.3=py312h06a4308_0
- wheel=0.44.0=py312h06a4308_0
- xz=5.4.6=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==24.3.0
- defusedxml==0.7.1
- django-cors-headers==4.6.0
- django-extensions==3.2.3
- django-filter==24.3
- django-rest-knox==5.0.2
- djangorestframework==3.15.2
- djangorestframework-simplejwt==5.3.1
- djangorestframework-xml==2.0.0
- djangorestframework-yaml==2.0.0
- drf-spectacular==0.28.0
- drf-spectacular-sidecar==2024.12.1
- drf-yasg==1.21.8
- inflection==0.5.1
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- packaging==24.2
- pillow==11.0.0
- psycopg==3.2.3
- psycopg-binary==3.2.3
- pyjwt==2.10.1
- pytz==2024.2
- pyyaml==6.0.2
- referencing==0.35.1
- rpds-py==0.22.3
- typing-extensions==4.12.2
- uritemplate==4.1.1
prefix: /home/riisen/utveckling/miniconda3/envs/django

View File

@ -99,7 +99,7 @@ REST_FRAMEWORK = {
],
"DEFAULT_AUTHENTICATION_CLASSES": [
"knox.auth.TokenAuthentication",
"rest_framework.authentication.SessionAuthentication"
#"rest_framework.authentication.SessionAuthentication"
],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
'DEFAULT_PAGINATION_CLASS': 'settings.puckignation.MediumPagination',
@ -135,7 +135,7 @@ REST_KNOX = {
"AUTO_REFRESH": False,
"AUTO_REFRESH_MAX_TTL": None,
"MIN_REFRESH_INTERVAL": 60,
"AUTH_HEADER_PREFIX": "Bearer",
"AUTH_HEADER_PREFIX": "PuckoToken",
"EXPIRY_DATETIME_FORMAT": api_settings.DATETIME_FORMAT,
"TOKEN_MODEL": "knox.AuthToken"
}

View File

@ -94,16 +94,14 @@ class PuckoBase_User(AbstractBaseUser, PermissionsMixin):
return cls.objects.get(username=username)
@classmethod
def create(cls, username, password, first_name=None, last_name=None, superuser=False):
def create(cls, username, password, superuser=False):
if superuser:
cls.objects.create_superuser(
username, password=password,
first_name=first_name, last_name=last_name
)
else:
cls.objects.create_user(
username, password=password,
first_name=first_name, last_name=last_name
)
return cls.this(username)

View File

@ -2,7 +2,6 @@ from django.contrib.auth import get_user_model
from django.contrib.auth import login
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.authentication import BasicAuthentication
from rest_framework.permissions import AllowAny
from rest_framework.permissions import IsAuthenticated
from rest_framework.generics import CreateAPIView