Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\ericnewcomer\\Desktop\\gymbuddy\\venv\\Scripts\\python.exe"
}
Binary file added Indian Electoral Process demystified 2.mp4
Binary file not shown.
Binary file added Indian Electoral Process demystified.mp4
Binary file not shown.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# Electhon - 2023
### How to Execute

#### Team Name -
#### Problem Statement -
#### Team Leader Email -

## A Brief of the Prototype:
What is your solution? and how it works.

## Code Execution Instruction:
*[If your solution is **not** application based, you can ignore this para]

*The Repository must contain your **Execution Plan PDF**.
* Make sure you use virtual-env or conda environment.
* pip install -r requirements.txt
* python manage.py migrate
* python manage.py runserver
* Login as "asx05" and password as '1234'.
* Or create a new user
Binary file added db.sqlite3
Binary file not shown.
Empty file added gymbuddy/__init__.py
Empty file.
Binary file added gymbuddy/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
Binary file added gymbuddy/__pycache__/wsgi.cpython-38.pyc
Binary file not shown.
137 changes: 137 additions & 0 deletions gymbuddy/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
"""
Django settings for gymbuddy project.

Generated by 'django-admin startproject' using Django 2.0.7.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'lb*g9ry5b*z6v04p9&$s-l9e)9-78+#kawwa1mwir+w)9eb7o+'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'main',

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

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',
]

ROOT_URLCONF = 'gymbuddy.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 = 'gymbuddy.wsgi.application'


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

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.0/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',
# },
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'OPTIONS': {
'min_length': 4,
}
},
]


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

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/Los_Angeles'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'main/media')

LOGIN_URL = 'login'
27 changes: 27 additions & 0 deletions gymbuddy/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# MASTER URLS
"""gymbuddy URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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
from main import views

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls')),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', views.logout_view, name='logout'),
path('signup/', views.signup, name='signup'),
]
16 changes: 16 additions & 0 deletions gymbuddy/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for gymbuddy 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/2.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gymbuddy.settings")

application = get_wsgi_application()
Binary file added main/.DS_Store
Binary file not shown.
Empty file added main/__init__.py
Empty file.
Binary file added main/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/backend.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/backend.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/forms.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/forms.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added main/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file added main/__pycache__/views.cpython-38.pyc
Binary file not shown.
30 changes: 30 additions & 0 deletions main/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.contrib import admin
from .models import Gym, Profile, Workout
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

class ProfileInline(admin.StackedInline):
model = Profile
can_delete = False
verbose_name_plural = 'Profile'
fk_name = 'user'

class CustomUserAdmin(UserAdmin):
inlines = (ProfileInline, )
list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'get_activity')
list_select_related = ('profile', )

def get_activity(self, instance):
return instance.profile.activity1
get_activity.short_description = 'Activity'

def get_inline_instances(self, request, obj=None):
if not obj:
return list()
return super(CustomUserAdmin, self).get_inline_instances(request, obj)

admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)

admin.site.register(Gym)
admin.site.register(Workout)
5 changes: 5 additions & 0 deletions main/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class MainConfig(AppConfig):
name = 'main'
10 changes: 10 additions & 0 deletions main/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.conf import settings
from django.contrib.auth.hashers import check_password
from django.contrib.auth.models import User

def authenticate(request, username=None, password=None):
for user in User.objects.all().filter(username__iexact=username):
pwd_valid = check_password(password, user.password)
if pwd_valid:
return user
return None
44 changes: 44 additions & 0 deletions main/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import Profile, Workout
import datetime


class SignUpForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=False)
last_name = forms.CharField(max_length=30, required=False)
email = forms.EmailField(max_length=254, help_text='Required. Inform a valid email address.')

class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2')


class UserForm(forms.ModelForm):
username = forms.CharField(max_length=30, required=False, help_text="Username:")
first_name = forms.CharField(max_length=30, required=False, help_text="First name:")
last_name = forms.CharField(max_length=30, required=False, help_text="Last name:")
class Meta:
model = User
fields = ('username', 'first_name', 'last_name')


class ProfileForm(forms.ModelForm):
bio = forms.CharField(max_length=500, required=False, help_text="Bio:", widget=forms.Textarea)
location = forms.CharField(max_length=30, required=False, help_text="Location:")
activity1 = forms.CharField(max_length=50, required = False, help_text="Aadhar Card Number:")
activity2 = forms.CharField(max_length=50, required = False, help_text="Phone Number:")
image = forms.ImageField()

class Meta:
model = Profile
fields = ('bio', 'location', 'activity1', 'activity2', 'image')

class WorkoutForm(forms.ModelForm):
what = forms.CharField(max_length=100, required=False, help_text='Are you going to vote?')
gym = forms.CharField(max_length=100, required=False, help_text='Where?')

class Meta:
model = Workout
fields = ('what', 'gym')
Binary file added main/media/.DS_Store
Binary file not shown.
Binary file added main/media/profile_pics/.DS_Store
Binary file not shown.
Binary file added main/media/profile_pics/391_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/Aryan.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/DSC_0027_Cm5nVjU.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/h4i.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/maxx_profile.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/profpic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/profpic_4a9BKQ1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/profpic_H1DPA6T.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/profpic_J2Keriu.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added main/media/profile_pics/profpic_rvUmETY.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions main/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 2.0.7 on 2018-07-08 21:43

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Gym',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('city', models.CharField(max_length=50)),
],
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('muscles_trained', models.CharField(max_length=50)),
],
),
]
26 changes: 26 additions & 0 deletions main/migrations/0002_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 2.0.7 on 2018-08-01 16:08

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


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('main', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('bio', models.TextField(blank=True, max_length=500)),
('location', models.CharField(blank=True, max_length=30)),
('age', models.IntegerField(blank=True, max_length=2)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
23 changes: 23 additions & 0 deletions main/migrations/0003_auto_20180801_0920.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.0.7 on 2018-08-01 16:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0002_profile'),
]

operations = [
migrations.AddField(
model_name='profile',
name='activity1',
field=models.CharField(blank=True, max_length=50),
),
migrations.AddField(
model_name='profile',
name='activity2',
field=models.CharField(blank=True, max_length=50),
),
]
Loading