summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202020-03-06 14:39:16 +0530
committerSashi202020-03-06 14:39:16 +0530
commit903b73b033c9b80db36da755e05185d4f266101c (patch)
tree94d3cf22c8c872b960f7bd252d9837f97db5fe52
parentf3b005d44de92e6872a0f9824f5d20cc9e636f34 (diff)
downloadarduino_projects_website-903b73b033c9b80db36da755e05185d4f266101c.tar.gz
arduino_projects_website-903b73b033c9b80db36da755e05185d4f266101c.tar.bz2
arduino_projects_website-903b73b033c9b80db36da755e05185d4f266101c.zip
Add view abstracts, comment abstract
-rw-r--r--arduino_blog/forms.py11
-rw-r--r--arduino_blog/migrations/0007_auto_20200305_1009.py51
-rw-r--r--arduino_blog/models.py23
-rw-r--r--arduino_blog/static/arduino_blog/templates/abstract-details.html30
-rwxr-xr-xarduino_blog/static/arduino_blog/templates/comment-abstract.html39
-rw-r--r--arduino_blog/static/arduino_blog/templates/dashboard.html5
-rw-r--r--arduino_blog/static/arduino_blog/templates/home.html6
-rw-r--r--arduino_blog/static/arduino_blog/templates/submit-cfp.html8
-rw-r--r--arduino_blog/static/arduino_blog/templates/user-register.html14
-rw-r--r--arduino_blog/static/arduino_blog/templates/view-proposals.html107
-rw-r--r--arduino_blog/urls.py5
-rw-r--r--arduino_blog/views.py98
-rwxr-xr-xarduino_projects_website/config.py5
-rw-r--r--arduino_projects_website/settings.py4
14 files changed, 374 insertions, 32 deletions
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 %}
+ <section id="abstract_details" class="section abstract_details">
+ <div class="container">
+ <p>
+ <center>
+ <h2>Abstract Details</h2>
+ </center>
+ </p>
+ <h3><span class="label label-primary">{{ proposal.user.first_name }} {{ proposal.user.last_name }}</span></h3>
+ <hr>
+ <p><b>Title: </b>&nbsp;{{ proposal.title_of_the_project }}</p>
+ <p><b>Name of the author:</b>&nbsp;{{proposal.name_of_author}}
+ </p>
+ <p><b>About the authors: </b>&nbsp;{{ proposal.about_the_author | linebreaks }}</p>
+ <p><b>Abstract: </b>&nbsp;{{ proposal.abstract | linebreaks }}</p>
+ <p><b>Date Created: </b>&nbsp;{{ proposal.date_created }}</p>
+ <h4>Comments</h4>
+ {% for comment in comments %}
+ <div>
+ <strong>Comment By:</strong>
+ {{ user.first_name }} {{ user.last_name }}
+ <p>{{ comment.body| linebreaks }}</p>
+ </div>
+ <hr>
+ {% endfor %}
+ </div>
+ </section>
+ {% endblock %}
diff --git a/arduino_blog/static/arduino_blog/templates/comment-abstract.html b/arduino_blog/static/arduino_blog/templates/comment-abstract.html
new file mode 100755
index 0000000..e3d7677
--- /dev/null
+++ b/arduino_blog/static/arduino_blog/templates/comment-abstract.html
@@ -0,0 +1,39 @@
+{% extends "base.html" %}
+{% load static %}
+{% load widget_tweaks %}
+{% block content %}
+
+<section id="comment_abstract" class="section comment_abstract">
+ <div class="container">
+ <h3>{{ proposal.user.first_name }} {{ proposal.user.last_name }}</h3>
+ <p><b>Title: </b>&nbsp;{{ proposal.title_of_the_project }}</p>
+ <p><b>Name of the author:</b>&nbsp;<span>{{proposal.name_of_author}}</span>
+ </p>
+ <p align="justify"><b>About the authors: </b>&nbsp;{{ proposal.about_the_author |linebreaks }}</p>
+
+ <p align="justify"><b>Abstract:</b>&nbsp;
+
+ {{ proposal.abstract | linebreaks }}
+ </p>
+ <p><b>Date Created: </b>&nbsp;{{ proposal.date_created }}</p>
+ <h4>Comments</h4>
+ {% for comment in comments %}
+ <div>
+ <strong>Comment By:</strong>
+ {{ user.first_name }} {{ user.last_name }}
+ <p>{{ comment.body| linebreaks }}</p>
+ </div>
+ <hr>
+ </form>
+ {% endfor %}
+ <form action="{% url 'arduino_blog:comment_abstract' proposal.id %}" method='POST' enctype="multipart/form-data">
+ {% csrf_token %}
+ <textarea rows="5" cols="100" id="comment" class= "comment" name="comment" placeholder = "Add comment here..."></textarea><br/>
+ <input class="button special" type="submit" value="Comment">
+ <a href="{% url 'arduino_blog:view_abstracts' %}" class="btn btn-primary">Back</a>
+ </form>
+ </div>
+ </section>
+ {% endblock %}
+
+
diff --git a/arduino_blog/static/arduino_blog/templates/dashboard.html b/arduino_blog/static/arduino_blog/templates/dashboard.html
index a4528a8..5a5fab6 100644
--- a/arduino_blog/static/arduino_blog/templates/dashboard.html
+++ b/arduino_blog/static/arduino_blog/templates/dashboard.html
@@ -8,14 +8,17 @@
<center>
<div class="alert alert-success" role="alert">
<strong> {{ msg }} </strong>
+
</div>
- <!-- <a href="{{URL_ROOT}}/exam/"> Home </a> -->
+
+ <a href="{% url 'arduino_blog:view_abstracts' %}"> View Abstracts </a>
</center>
{% else %}
{% if msg %}
<center>
<div class="alert alert-warning" role="alert">
<strong> {{ msg }} </strong>
+ <p>Click here to view your proposal</p>
</div>
{% endif %}
{% endif %}
diff --git a/arduino_blog/static/arduino_blog/templates/home.html b/arduino_blog/static/arduino_blog/templates/home.html
index af83742..a1feb61 100644
--- a/arduino_blog/static/arduino_blog/templates/home.html
+++ b/arduino_blog/static/arduino_blog/templates/home.html
@@ -10,13 +10,13 @@
<div class="container">
<h1>Open Source Hardware Project</h1>
<p class="lead text-muted text-justify">
- 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.
</p>
<p class="lead text-muted text-justify">
- 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!
</p>
<p class="lead text-muted text-justify">
- 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!
</p>
<p>
<a href="{% url 'arduino_blog:submitabstract' %}" class="btn btn-primary my-2">Contribute first</a>
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 @@
<div id="charNum"></div>
</label>
</div>
+
+ <div class="form-group">
+ <label for="abstract">References
+
+ </label>
+ {% render_field proposal_form.references %}
+
+ </div>
<div class="form-group">
<label for="abstract">Expected completion date (Approx. 1 month)
diff --git a/arduino_blog/static/arduino_blog/templates/user-register.html b/arduino_blog/static/arduino_blog/templates/user-register.html
index 2b2fde6..b535e48 100644
--- a/arduino_blog/static/arduino_blog/templates/user-register.html
+++ b/arduino_blog/static/arduino_blog/templates/user-register.html
@@ -82,19 +82,7 @@
</td>
<td style="vertical-align:bottom;border-top:none;!important">
<div class="align-baseline">
- {% render_field form.title %}{% render_field form.first_name %} {% render_field form.last_name %}
- </div>
- </td>
- </tr>
- <tr>
- <td style="vertical-align:bottom;border-top:none;!important">
- <div class="align-baseline">
- <label for="contact">Contact:</label><span style="color:red;">*</span>
- </div>
- </td>
- <td style="vertical-align:bottom;border-top:none;!important">
- <div class="align-baseline">
- {% render_field form.phone %}
+ {% render_field form.first_name %} {% render_field form.last_name %}
</div>
</td>
</tr>
diff --git a/arduino_blog/static/arduino_blog/templates/view-proposals.html b/arduino_blog/static/arduino_blog/templates/view-proposals.html
new file mode 100644
index 0000000..140a0fc
--- /dev/null
+++ b/arduino_blog/static/arduino_blog/templates/view-proposals.html
@@ -0,0 +1,107 @@
+{% extends "base.html" %}
+{% load static %}
+ {% block content %}
+<section id="view_proposal" class="section view_proposal">
+ <div class="container">
+ <p>
+ <center>
+ <h2>View Proposals</h2>
+ </center>
+ </p>
+ <form action="" method="post" onsubmit="return confirm('Are You Sure?');">
+ {% csrf_token %}
+
+ <div class="table-responsive">
+ <table id ="myTable" width="100%" cellpadding="10" class="table table-striped table-bordered table-hover tablesorter">
+ <colgroup>
+ {% if user.is_staff %}
+
+ <col width="15%" />
+ <col width="20%" />
+
+ <col width="30%" />
+ <col width="10%" />
+ {% else %}
+ <col width="70%" />
+ <col width="10%" />
+ <col width="10%" />
+
+ {% endif %}
+ </colgroup>
+ {% if user.is_staff %}
+ <th style="text-align: center;"></th>
+ <th style="text-align: center;">Speaker
+ {% endif %}
+
+ <th style="text-align: center;"> Title
+ {% if not user.is_staff %}
+ <th style="text-align: center;"> View
+ {% endif %}
+
+ <th style="text-align: center;"> Status
+ {% for proposal in proposals %}
+ <tr>
+ {% if user.is_staff %}
+ <td style="text-align: center;">
+ {% if proposal.status == 'Rejected' %}
+ {% else %}
+ <center>
+ <input type = "checkbox" name="delete_proposal" value = {{proposal.id}}></input>
+ </center>
+ </td>
+ {% endif %}
+ <td style="text-align: center;">
+ <h3>
+ <span class="label label-primary">{{ proposal.user.first_name }} {{ proposal.user.last_name }}</span>
+ </h3>
+ </td>
+ {% endif %}
+ {% if user.is_staff %}
+ <td style="white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:.5px;">
+ <a title="Title : {{proposal.title}}, Tags: {{proposal.tags}}" href="{% url 'arduino_blog:abstract_details' proposal.id %}">{{proposal.title_of_the_project}}</a>
+ </td>
+ {% else %}
+ <td style="white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:.5px;"> {{proposal.title_of_the_project}}</td>
+ <td style="text-align: center;">
+ <a href="{% url 'arduino_blog:abstract_details' proposal.id %}" class="btn btn-warning">View</a>
+ </td>
+ {% endif %}
+ <td style="text-align: center;">
+ {% if proposal.status == 'Accepted' %}
+ <h5 style="color:green;">{{proposal.status}}</h5>
+ {% elif proposal.status == 'Rejected' %}
+ <h5 style="color:red;">{{proposal.status}}</h5>
+ {% elif proposal.status == 'Commented' %}
+ <h5 style="color:brown;">{{proposal.status}}</h5>
+ {% elif proposal.status == 'Edit' %}
+ {% if user.is_staff %}
+ <h5 style="color:grey;">{{proposal.status}}</h5>
+ {% else %}
+ <a href="{% url 'arduino_blog:edit_proposal' proposal.id %}" class ="btn btn-info">{{proposal.status}}</a>
+ {% endif %}
+ {% else %}
+ <h5 style="color:#ff6600;">{{proposal.status}}</h5>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+ <br>
+
+
+ {% if user.is_staff %}
+ <!-- <input type="submit" id="delete" class ="btn btn-info" value="Delete" name="delete"/> -->
+ <center>
+ <input type="submit" id="accept" class ="btn btn-info" value="Accept" name="accept"/>
+ <input type="submit" id="rejected" class ="btn btn-info" value="Reject" name="reject"/>
+ <input type="submit" id="resubmit" class ="btn btn-info" value="Resubmit" name="resubmit"/>
+ </center>
+ {% endif %}
+ </form>
+ </div>
+ </div>
+ </div>
+ <div class="row" style="margin-top: 18vh;"></div>
+ </section>
+ {% endblock %} \ No newline at end of file
diff --git a/arduino_blog/urls.py b/arduino_blog/urls.py
index 0ef6a92..0b06838 100644
--- a/arduino_blog/urls.py
+++ b/arduino_blog/urls.py
@@ -7,6 +7,11 @@ from . import views
app_name = 'arduino_blog'
urlpatterns = [
+ re_path(r'^comment-abstract/(?P<proposal_id>\d+)$',
+ views.comment_abstract, name='comment_abstract'),
+ re_path(r'^abstract-details/(?P<proposal_id>\d+)$',
+ views.abstract_details, name='abstract_details'),
+ url(r'^view-abstracts/$', views.view_abstracts, name="view_abstracts"),
url(r'^accounts/logout/$', views.user_logout, name="user_logout"),
url(r'^activate/(?P<key>.+)$', views.activate_user, name="activate"),
url(r'^new_activation/$', views.new_activation, name='new_activation'),
diff --git a/arduino_blog/views.py b/arduino_blog/views.py
index c16cf9f..c6afe99 100644
--- a/arduino_blog/views.py
+++ b/arduino_blog/views.py
@@ -12,7 +12,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from arduino_blog.forms import UserRegistrationForm, AbstractProposalForm, UserLoginForm
from django.contrib.auth import authenticate, login, logout
-from arduino_blog.models import Proposal, Profile
+from arduino_blog.models import Proposal, Profile, Comment
from .send_emails import (send_user_mail,
generate_activation_key)
from django.utils import timezone
@@ -243,3 +243,99 @@ def send_email(sender_email, to, subject, message, bcc_email=None):
print("mail sent")
email.send(fail_silently=True)
+@login_required
+@csrf_protect
+def view_abstracts(request):
+ user = request.user
+ context = {}
+ count_list = []
+ if request.user.is_authenticated:
+ if user.is_staff:
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ return render(request, 'view-proposals.html', context)
+ elif user is not None:
+ if Proposal.objects.filter(user=user).exists:
+ proposals = Proposal.objects.filter(
+ user=user)
+ context['counts'] = count_list
+ context['proposals'] = proposals
+ context['user'] = user
+ return render(request, 'view-proposals.html', context)
+ else:
+ return render(request, 'login.html')
+ else:
+ return render(request, 'login.html', context)
+
+@login_required
+def abstract_details(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ comments = Comment.objects.filter(object_id = proposal_id)
+ context['comments'] = comments
+ proposal = Proposal.objects.get(id=proposal_id)
+ context['proposal'] = proposal
+ context['user'] = user
+ return render(request, 'comment-abstract.html', context)
+ elif user is not None:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ comments = Comment.objects.filter(object_id= proposal_id)
+ if proposal.user == user:
+ try:
+ context['proposal'] = proposal
+ context['comments'] = comments
+ except:
+ pass
+ context['comments'] = comments
+ context['proposal'] = proposal
+ context['user'] = user
+ return render(request, 'abstract-details.html', context)
+ else:
+ return render(request, 'home.html', context)
+ except:
+ return render(request, 'abstract-details.html', context)
+ else:
+ return render(request, 'home.html', context)
+ else:
+ return render(request, 'home.html', context)
+
+@login_required
+def comment_abstract(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if request.method == 'POST':
+ #comment = Comment()
+ text = request.POST.get('comment')
+ #comment.user = user
+ comment = Comment.objects.create(content_object=proposal, body = text, user=request.user)
+ comment.save()
+ proposal.status = "Commented"
+ proposal.save()
+ comments = Comment.objects.filter(user= request.user)
+ context['proposal'] = proposal
+ context['comments'] = comments
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ comments = Comment.objects.filter(user=user)
+ context['proposal'] = proposal
+ context['comments'] = comments
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ except:
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request)) \ No newline at end of file
diff --git a/arduino_projects_website/config.py b/arduino_projects_website/config.py
index 6709890..1a61ae1 100755
--- a/arduino_projects_website/config.py
+++ b/arduino_projects_website/config.py
@@ -9,6 +9,7 @@ SYS_SERVER_EMAIL = 'email@email'
ALLOWED_HOSTS_USER = ['127.0.0.1']
SECRET_KEY_USER = 'sadsdasdasd' # enter secret key
+
DEBUG_USER = True
TO_EMAIL = 'email@email'
@@ -31,8 +32,8 @@ PRODUCTION_URL = ''
EMAIL_HOST_USER_SERVER = 'localhost'
EMAIL_HOST_PASSWORD_SERVER = ''
EMAIL_USE_TLS_SERVER = False
-SENDER_NAME = "" # sender name
-SENDER_EMAIL = "" # sender email
+SENDER_NAME = "FOSSEE" # sender name
+SENDER_EMAIL = "info@fossee.in" # sender email
REPLY_EMAIL = "" # reply email
diff --git a/arduino_projects_website/settings.py b/arduino_projects_website/settings.py
index 97dba22..93e9a78 100644
--- a/arduino_projects_website/settings.py
+++ b/arduino_projects_website/settings.py
@@ -133,8 +133,8 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static/")
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
MEDIA_URL = "/downloads/"
-#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
-EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
+#EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
SENDER_EMAIL = SENDER_EMAIL