From 903b73b033c9b80db36da755e05185d4f266101c Mon Sep 17 00:00:00 2001
From: Sashi20
Date: Fri, 6 Mar 2020 14:39:16 +0530
Subject: Add view abstracts, comment abstract
---
arduino_blog/forms.py | 11 +--
arduino_blog/migrations/0007_auto_20200305_1009.py | 51 ++++++++++
arduino_blog/models.py | 23 ++++-
.../arduino_blog/templates/abstract-details.html | 30 ++++++
.../arduino_blog/templates/comment-abstract.html | 39 ++++++++
.../static/arduino_blog/templates/dashboard.html | 5 +-
.../static/arduino_blog/templates/home.html | 6 +-
.../static/arduino_blog/templates/submit-cfp.html | 8 ++
.../arduino_blog/templates/user-register.html | 14 +--
.../arduino_blog/templates/view-proposals.html | 107 +++++++++++++++++++++
arduino_blog/urls.py | 5 +
arduino_blog/views.py | 98 ++++++++++++++++++-
arduino_projects_website/config.py | 5 +-
arduino_projects_website/settings.py | 4 +-
14 files changed, 374 insertions(+), 32 deletions(-)
create mode 100644 arduino_blog/migrations/0007_auto_20200305_1009.py
create mode 100644 arduino_blog/static/arduino_blog/templates/abstract-details.html
create mode 100755 arduino_blog/static/arduino_blog/templates/comment-abstract.html
create mode 100644 arduino_blog/static/arduino_blog/templates/view-proposals.html
diff --git a/arduino_blog/forms.py b/arduino_blog/forms.py
index 4945b79..b4e23ae 100644
--- a/arduino_blog/forms.py
+++ b/arduino_blog/forms.py
@@ -24,7 +24,7 @@ from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.utils import timezone
from arduino_blog.models import (
- Profile, User, Proposal
+ Profile, User, Proposal, Comment
)
from .send_emails import (send_user_mail,
generate_activation_key)
@@ -137,12 +137,10 @@ class UserRegistrationForm(forms.Form):
attrs={'placeholder': 'Enter valid email id'}))
password = forms.CharField(max_length=32, widget=forms.PasswordInput())
confirm_password = forms.CharField(max_length=32, widget=forms.PasswordInput())
- title = forms.ChoiceField(choices=title)
first_name = forms.CharField(max_length=32, label='First name', widget=forms.TextInput(
attrs={'placeholder': 'First name'}))
last_name = forms.CharField(max_length=32, label='Last name', widget=forms.TextInput(
attrs={'placeholder': 'Last name'},))
- phone = forms.CharField(widget=forms.TextInput(attrs={'maxlength': '10', 'type': 'number'}))
institute = forms.CharField(max_length=32,
label='Institute/Organization/Company', widget=forms.TextInput())
position = forms.ChoiceField(choices = position_choices)
@@ -202,9 +200,7 @@ class UserRegistrationForm(forms.Form):
new_profile.institute = cleaned_data["institute"]
new_profile.position = cleaned_data["position"]
new_profile.pincode = cleaned_data["pincode"]
- new_profile.phone = cleaned_data["phone"]
new_profile.city = cleaned_data["city"]
- new_profile.title = cleaned_data["title"]
new_profile.state = cleaned_data["state"]
new_profile.how_did_you_hear_about_us = cleaned_data["how_did_you_hear_about_us"]
new_profile.activation_key = generate_activation_key(
@@ -251,7 +247,8 @@ class AbstractProposalForm(forms.ModelForm):
error_messages={
'required': 'Abstract field required.'},
)
-
+ references = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'References(if any)'})
+ )
completion_date = forms.DateTimeField(
input_formats=['%YY-%mm-%dd'],
widget=forms.DateTimeInput(attrs={
@@ -271,4 +268,4 @@ class AbstractProposalForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AbstractProposalForm, self).__init__(*args, **kwargs)
self.fields['completion_date'].disabled = True
- self.fields['completion_date'].initial = (datetime.date.today() + relativedelta(months=1))
+ self.fields['completion_date'].initial = (datetime.date.today() + relativedelta(months=1))
\ No newline at end of file
diff --git a/arduino_blog/migrations/0007_auto_20200305_1009.py b/arduino_blog/migrations/0007_auto_20200305_1009.py
new file mode 100644
index 0000000..cdb6629
--- /dev/null
+++ b/arduino_blog/migrations/0007_auto_20200305_1009.py
@@ -0,0 +1,51 @@
+# Generated by Django 3.0.3 on 2020-03-05 10:09
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contenttypes', '0002_remove_content_type_name'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('arduino_blog', '0006_remove_proposal_attachment'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='profile',
+ name='phone',
+ ),
+ migrations.RemoveField(
+ model_name='profile',
+ name='title',
+ ),
+ migrations.AddField(
+ model_name='proposal',
+ name='references',
+ field=models.CharField(default='None', max_length=200),
+ ),
+ migrations.AlterField(
+ model_name='proposal',
+ name='terms_and_conditions',
+ field=models.BooleanField(default=True),
+ ),
+ migrations.CreateModel(
+ name='Comment',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('date_created', models.DateTimeField(auto_now_add=True)),
+ ('date_modified', models.DateTimeField(auto_now=True)),
+ ('body', models.CharField(max_length=500)),
+ ('is_public', models.BooleanField(default=False)),
+ ('object_id', models.PositiveIntegerField()),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ ]
diff --git a/arduino_blog/models.py b/arduino_blog/models.py
index 84c6bd0..97e60de 100644
--- a/arduino_blog/models.py
+++ b/arduino_blog/models.py
@@ -5,6 +5,9 @@ from django.core.validators import RegexValidator
import os
from datetime import datetime
from arduino_projects_website import settings
+from django.contrib.contenttypes.fields import GenericForeignKey
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.contenttypes.fields import GenericRelation
position_choices = (
("student", "Student"),
@@ -83,9 +86,9 @@ class BaseClass(models.Model):
class Profile(BaseClass):
"""Profile for users"""
user = models.OneToOneField(User, on_delete=models.CASCADE)
- title = models.CharField(max_length=32, blank=True, choices=title)
+ #title = models.CharField(max_length=32, blank=True, choices=title)
institute = models.CharField(max_length=150)
- phone = models.CharField(max_length=10)
+ #phone = models.CharField(max_length=10)
position = models.CharField(max_length=32, choices=position_choices)
how_did_you_hear_about_us = models.CharField(
max_length=255, blank=True, choices=source)
@@ -110,6 +113,15 @@ def get_document_dir(instance, filename):
# print "----------------->",instance.user
return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
+
+class Comment(BaseClass):
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
+ body = models.CharField(max_length=500)
+ is_public = models.BooleanField(default = False)
+ content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
+ object_id = models.PositiveIntegerField()
+ content_object = GenericForeignKey()
+
class Proposal(BaseClass):
user = models.ForeignKey(User, on_delete=models.CASCADE,)
name_of_author = models.CharField(max_length=200, default='None')
@@ -117,10 +129,15 @@ class Proposal(BaseClass):
email = models.CharField(max_length=128)
title_of_the_project = models.CharField(max_length=250)
abstract = models.TextField(max_length=700)
+ references = models.CharField(max_length = 200, default = 'None')
#attachment = models.FileField(upload_to=get_document_dir)
status = models.CharField(max_length=100, default='Pending', editable=True)
completion_date = models.DateTimeField(null=True, blank=True)
approval_date = models.DateTimeField(null=True, blank=True)
proposal_status = models.IntegerField(default=0, editable=True)
#tags = models.CharField(max_length=250)
- terms_and_conditions = models.BooleanField(default= 'True')
+ terms_and_conditions = models.BooleanField(default= True)
+ comment = GenericRelation(Comment)
+
+
+
diff --git a/arduino_blog/static/arduino_blog/templates/abstract-details.html b/arduino_blog/static/arduino_blog/templates/abstract-details.html
new file mode 100644
index 0000000..153979d
--- /dev/null
+++ b/arduino_blog/static/arduino_blog/templates/abstract-details.html
@@ -0,0 +1,30 @@
+{% extends "base.html" %}
+{% load static %}
+ {% block content %}
+
+ Title: {{ proposal.title_of_the_project }} Name of the author: {{proposal.name_of_author}}
+ About the authors: {{ proposal.about_the_author | linebreaks }} Abstract: {{ proposal.abstract | linebreaks }} Date Created: {{ proposal.date_created }} {{ comment.body| linebreaks }}Abstract Details
+ {{ proposal.user.first_name }} {{ proposal.user.last_name }}
+
+ Comments
+ {% for comment in comments %}
+
+ {% endfor %}
+
Click here to view your proposal
- Back in 2005, a group of students envisaged a world where they have affordable access to digital devices, that they can interact with the environment using sensors and microcontrollers. Fast forward 15 years and Arduino has become a household name in the community of not just students, but also novices, professionals and DIY makers. The formidable headway that was brought about has given courage and vision to all the opensource hardware projects henceforth. We at FOSSEE also became a part by adopting the platform, and using it to teach Electronics across India. The learning resources, both hardware and lectures, put together by the Opensource-hardware team of FOSSEE and Spoken-tutorial has already demonstrated effective learning. + Back in 2005, a group of students envisaged a world where they have affordable access to digital devices, that they can interact with the environment using sensors and microcontrollers. Fast forward 15 years and Arduino has become a household name amongst not just students, but also novices, professionals and DIY makers. The formidable headway that was brought about has shown the way to many opensource hardware projects henceforth. We at FOSSEE also became a part by adopting the platform, and using it to teach Electronics across India. The learning resources, both hardware and lectures, put together by the Opensource-hardware team of FOSSEE and Spoken Tutorial has already demonstrated effective learning.
- Here, we are here providing you a platform for showcasing your ambitious projects, forming a community around the users and become part of our opensource-hardware activities. We are inviting proposals from you, those who have implemented projects using Arduino or are in the process, to contribute the documentation/DIY instructions of their projects. We promise to put together a well presented, shareable documentation of your project in our website. Every contributor can thus build an online portfolio which they can take pride in and may also land them a job one day! + Here, we are providing you a platform for showcasing your ambitious projects, forming a community around the users and becoming part of our open-source hardware activities. We are inviting proposals from you, those who have implemented projects using Arduino or are in the process, to contribute the documentation/DIY instructions of their projects. We promise to put together a well presented, shareable documentation of your project on our website. Every contributor can thus build an online portfolio, which they can take pride in and which might also land them a job one day!
- Please signup and make a profile for proposal submission right away and become one of the first contributors! + Please sign up and make a profile for proposal submission right away and become one of the first contributors!
Contribute first diff --git a/arduino_blog/static/arduino_blog/templates/submit-cfp.html b/arduino_blog/static/arduino_blog/templates/submit-cfp.html index 6e20b5c..4da6237 100644 --- a/arduino_blog/static/arduino_blog/templates/submit-cfp.html +++ b/arduino_blog/static/arduino_blog/templates/submit-cfp.html @@ -43,6 +43,14 @@
{{ proposal.user.first_name }} {{ proposal.user.last_name }}
+Title: {{ proposal.title_of_the_project }}
+Name of the author: {{proposal.name_of_author}} +
+About the authors: {{ proposal.about_the_author |linebreaks }}
+ +Abstract: + + {{ proposal.abstract | linebreaks }} +
+Date Created: {{ proposal.date_created }}
+Comments
+ {% for comment in comments %} +{{ comment.body| linebreaks }}
++ + {% endfor %} + +