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

features added. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 bosm/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added bosm/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added bosm/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added bosm/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions bosm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['abhishekspeer.pythonanywhere.com', '127.0.0.1', 'localhost',]
ALLOWED_HOSTS = ['abhishekspeer.pythonanywhere.com', '127.0.0.1', 'localhost', ]


# Application definition
Expand Down Expand Up @@ -145,7 +145,7 @@
LOGIN_REDIRECT_URL = 'main'
LOGOUT_REDIRECT_URL = 'main'

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY ='1060438488864-oqbnppt4fbd4ml7fu6d6l6u51m14k60f.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '1060438488864-oqbnppt4fbd4ml7fu6d6l6u51m14k60f.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'qFZH7K_i_8C2xaqsLwsDXi_1'

STATICFILES_DIRS = [
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file added sportzilla/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/apps.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/signals.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added sportzilla/__pycache__/views.cpython-36.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions sportzilla/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

class SportzillaConfig(AppConfig):
name = 'sportzilla'

def ready(self):
import sportzilla.signals
66 changes: 66 additions & 0 deletions sportzilla/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2019-03-23 10:09
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0008_alter_user_username_max_length'),
]

operations = [
migrations.CreateModel(
name='CustomUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('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')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('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')),
('score', models.IntegerField(default=0)),
('rank', models.IntegerField(blank=True, null=True)),
('question_no1', models.IntegerField(default=1)),
('question_no2', models.IntegerField(default=1)),
('question_no3', models.IntegerField(default=1)),
('question_no4', models.IntegerField(default=1)),
('question_no5', models.IntegerField(default=1)),
('answers_given', models.CharField(default='0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', max_length=200)),
('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()),
],
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question_no', models.IntegerField()),
('solution', models.CharField(max_length=50)),
('marks', models.IntegerField(null=True)),
('question_img', models.ImageField(blank=True, upload_to='')),
('question', models.CharField(default='', max_length=10000)),
('question_type', models.CharField(default='', max_length=100)),
],
),
]
20 changes: 20 additions & 0 deletions sportzilla/migrations/0002_customuser_login_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2019-03-23 10:31
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AddField(
model_name='customuser',
name='login_count',
field=models.IntegerField(default=0),
),
]
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 7 additions & 4 deletions sportzilla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ class CustomUser(AbstractUser):
question_no3 = models.IntegerField(default=1)
question_no4 = models.IntegerField(default=1)
question_no5 = models.IntegerField(default=1)
answers_given = models.CharField(max_length=200, default="0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
login_count = models.IntegerField(default=0)
answers_given = models.CharField(
max_length=200, default="0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")

def __str__(self):
return self.username


class Question(models.Model):
question_no = models.IntegerField()
solution = models.CharField(max_length=50)
marks = models.IntegerField(null=True)
question_img = models.ImageField(blank=True)
question = models.CharField(max_length=10000,default="")
question_type = models.CharField(max_length=100,default="")
question = models.CharField(max_length=10000, default="")
question_type = models.CharField(max_length=100, default="")

def __str__(self):
return str(self.question_no)+self.question_type #+ ' : ' + self.answer
return str(self.question_no)+self.question_type # + ' : ' + self.answer
14 changes: 14 additions & 0 deletions sportzilla/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from .models import CustomUser
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.contrib.auth import logout
from django.contrib.auth.signals import user_logged_in


@receiver(user_logged_in, sender=CustomUser)
def login_check(sender, request, user, **kwargs):
user.login_count += 1
print('logged in')
user.save()
if user.login_count > 1:
logout(request)