Sei sulla pagina 1di 14

HOME FILE

{% extends 'base.html' %}
{% load crispy_forms_tags %}
<!DOCTYPE html>
{%block jumbotron %}
<div class="jumbotron container-fluid ">
<h1 style={font-weight=200px}>Bull's Eye POLL</h1>
<p>Tell us what you think on some of the hottest live topics </p>
</div>
{% endblock %}
{% block content %}

<div class="rw">
<div class="col-md-3">
<h1> {{title_2}} </h1>
<form method="post" action="">{% csrf_token %}
{{form|crispy}}

<a href="/polls" method="post">let's vote</a>


</form>
</div>
</div>
{% endblock %}

POLL FILE

{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<link rel="icon" href="../../favicon.ico">

<title>BULLS EYE POLL</title>

<!-- Bootstrap core CSS -->


<!-- <link href="../../dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">

<link href="{% static 'css/navbar-static-top.css' %}" rel="stylesheet">

<script src="../../assets/js/ie-emulation-modes-warning.js"></script>

<!-- Latest compiled and minified CSS -->

</head>
<body>
{% include 'navbar.html' %}
<div class="container-fluid ">
{%block jumbotron %}
<div class="jumbotron container-fluid ">
<h1 style={font-weight=200px}>Current Polls</h1>
</div>
{% endblock %}
<!-- Static navbar -->
{% if latest_question_list %}
<ul>
{% for question in latest_question_list %}
<li><a href="{% url 'polls:detail' question.id
%}">{{ question.question_text }}</a></li>
{% endfor %}

</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}

</div> <!-- /container -->


<!-- Bootstrap core JavaScript
==================================================
-->
<!-- Placed at the end of the document so the pages load faster -->
<script src="{% static 'js/jquery.min.js' %"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{% static 'js/ie10-viewport-bug-workaround.js' %}"></script>
</body>
</html>

CHOICES FILE

{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>BULLS EYE POLL</title>
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/navbar-static-top.css' %}" rel="stylesheet">
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>

</head>
<body>
{% include 'navbar.html' %}
<!-- Static navbar -->
{%block jumbotron %}

<div class="jumbotron container-fluid ">


<h1 style={font-weight=200px}>{{ question.question_text }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{%
endif %}
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{
choice.id }}" />
<label
for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br />
{% endfor %}
</form>
</div>
{% endblock %}
<div class="container-fluid ">

{% block content %}
{% endblock %}
</div> <!-- /container -->
<script src="{% static 'js/ie10-viewport-bug-workaround.js' %}"></script>
</body>
</html>

RESULTS FILE

{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>BULLS EYE POLL</title>


<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/navbar-static-top.css' %}" rel="stylesheet">
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>
<!-- Latest compiled and minified CSS -->
</head>
<body>
{% include 'navbar.html' %}
<h1 style={font-weight=200px}>{{ question.question_text }}</h1>

<ul>
{% for choice in question.choice_set.all %}
<li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|
pluralize }}</li>
{% endfor %}
</ul>
<a class="btn btn-lg btn-primary" href="/polls" role="button">Vote again?
</a>
</p>
</div>
{% endblock %}
<div class="container-fluid ">
{% block content %}
{% endblock %}
</div> <!-- /container -->
<script src="{% static 'js/ie10-viewport-bug-workaround.js' %}"></script>
</body>
</html>

ADMIN FILE

from django.contrib import admin


from .models import SignUp,Question,Choice
from .forms import SignUpForm

class SignUpAdmin(admin.ModelAdmin):
list_display=["__str__","timestamp","updated"]
form=SignUpForm
#class Meta:
#

model=SignUp

class choiceInline(admin.TabularInline):
model=Choice
extra=4
class questionAdmin(admin.ModelAdmin):
fieldsets=[
(None , {'fields':['question_text']}),
('date info',{'fields':['pub_date'],'classes':['collapse']}),
]

inlines=[choiceInline]
search_fields=['question_text']
list_display=('question_text','pub_date','was_published_recently')
list_filter=['pub_date']
search_field=['question_text']
admin.site.register(Question,questionAdmin)
admin.site.register(SignUp,SignUpAdmin)

ADMIN-QUESTION FILE

from django.db import models


import datetime
from django.utils import timezone

class SignUp(models.Model):
email=models.EmailField()
full_name=models.CharField(max_length=400,blank=True,null=True)
timestamp=models.DateTimeField(auto_now_add=True,auto_now=False)
updated=models.DateTimeField(auto_now_add=False,auto_now=True)
def __str__(self):
return self.email
class Question(models.Model):
question_text = models.CharField(max_length=200)
def __str__(self):
return self.question_text
pub_date = models.DateTimeField('date published')
def was_published_recently(self):
now = timezone.now()

return now - datetime.timedelta(days=1) <= self.pub_date <= now


was_published_recently.admin_order_field='pub_date'
was_published_recently.boolean=True
was_published_recently.short_discription='published recently'
class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
def __str__(self):
return self.choice_text
votes = models.IntegerField(default=0)

ADMIN-USER FILE

ADMIN-CHOICES FILE

Guru Gobind Singh Indraprastha University


GovindBallah Pant Government Engineering College

(Govt. of NCT of Delhi)


Okhla Industrial Estate, Phase-III
New Delhi-110020

Mrs.Sandhya Punidhir

Sanjay Negi

(Assistant Professor)

CSE-5thSem
03420902713

Potrebbero piacerti anche