import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Name(models.Model):
user_name = models.CharField(max_length=200)
publication_date = models.DateTimeField('date published')
age= models.IntegerField(default=0)
prof_comm_score = models.IntegerField(default=1)
prof_comm_status = models.IntegerField(default=1)
teamwork_score = models.IntegerField(default=1)
teamwork_status = models.IntegerField(default=1)
prod_knowledge_score = models.IntegerField(default=1)
prod_knowledge_status = models.IntegerField(default=1)
part_comp_score = models.IntegerField(default=1)
part_comp_status = models.IntegerField(default=1)
relations_score = models.IntegerField(default=1)
relations_status = models.IntegerField(default=1)
strategy_score = models.IntegerField(default=1)
strategy_status = models.IntegerField(default=1)
loyality_score = models.IntegerField(default=1)
loyality_status = models.IntegerField(default=1)
overall_score = models.IntegerField(default = 7)
def __str__(self):
return self.user_name
def was_published_recently(self):
return self.publication_date >= timezone.now() - datetime.timedelta(days=1)
Lets say i want 7 radio buttons to determine the value of prof_comm_score (which is an int ranging from 1 to 7)
<body>
{%block content%}
<h1>#1 Sales profession, communication</h1>
<form action="" method="POST"></form>
{% csrf_token %}
<input type="radio" name="1" id = "1" value="7">
<input type="radio" name="1" id = "2" value="6">
<input type="radio" name="1" id = "3" value="5">
<input type="radio" name="1" id = "4" value="4">
<input type="radio" name="1" id = "5" value="3">
<input type="radio" name="1" id = "6" value="2">
<input type="radio" name="1" id = "7" value="1">
{%endblock%}
</body>
here is my git repo if needed: