Skip to content

Commit

Permalink
Merge pull request #8 from Swahilipot-Hub-Developers/jilo
Browse files Browse the repository at this point in the history
updated events management
  • Loading branch information
jrmugweru authored Dec 13, 2023
2 parents 010f0d1 + f93dd95 commit 907f3b9
Show file tree
Hide file tree
Showing 86 changed files with 1,125 additions and 11,507 deletions.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions backend2/events/admin.py → backend/authentication/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from django.contrib import admin
from .models import Event

# Register your models here.

admin.site.register(Event)
4 changes: 2 additions & 2 deletions backend2/events/apps.py → backend/authentication/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.apps import AppConfig


class EventsConfig(AppConfig):
class AuthenticationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'events'
name = 'authentication'
File renamed without changes.
Binary file not shown.
3 changes: 3 additions & 0 deletions backend/authentication/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
10 changes: 10 additions & 0 deletions backend/authentication/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# authentication/serializers.py

from django.contrib.auth.models import User
from rest_framework import serializers

class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['id', 'username', 'email', 'password']
extra_kwargs = {'password': {'write_only': True}}
File renamed without changes.
11 changes: 11 additions & 0 deletions backend/authentication/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# authentication/urls.py

from django.urls import path
#from .views import CustomAuthToken, UserInfoView
from .views import SignupView

urlpatterns = [
# path('api-token-auth/', CustomAuthToken.as_view(), name='api_token_auth'),
# path('user-info/', UserInfoView.as_view(), name='user_info'),
path('SignUp/', SignupView.as_view(), name='SignUp'),
]
34 changes: 34 additions & 0 deletions backend/authentication/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# from django.shortcuts import render

# # Create your views here.
# # authentication/views.py

# from rest_framework.authtoken.views import ObtainAuthToken
# from rest_framework.authtoken.models import Token
# from rest_framework.response import Response
# from rest_framework.views import APIView
# from rest_framework.permissions import IsAuthenticated

# class CustomAuthToken(ObtainAuthToken):
# def post(self, request, *args, **kwargs):
# serializer = self.serializer_class(data=request.data, context={'request': request})
# serializer.is_valid(raise_exception=True)
# user = serializer.validated_data['user']
# token, created = Token.objects.get_or_create(user=user)
# return Response({'token': token.key, 'user_id': user.pk})


# class UserInfoView(APIView):
# permission_classes = [IsAuthenticated]

# def get(self, request):
# return Response({'user_id': request.user.pk, 'username': request.user.username})
# authentication/views.py

from rest_framework import generics
from rest_framework.response import Response
from rest_framework import status
from .serializers import UserSerializer

class SignupView(generics.CreateAPIView):
serializer_class = UserSerializer
File renamed without changes.
Binary file added backend/backend/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file added backend/backend/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file added backend/backend/__pycache__/wsgi.cpython-312.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions backend2/backend2/asgi.py → backend/backend/asgi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""
ASGI config for backend2 project.
ASGI config for backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend2.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

application = get_asgi_application()
34 changes: 20 additions & 14 deletions backend2/backend2/settings.py → backend/backend/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Django settings for backend2 project.
Django settings for backend project.
Generated by 'django-admin startproject' using Django 4.2.7.
Generated by 'django-admin startproject' using Django 5.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
https://docs.djangoproject.com/en/5.0/ref/settings/
"""

from pathlib import Path
Expand All @@ -17,10 +17,10 @@


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-l3l5v!8z9k@yux=0x-+2r)s&7q8m@=c-_d5d6l&#+w!+(rw7_i'
SECRET_KEY = 'django-insecure-q*&68x2311m9sjv8uz9ydq5*+w%a8mz+!kj#i(5t96t+u$0bbe'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -37,8 +37,8 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'authentication.apps',
'rest_framework',
'events',
]

MIDDLEWARE = [
Expand All @@ -50,8 +50,11 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
]

ROOT_URLCONF = 'backend2.urls'
ROOT_URLCONF = 'backend.urls'

TEMPLATES = [
{
Expand All @@ -69,11 +72,11 @@
},
]

WSGI_APPLICATION = 'backend2.wsgi.application'
WSGI_APPLICATION = 'backend.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
'default': {
Expand All @@ -84,7 +87,7 @@


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -103,7 +106,7 @@


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -115,11 +118,14 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

LOGIN_REDIRECT_URL='/HOME'
LOGOUT_REDIRECT_URL='/login'
13 changes: 7 additions & 6 deletions backend2/backend2/urls.py → backend/backend/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
URL configuration for backend2 project.
URL configuration for backend project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
Expand All @@ -16,11 +16,12 @@
"""
from django.contrib import admin
from django.urls import path,include
from django.shortcuts import redirect

urlpatterns = [
path('auth/', include('authentication.urls')),
path('admin/', admin.site.urls),
path('api/', include('events.urls')),
path('', include('events.urls')),
path('', lambda request: redirect('api/')),
path('accounts/', include('django.contrib.auth.urls')), # Include authentication URLs

path('',include('django.contrib.auth.urls'),)
# Add your other app URLs here
]
6 changes: 3 additions & 3 deletions backend2/backend2/wsgi.py → backend/backend/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""
WSGI config for backend2 project.
WSGI config for backend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend2.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

application = get_wsgi_application()
Binary file renamed backend2/db.sqlite3 → backend/db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion backend2/manage.py → backend/manage.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend2.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
Binary file removed backend2/backend2/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file removed backend2/backend2/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/backend2/__pycache__/wsgi.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/event_banners/ummi.jpg
Binary file not shown.
Binary file removed backend2/events/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/serializers.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file removed backend2/events/__pycache__/views.cpython-310.pyc
Binary file not shown.
26 changes: 0 additions & 26 deletions backend2/events/migrations/0001_initial.py

This file was deleted.

18 changes: 0 additions & 18 deletions backend2/events/migrations/0002_alter_event_banner.py

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 0 additions & 15 deletions backend2/events/models.py

This file was deleted.

8 changes: 0 additions & 8 deletions backend2/events/serializers.py

This file was deleted.

9 changes: 0 additions & 9 deletions backend2/events/urls.py

This file was deleted.

14 changes: 0 additions & 14 deletions backend2/events/views.py

This file was deleted.

Loading

0 comments on commit 907f3b9

Please sign in to comment.