Commit dbb21865 authored by KUNAL GOYAL's avatar KUNAL GOYAL

initial models

parent 75d9a9db
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-01 08:48
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Applicant',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('rank', models.IntegerField()),
],
),
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('choice_name', models.CharField(max_length=200)),
('capacity', models.IntegerField()),
('applicant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='allocation.Applicant')),
],
),
]
from django.db import models
# Create your models here.
class Applicant(models.Model):
name = models.CharField(max_length=200)
rank = models.IntegerField()
def __str__(self):
return self.name
class Choice(models.Model):
applicant = models.ForeignKey(Applicant, on_delete=models.CASCADE)
choice_name = models.CharField(max_length=200)
capacity = models.IntegerField()
def __str__(self):
return self.choice_name
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request): #for /allocation
return HttpResponse("Hello, world. You're at the allocation index.")
......@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'allocation.apps.AllocationConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -105,7 +106,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Asia/Calcutta'
USE_I18N = True
......
......@@ -13,9 +13,10 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^allocation/', include('allocation.urls')),
url(r'^admin/', admin.site.urls),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment