Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added all initial files and auth views #2

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4536af2
feat:added all initial files and auth views
rb-25 Jan 3, 2024
ce3633a
feat:added all user files in the users app
rb-25 Jan 19, 2024
54138d6
feat: added spons_app, modified settings
rb-25 Jan 22, 2024
b85fbe1
chore:removing pycache
rb-25 Jan 22, 2024
e525b0b
chore:removing pycache
rb-25 Jan 22, 2024
db9ee92
chore:added requirements.txt
rb-25 Jan 22, 2024
fb6da07
chore:adding requirements.txt
rb-25 Jan 23, 2024
7dba683
chore: adding requirements fr
rb-25 Jan 23, 2024
eeb2175
feat: modified views,requirement txt and models
rb-25 Feb 1, 2024
ca10548
feat: docker
rb-25 Feb 1, 2024
9883ec4
feat: updated docker
rb-25 Feb 1, 2024
54e5ff6
feat: pushed all the code
rb-25 Feb 8, 2024
b8cff68
feat: added admin approval for joining organisation
rb-25 Feb 8, 2024
6df55fb
chore: updated comments
rb-25 Feb 8, 2024
955c13d
feat: added ai views, leaderboard view, changed docker
rb-25 Feb 19, 2024
8659dc8
feat: docker changes for production
rb-25 Feb 22, 2024
23e7f63
feat: changed response for login
rb-25 Feb 23, 2024
9e8a668
chore: removed unnecessary code
rb-25 Feb 23, 2024
1b22960
feat: added username login, admin portal
rb-25 Feb 29, 2024
a7e0be9
chore: check view
rb-25 Mar 4, 2024
453f238
feat: changes for production
rb-25 Mar 5, 2024
680d291
feat: registered models for admin portal
rb-25 Mar 6, 2024
870a49e
feat: changed user model error
rb-25 Mar 6, 2024
2ae746b
feat: added user display, user company display
rb-25 Apr 8, 2024
22c40e1
feat: added host for prod
rb-25 Apr 8, 2024
13e41d9
feat: Display organisation view
rb-25 Apr 9, 2024
e967032
feat: permissions changed for some views
rb-25 Apr 9, 2024
e92db34
feat: added display companies based on event, event field in model
rb-25 Apr 10, 2024
4755ab1
feat: added filter for admin and user in display all users
rb-25 Apr 10, 2024
ac681b4
feat: changed event date to start date and end date
rb-25 Apr 11, 2024
a6fd699
feat: fixed type error with display all users
rb-25 Apr 11, 2024
736c8fb
feat: event name in company respons, search filtering, POC foreign ke…
rb-25 Apr 12, 2024
051f9db
feat: error
rb-25 Apr 12, 2024
04c2cd3
feat: can add mutiple poc
rb-25 Apr 13, 2024
94256ba
feat: error
rb-25 Apr 13, 2024
9e4fd73
feat: changed mapping between company and sponsor models
rb-25 Apr 14, 2024
4fbfe28
feat: fixing small bugs
rb-25 Apr 15, 2024
d8619f4
feat: added profile pic to users, display all sponsors
rb-25 Apr 15, 2024
71868cb
feat: added profile_pic to serializer
rb-25 Apr 15, 2024
006a223
feat: allows same company to be added for different event
rb-25 Apr 15, 2024
df33871
feat: update sponsor view
rb-25 Apr 16, 2024
061752c
feat: added checks for organisation
rb-25 Apr 16, 2024
c341a18
feat: bug
rb-25 Apr 16, 2024
db5f87d
feat: additional can be blank
rb-25 Apr 16, 2024
1ba0c81
feat: additional can be blank
rb-25 Apr 16, 2024
7696546
feat: bug
rb-25 Apr 17, 2024
87de76f
feat: return empty array for no sponsors
rb-25 Apr 17, 2024
67ac173
feat: made pie chart event wise
rb-25 Apr 17, 2024
4336d66
feat: 200 ok status for no sponsor
rb-25 Apr 17, 2024
41b7e5f
feat: leaderboard is event wise
rb-25 Apr 17, 2024
0318dee
feat: total money raised
rb-25 Apr 17, 2024
ab8b26f
feat: added access control for adding money
rb-25 Apr 17, 2024
53816b3
feat: added get company by id
rb-25 Apr 24, 2024
56981e6
feat: added null constraint to company and poc fields
rb-25 Apr 25, 2024
7442296
feat: added password reset views
rb-25 Apr 25, 2024
049f8e1
feat: added to admin site
rb-25 Apr 25, 2024
58125f7
feat: changed error messages
rb-25 Apr 25, 2024
d279b30
feat: fixed response error
rb-25 Apr 25, 2024
4821144
chore: response message change
rb-25 Apr 25, 2024
34d19d2
feat: removed displayall url and checks for changing owner
rb-25 Apr 25, 2024
205caf7
feat: added to serializer
rb-25 Apr 28, 2024
ed66a7a
feat: added poc name to serializer
rb-25 May 1, 2024
add0382
feat: bug
rb-25 May 1, 2024
5db44f7
feat: bug
rb-25 May 1, 2024
ed56a57
feat: added remarks to sponsorship
rb-25 May 1, 2024
3ebded6
feat: added comma
rb-25 May 1, 2024
1421228
feat: adding status to error message
rb-25 May 1, 2024
0a613c2
feat: syntax error
rb-25 May 1, 2024
1310fb3
feat: added delete endpoint for sponsor
rb-25 May 3, 2024
91fb80f
feat: error message changed
rb-25 May 29, 2024
5d67ba3
feat: error message changed
rb-25 May 29, 2024
6cd4d36
feat: error message changed
rb-25 May 29, 2024
f450a96
feat: changed registration view
rb-25 May 29, 2024
e6d0bd6
chore: adding designation to serializer
rb-25 Jun 2, 2024
f41d6fb
feat: removed multiple sponsors for same company
rb-25 Jun 3, 2024
77d6bde
feat: made event a viewset
rb-25 Jun 11, 2024
d426826
chore: changed host name
rb-25 Jun 20, 2024
43c744f
feat: docker image changed
rb-25 Jun 22, 2024
8d654e9
chore: changes to admin site
rb-25 Jun 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions sponsorship/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sponsorship.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions sponsorship/sponsorship/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for sponsorship 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/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sponsorship.settings')

application = get_asgi_application()
145 changes: 145 additions & 0 deletions sponsorship/sponsorship/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
from pathlib import Path
from decouple import config
# Build paths inside the project like this: BASE_DIR / 'subdir'.


BASE_DIR = Path(__file__).resolve().parent.parent


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-iqlhquq@^8$h)tjyq*j6-04j(bpka*)34hwh(oa+2j*b5f&8fs'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False, cast=bool)

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'sponsorship_app',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware'
]

ROOT_URLCONF = 'sponsorship.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'sponsorship.wsgi.application'


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

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config('DATABASE_NAME'),
'USER': config('DATABASE_USER'),
'PASSWORD': config('DATABASE_PASSWORD'),
'HOST': config('DATABASE_HOST'), # Set to the MySQL server's address
'PORT': config('DATABASE_PORT'),
}
}



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

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


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

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'

USE_I18N = True

USE_TZ = True


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

STATIC_URL = 'static/'

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

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

AUTH_USER_MODEL = 'sponsorship_app.User'

CORS_ORIGIN_ALLOW_ALL= True
CORS_ALLOW_CREDENTIALS=True

"""REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
],
}"""

#smtp config
EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST="smtp.gmail.com"
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD=config('EMAIL_HOST_PASSWORD')
23 changes: 23 additions & 0 deletions sponsorship/sponsorship/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
URL configuration for sponsorship project.

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include

urlpatterns = [
path('admin/', admin.site.urls),
path('api/',include('sponsorship_app.urls'))
]
16 changes: 16 additions & 0 deletions sponsorship/sponsorship/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for sponsorship 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/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sponsorship.settings')

application = get_wsgi_application()
Empty file.
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: 3 additions & 0 deletions sponsorship/sponsorship_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions sponsorship/sponsorship_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class SponsorshipAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'sponsorship_app'
43 changes: 43 additions & 0 deletions sponsorship/sponsorship_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 4.2.6 on 2023-12-28 15:50

import django.contrib.auth.models
from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('name', models.CharField(max_length=254)),
('email', models.EmailField(max_length=254, unique=True)),
('password', models.CharField(max_length=255)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.2.6 on 2024-01-01 07:29

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('sponsorship_app', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Organisation',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('invite_code', models.CharField(blank=True, max_length=8, unique=True)),
],
),
migrations.AddField(
model_name='user',
name='invite_code',
field=models.CharField(blank=True, max_length=8, null=True),
),
migrations.AddField(
model_name='user',
name='organisation',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sponsorship_app.organisation'),
),
]
38 changes: 38 additions & 0 deletions sponsorship/sponsorship_app/migrations/0003_event_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.2.6 on 2024-01-03 07:24

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('sponsorship_app', '0002_organisation_user_invite_code_user_organisation'),
]

operations = [
migrations.CreateModel(
name='Event',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('date_of_event', models.DateField()),
],
),
migrations.CreateModel(
name='Email',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name_of_company', models.CharField(max_length=255)),
('company_type', models.CharField(max_length=100)),
('name_of_poc', models.CharField(max_length=100)),
('position_of_poc', models.CharField(max_length=100)),
('email_poc', models.EmailField(max_length=254)),
('sponsorship_ask', models.CharField(max_length=100)),
('linkedin', models.URLField()),
('website', models.URLField()),
('details', models.CharField(max_length=500)),
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sponsorship_app.event')),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.2.6 on 2024-01-03 14:14

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('sponsorship_app', '0003_event_email'),
]

operations = [
migrations.AddField(
model_name='email',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='event',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='organisation',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
]
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading