mirror of
https://github.com/Rushilwiz/NewViewsNews.git
synced 2025-04-11 07:30:17 -04:00
added canvas, cards, made about look good, and some other nice fixes
This commit is contained in:
parent
298f9441ef
commit
bc6fb1496a
|
@ -175,6 +175,10 @@ STATIC_URL = '/static/'
|
|||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static"),
|
||||
]
|
||||
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||
|
||||
LOGIN_URL = 'login'
|
||||
|
|
|
@ -24,6 +24,8 @@ from django.contrib.auth import views as auth_views
|
|||
from users import views as user_views
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('news.urls')),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
path('register/', user_views.register, name='register'),
|
||||
|
@ -31,12 +33,11 @@ urlpatterns = [
|
|||
path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'),
|
||||
path('profile/', user_views.profile, name='profile'),
|
||||
path('profile/password/', user_views.password, name='password'),
|
||||
path('values/', user_views.values, name='values'),
|
||||
|
||||
path('oauth/', include('social_django.urls', namespace='social')),
|
||||
|
||||
path('', include('news.urls')),
|
||||
]
|
||||
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
BIN
media/article-headers/techarmour.png
Normal file
BIN
media/article-headers/techarmour.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
32
news/migrations/0001_initial.py
Normal file
32
news/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.1 on 2020-08-16 06:32
|
||||
|
||||
import ckeditor.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Article',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('headline', models.CharField(max_length=100)),
|
||||
('content', ckeditor.fields.RichTextField(blank=True, null=True)),
|
||||
('date_published', models.DateTimeField(auto_now_add=True)),
|
||||
('likes', models.IntegerField(default=0)),
|
||||
('header', models.ImageField(blank=True, default='default-header.jpg', null=True, upload_to='article-headers')),
|
||||
('header_caption', models.CharField(default='', max_length=100)),
|
||||
('tag', models.CharField(choices=[('authoritarian_left', 'Authoritarian Left'), ('authoritarian_right', 'Authoritarian Right'), ('libertarian_left', 'Libertarian Left'), ('libertarian_right', 'Libertarian Right')], default='libertarian_left', max_length=19)),
|
||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
0
news/migrations/__init__.py
Normal file
0
news/migrations/__init__.py
Normal file
|
@ -29,12 +29,12 @@ class Article(models.Model):
|
|||
date_published = models.DateTimeField(auto_now_add=True)
|
||||
author = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
likes = models.IntegerField(default=0)
|
||||
header = models.ImageField(default='default-header.jpg', upload_to='article-headers')
|
||||
header = models.ImageField(null=True, blank=True, default='default-header.jpg', upload_to='article-headers')
|
||||
header_caption = models.CharField(max_length=100, default="")
|
||||
tag = models.CharField(max_length=19,choices=POLITICAL_CHOICES,default=A_L)
|
||||
tag = models.CharField(max_length=19,choices=POLITICAL_CHOICES,default=L_L)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.author}'s article on {self.date_published}"
|
||||
return f"{self.headline} by {self.author}"
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('article-detail', kwargs={'pk': self.pk})
|
||||
|
|
BIN
news/static/news/css/res/chris.jpg
Normal file
BIN
news/static/news/css/res/chris.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
news/static/news/css/res/josh.jpg
Normal file
BIN
news/static/news/css/res/josh.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 110 KiB |
BIN
news/static/news/css/res/rushil.jpg
Normal file
BIN
news/static/news/css/res/rushil.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 KiB |
BIN
news/static/news/css/res/spekr.png
Normal file
BIN
news/static/news/css/res/spekr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
news/static/news/css/res/zaeem.jpg
Normal file
BIN
news/static/news/css/res/zaeem.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 215 KiB |
|
@ -1,5 +1,68 @@
|
|||
{% extends 'news/base.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<h1>About NewViewsNews</h1>
|
||||
<h3><p>In this day and age, close-mindedness and echochambers prevent others from being exposed to people who offer varying perspectives. This has caused a lot of conflict within our society. Our solution: NewViewsNews.</p> <p>NewViewsNews is a crowdsourcing news site that allows you to view the news and opinions of people who have opposing political views. To get started, you simply make an account and specify your position on the political compass. After that, you can write your own posts and view other posts! Our algorithms will display posts from individuals on the opposite side of the compass on your home page.</p> <p>NewViewsNews is paving the way for an open minded and more understanding community. Join us today!</p></h3>
|
||||
<h5 class="text-center">In this day and age, close-mindedness and echochambers prevent others from being exposed to people who offer varying perspectives. This has caused a lot of conflict within our society. Our solution: NewViewsNews.</h5>
|
||||
<img width="100%" src="{% static 'news/css/res/logo.svg'%}" alt="logo">
|
||||
<br><br><br>
|
||||
<p>NewViewsNews is a crowdsourcing news site that allows you to view the news and opinions of people who have opposing political views. To get started, you simply make an account and specify your position on the political compass. After that, you can write your own posts and view other posts! Our algorithms will display posts from individuals on the opposite side of the compass on your home page.</p>
|
||||
<p>NewViewsNews is paving the way for an open minded and more understanding community. <a href="{% url 'login' %}">Join us today!</a></p>
|
||||
|
||||
<div class="row text-center">
|
||||
<!-- Team item-->
|
||||
<div class="col-xl-3 col-sm-6 mb-5">
|
||||
<div class="bg-white rounded shadow-sm py-5 px-4"><img src="{% static 'news/css/res/rushil.jpg' %}" alt="" width="100" class="img-fluid rounded-circle mb-3 img-thumbnail shadow-sm">
|
||||
<h5 class="mb-0">Rushil Umaretiya</h5><span class="small text-uppercase text-muted">developer - team member</span>
|
||||
<ul class="social mb-0 list-inline mt-3">
|
||||
<li class="list-inline-item"><a href="https://github.com/rushilwiz" class="social-link"><i class="fa fa-github"></i></a></li>
|
||||
<li class="list-inline-item"><a href="https://twitter.com/rushilwiz" class="social-link"><i class="fa fa-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a href="https://instagram.com/rushilwiz" class="social-link"><i class="fa fa-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a href="https://linkedin.com/rushilwiz" class="social-link"><i class="fa fa-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End-->
|
||||
|
||||
<!-- Team item-->
|
||||
<div class="col-xl-3 col-sm-6 mb-5">
|
||||
<div class="bg-white rounded shadow-sm py-5 px-4"><img src="{% static 'news/css/res/chris.jpg' %}" alt="" width="100" class="img-fluid rounded-circle mb-3 img-thumbnail shadow-sm">
|
||||
<h5 class="mb-0">Christopher Arraya</h5><span class="small text-uppercase text-muted">developer - team member</span>
|
||||
<ul class="social mb-0 list-inline mt-3">
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-facebook-f"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End-->
|
||||
|
||||
<!-- Team item-->
|
||||
<div class="col-xl-3 col-sm-6 mb-5">
|
||||
<div class="bg-white rounded shadow-sm py-5 px-4"><img src="{% static 'news/css/res/zaeem.jpg' %}" alt="" width="100" class="img-fluid rounded-circle mb-3 img-thumbnail shadow-sm">
|
||||
<h5 class="mb-0">Zaeem Qureshi</h5><span class="small text-uppercase text-muted">developer - team member</span>
|
||||
<ul class="social mb-0 list-inline mt-3">
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-facebook-f"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End-->
|
||||
|
||||
<!-- Team item-->
|
||||
<div class="col-xl-3 col-sm-6 mb-5">
|
||||
<div class="bg-white rounded shadow-sm py-5 px-4"><img src="{% static 'news/css/res/josh.jpg' %}" alt="" width="100" class="img-fluid rounded-circle mb-3 img-thumbnail shadow-sm">
|
||||
<h5 class="mb-0">Joshua Lim</h5><span class="small text-uppercase text-muted">developer - team member</span>
|
||||
<ul class="social mb-0 list-inline mt-3">
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-facebook-f"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a href="#" class="social-link"><i class="fa fa-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End-->
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
<div class="content-section">
|
||||
<form method="post">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<fieldset class="form-group">
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'news/css/styles.css' %}">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="{% static 'news/favicon.ico' %}" type="image/x-icon">
|
||||
<link rel="icon" href="{% static 'news/favicon.ico' %}/favicon.ico" type="image/x-icon">
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
{% extends "news/base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
{% for article in articles %}
|
||||
<article class="media content-section">
|
||||
<img class="rounded-circle article-img" src="{{ article.author.profile.profile_pic.url}}" alt="Profile Picture">
|
||||
<div class="media-body">
|
||||
<div class="article-metadata">
|
||||
<a class="mr-2" href="{% url 'user-articles' article.author.username %}">{{ article.author.get_full_name }}</a>
|
||||
<a href="{% url 'user-articles' article.author.username %}"><small class="text-muted">@{{ article.author }} · {{ article.date_published }}</small></a>
|
||||
<div class="col-lg-4 col-sm-6 mb-4" style="margin-top: 2%">
|
||||
<div class="card shadow border-0 h-100"><a href="">
|
||||
<img src="{{ article.header.url }}" alt="..." class="img-fluid card-img-top"></a>
|
||||
<div class="card-body"><a href="" class="text-uppercase text-muted text-sm letter-spacing-2">{{ post.category }} </a>
|
||||
<h5 class="my-2"><a href="post.html" class="text-dark">{{ article.headline }}</a></h5>
|
||||
<a href="{% url 'user-articles' article.author.username %}">{{ article.author.get_full_name }}<small class="text-muted"> · @{{ article.author }} · {{ article.date_published }}</small></a>
|
||||
<p class="my-2 text-muted text-sm">{{ article.content|safe|truncatechars_html:70|linebreaks }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="article-content font-weight-light"><a class="nounderline" href="{% url 'article-detail' article.id %}">{{ article.headline }}</a></p>
|
||||
|
||||
{% if forloop.counter|divisibleby:3 %}
|
||||
</div><!-- close existing row and open another one-->
|
||||
<div class="row">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
{% if is_paginated %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% if page_obj.has_previous %}
|
||||
<a class="btn btn-outline-info mb-4" href="?page=1">First</a>
|
||||
<a class="btn btn-outline-info mb-4" href="?page={{ page_obj.previous_page_number }}">Previous</a>
|
||||
|
|
153
news/templates/news/policy.html
Normal file
153
news/templates/news/policy.html
Normal file
|
@ -0,0 +1,153 @@
|
|||
<h1>Privacy Policy</h1>
|
||||
<p>Last updated: August 16, 2020</p>
|
||||
<p>This Privacy Policy describes Our policies and procedures on the collection, use and disclosure of Your information when You use the Service and tells You about Your privacy rights and how the law protects You.</p>
|
||||
<p>We use Your Personal data to provide and improve the Service. By using the Service, You agree to the collection and use of information in accordance with this Privacy Policy. This Privacy Policy has been created with the help of the <a href="https://www.termsfeed.com/privacy-policy-generator/" target="_blank">Privacy Policy Generator</a>.</p>
|
||||
<h1>Interpretation and Definitions</h1>
|
||||
<h2>Interpretation</h2>
|
||||
<p>The words of which the initial letter is capitalized have meanings defined under the following conditions. The following definitions shall have the same meaning regardless of whether they appear in singular or in plural.</p>
|
||||
<h2>Definitions</h2>
|
||||
<p>For the purposes of this Privacy Policy:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Account</strong> means a unique account created for You to access our Service or parts of our Service.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Company</strong> (referred to as either "the Company", "We", "Us" or "Our" in this Agreement) refers to NewViewsNews.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Cookies</strong> are small files that are placed on Your computer, mobile device or any other device by a website, containing the details of Your browsing history on that website among its many uses.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Country</strong> refers to: Virginia, United States</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Device</strong> means any device that can access the Service such as a computer, a cellphone or a digital tablet.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Personal Data</strong> is any information that relates to an identified or identifiable individual.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Service</strong> refers to the Website.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Service Provider</strong> means any natural or legal person who processes the data on behalf of the Company. It refers to third-party companies or individuals employed by the Company to facilitate the Service, to provide the Service on behalf of the Company, to perform services related to the Service or to assist the Company in analyzing how the Service is used.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Third-party Social Media Service</strong> refers to any website or any social network website through which a User can log in or create an account to use the Service.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Usage Data</strong> refers to data collected automatically, either generated by the use of the Service or from the Service infrastructure itself (for example, the duration of a page visit).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Website</strong> refers to NewViewsNews, accessible from <a href="https://newviewsnews.crucialnet.org" rel="external nofollow noopener" target="_blank">https://newviewsnews.crucialnet.org</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>You</strong> means the individual accessing or using the Service, or the company, or other legal entity on behalf of which such individual is accessing or using the Service, as applicable.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>Collecting and Using Your Personal Data</h1>
|
||||
<h2>Types of Data Collected</h2>
|
||||
<h3>Personal Data</h3>
|
||||
<p>While using Our Service, We may ask You to provide Us with certain personally identifiable information that can be used to contact or identify You. Personally identifiable information may include, but is not limited to:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Email address</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>First name and last name</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Usage Data</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Usage Data</h3>
|
||||
<p>Usage Data is collected automatically when using the Service.</p>
|
||||
<p>Usage Data may include information such as Your Device's Internet Protocol address (e.g. IP address), browser type, browser version, the pages of our Service that You visit, the time and date of Your visit, the time spent on those pages, unique device identifiers and other diagnostic data.</p>
|
||||
<p>When You access the Service by or through a mobile device, We may collect certain information automatically, including, but not limited to, the type of mobile device You use, Your mobile device unique ID, the IP address of Your mobile device, Your mobile operating system, the type of mobile Internet browser You use, unique device identifiers and other diagnostic data.</p>
|
||||
<p>We may also collect information that Your browser sends whenever You visit our Service or when You access the Service by or through a mobile device.</p>
|
||||
<h3>Tracking Technologies and Cookies</h3>
|
||||
<p>We use Cookies and similar tracking technologies to track the activity on Our Service and store certain information. Tracking technologies used are beacons, tags, and scripts to collect and track information and to improve and analyze Our Service.</p>
|
||||
<p>You can instruct Your browser to refuse all Cookies or to indicate when a Cookie is being sent. However, if You do not accept Cookies, You may not be able to use some parts of our Service.</p>
|
||||
<p>Cookies can be "Persistent" or "Session" Cookies. Persistent Cookies remain on your personal computer or mobile device when You go offline, while Session Cookies are deleted as soon as You close your web browser. Learn more about cookies: <a href="https://www.termsfeed.com/blog/cookies/" target="_blank">All About Cookies</a>.</p>
|
||||
<p>We use both session and persistent Cookies for the purposes set out below:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Necessary / Essential Cookies</strong></p>
|
||||
<p>Type: Session Cookies</p>
|
||||
<p>Administered by: Us</p>
|
||||
<p>Purpose: These Cookies are essential to provide You with services available through the Website and to enable You to use some of its features. They help to authenticate users and prevent fraudulent use of user accounts. Without these Cookies, the services that You have asked for cannot be provided, and We only use these Cookies to provide You with those services.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Cookies Policy / Notice Acceptance Cookies</strong></p>
|
||||
<p>Type: Persistent Cookies</p>
|
||||
<p>Administered by: Us</p>
|
||||
<p>Purpose: These Cookies identify if users have accepted the use of cookies on the Website.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Functionality Cookies</strong></p>
|
||||
<p>Type: Persistent Cookies</p>
|
||||
<p>Administered by: Us</p>
|
||||
<p>Purpose: These Cookies allow us to remember choices You make when You use the Website, such as remembering your login details or language preference. The purpose of these Cookies is to provide You with a more personal experience and to avoid You having to re-enter your preferences every time You use the Website.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>For more information about the cookies we use and your choices regarding cookies, please visit our Cookies Policy or the Cookies section of our Privacy Policy.</p>
|
||||
<h2>Use of Your Personal Data</h2>
|
||||
<p>The Company may use Personal Data for the following purposes:</p>
|
||||
<ul>
|
||||
<li><strong>To provide and maintain our Service</strong>, including to monitor the usage of our Service.</li>
|
||||
<li><strong>To manage Your Account:</strong> to manage Your registration as a user of the Service. The Personal Data You provide can give You access to different functionalities of the Service that are available to You as a registered user.</li>
|
||||
<li><strong>For the performance of a contract:</strong> the development, compliance and undertaking of the purchase contract for the products, items or services You have purchased or of any other contract with Us through the Service.</li>
|
||||
<li><strong>To contact You:</strong> To contact You by email, telephone calls, SMS, or other equivalent forms of electronic communication, such as a mobile application's push notifications regarding updates or informative communications related to the functionalities, products or contracted services, including the security updates, when necessary or reasonable for their implementation.</li>
|
||||
<li><strong>To provide You</strong> with news, special offers and general information about other goods, services and events which we offer that are similar to those that you have already purchased or enquired about unless You have opted not to receive such information.</li>
|
||||
<li><strong>To manage Your requests:</strong> To attend and manage Your requests to Us.</li>
|
||||
</ul>
|
||||
<p>We may share your personal information in the following situations:</p>
|
||||
<ul>
|
||||
<li><strong>With Service Providers:</strong> We may share Your personal information with Service Providers to monitor and analyze the use of our Service, to contact You.</li>
|
||||
<li><strong>For Business transfers:</strong> We may share or transfer Your personal information in connection with, or during negotiations of, any merger, sale of Company assets, financing, or acquisition of all or a portion of our business to another company.</li>
|
||||
<li><strong>With Affiliates:</strong> We may share Your information with Our affiliates, in which case we will require those affiliates to honor this Privacy Policy. Affiliates include Our parent company and any other subsidiaries, joint venture partners or other companies that We control or that are under common control with Us.</li>
|
||||
<li><strong>With Business partners:</strong> We may share Your information with Our business partners to offer You certain products, services or promotions.</li>
|
||||
<li><strong>With other users:</strong> when You share personal information or otherwise interact in the public areas with other users, such information may be viewed by all users and may be publicly distributed outside. If You interact with other users or register through a Third-Party Social Media Service, Your contacts on the Third-Party Social Media Service may see Your name, profile, pictures and description of Your activity. Similarly, other users will be able to view descriptions of Your activity, communicate with You and view Your profile.</li>
|
||||
</ul>
|
||||
<h2>Retention of Your Personal Data</h2>
|
||||
<p>The Company will retain Your Personal Data only for as long as is necessary for the purposes set out in this Privacy Policy. We will retain and use Your Personal Data to the extent necessary to comply with our legal obligations (for example, if we are required to retain your data to comply with applicable laws), resolve disputes, and enforce our legal agreements and policies.</p>
|
||||
<p>The Company will also retain Usage Data for internal analysis purposes. Usage Data is generally retained for a shorter period of time, except when this data is used to strengthen the security or to improve the functionality of Our Service, or We are legally obligated to retain this data for longer time periods.</p>
|
||||
<h2>Transfer of Your Personal Data</h2>
|
||||
<p>Your information, including Personal Data, is processed at the Company's operating offices and in any other places where the parties involved in the processing are located. It means that this information may be transferred to — and maintained on — computers located outside of Your state, province, country or other governmental jurisdiction where the data protection laws may differ than those from Your jurisdiction.</p>
|
||||
<p>Your consent to this Privacy Policy followed by Your submission of such information represents Your agreement to that transfer.</p>
|
||||
<p>The Company will take all steps reasonably necessary to ensure that Your data is treated securely and in accordance with this Privacy Policy and no transfer of Your Personal Data will take place to an organization or a country unless there are adequate controls in place including the security of Your data and other personal information.</p>
|
||||
<h2>Disclosure of Your Personal Data</h2>
|
||||
<h3>Business Transactions</h3>
|
||||
<p>If the Company is involved in a merger, acquisition or asset sale, Your Personal Data may be transferred. We will provide notice before Your Personal Data is transferred and becomes subject to a different Privacy Policy.</p>
|
||||
<h3>Law enforcement</h3>
|
||||
<p>Under certain circumstances, the Company may be required to disclose Your Personal Data if required to do so by law or in response to valid requests by public authorities (e.g. a court or a government agency).</p>
|
||||
<h3>Other legal requirements</h3>
|
||||
<p>The Company may disclose Your Personal Data in the good faith belief that such action is necessary to:</p>
|
||||
<ul>
|
||||
<li>Comply with a legal obligation</li>
|
||||
<li>Protect and defend the rights or property of the Company</li>
|
||||
<li>Prevent or investigate possible wrongdoing in connection with the Service</li>
|
||||
<li>Protect the personal safety of Users of the Service or the public</li>
|
||||
<li>Protect against legal liability</li>
|
||||
</ul>
|
||||
<h2>Security of Your Personal Data</h2>
|
||||
<p>The security of Your Personal Data is important to Us, but remember that no method of transmission over the Internet, or method of electronic storage is 100% secure. While We strive to use commercially acceptable means to protect Your Personal Data, We cannot guarantee its absolute security.</p>
|
||||
<h1>Your California Privacy Rights (California's Shine the Light law)</h1>
|
||||
<p>Under California Civil Code Section 1798 (California's Shine the Light law), California residents with an established business relationship with us can request information once a year about sharing their Personal Data with third parties for the third parties' direct marketing purposes.</p>
|
||||
<p>If you'd like to request more information under the California Shine the Light law, and if you are a California resident, You can contact Us using the contact information provided below.</p>
|
||||
<h1>California Privacy Rights for Minor Users (California Business and Professions Code Section 22581)</h1>
|
||||
<p>California Business and Professions Code section 22581 allow California residents under the age of 18 who are registered users of online sites, services or applications to request and obtain removal of content or information they have publicly posted.</p>
|
||||
<p>To request removal of such data, and if you are a California resident, You can contact Us using the contact information provided below, and include the email address associated with Your account.</p>
|
||||
<p>Be aware that Your request does not guarantee complete or comprehensive removal of content or information posted online and that the law may not permit or require removal in certain circumstances.</p>
|
||||
<h1>Links to Other Websites</h1>
|
||||
<p>Our Service may contain links to other websites that are not operated by Us. If You click on a third party link, You will be directed to that third party's site. We strongly advise You to review the Privacy Policy of every site You visit.</p>
|
||||
<p>We have no control over and assume no responsibility for the content, privacy policies or practices of any third party sites or services.</p>
|
||||
<h1>Changes to this Privacy Policy</h1>
|
||||
<p>We may update our Privacy Policy from time to time. We will notify You of any changes by posting the new Privacy Policy on this page.</p>
|
||||
<p>We will let You know via email and/or a prominent notice on Our Service, prior to the change becoming effective and update the "Last updated" date at the top of this Privacy Policy.</p>
|
||||
<p>You are advised to review this Privacy Policy periodically for any changes. Changes to this Privacy Policy are effective when they are posted on this page.</p>
|
||||
<h1>Contact Us</h1>
|
||||
<p>If you have any questions about this Privacy Policy, You can contact us:</p>
|
||||
<ul>
|
||||
<li>By email: r@crucialnet.org</li>
|
||||
</ul>
|
|
@ -12,6 +12,7 @@ from . import views
|
|||
urlpatterns = [
|
||||
path('', views.home, name='home'),
|
||||
path('about/', views.about, name='about'),
|
||||
path('policy/', views.policy, name='privacy-policy'),
|
||||
|
||||
path('user/<str:username>', UserArticleListView.as_view(), name='user-articles'),
|
||||
path('article/<int:pk>/', ArticleDetailView.as_view(), name='article-detail'),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.shortcuts import render, get_object_or_404
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
||||
from django.views.generic import (
|
||||
ListView,
|
||||
|
@ -15,16 +16,69 @@ from users.models import Profile
|
|||
|
||||
# Create your views here.
|
||||
|
||||
@login_required
|
||||
def about (request):
|
||||
createProfileIfNotExist(request)
|
||||
if checkValues(request) is False:
|
||||
return redirect('values')
|
||||
|
||||
return render (request, 'news/about.html')
|
||||
|
||||
def policy (request):
|
||||
return render (request, 'news/policy.html')
|
||||
|
||||
@login_required
|
||||
def home (request):
|
||||
createProfileIfNotExist(request)
|
||||
if checkValues(request) is False:
|
||||
return redirect('values')
|
||||
|
||||
profile = request.user.profile
|
||||
social = profile.socialScore
|
||||
economic = profile.economicScore
|
||||
|
||||
A_L = 'authoritarian_left'
|
||||
A_R = 'authoritarian_right'
|
||||
L_L = 'libertarian_left'
|
||||
L_R = 'libertarian_right'
|
||||
|
||||
if social > 0:
|
||||
# Auth
|
||||
if economic > 0:
|
||||
#AuthRight
|
||||
articles = Article.objects.exclude(tag=A_R)
|
||||
elif economic < 0:
|
||||
#AuthLeft
|
||||
articles = Article.objects.exclude(tag=A_L)
|
||||
else:
|
||||
#AuthCenter
|
||||
articles = Article.objects.exclude(tag=A_L).exclude(tag=A_R)
|
||||
elif social < 0:
|
||||
# Lib
|
||||
if social > 0:
|
||||
#LibRight
|
||||
articles = Article.objects.exclude(tag=L_R)
|
||||
elif social < 0:
|
||||
#LibLeft
|
||||
articles = Article.objects.exclude(tag=L_L)
|
||||
else:
|
||||
#LibCenter
|
||||
articles = Article.objects.exclude(tag=L_L).exclude(tag=L_R)
|
||||
else:
|
||||
#___Center
|
||||
if social > 0:
|
||||
# RightCenter
|
||||
articles = Article.objects.exclude(tag=L_L).exclude(tag=A_L)
|
||||
if social < 0:
|
||||
# LeftCenter
|
||||
articles = Article.objects.exclude(tag=L_R).exclude(tag=A_R)
|
||||
else:
|
||||
# Center
|
||||
articles = Article.objects.all()
|
||||
|
||||
|
||||
context = {
|
||||
'articles': Article.objects.all()
|
||||
'articles': articles
|
||||
}
|
||||
|
||||
return render (request, 'news/home.html', context)
|
||||
|
@ -81,3 +135,9 @@ class ArticleDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView):
|
|||
def createProfileIfNotExist (request):
|
||||
if request.user.is_authenticated and Profile.objects.filter(user=request.user).count() < 1:
|
||||
Profile.objects.create(user=request.user).save()
|
||||
|
||||
def checkValues (request):
|
||||
if request.user.is_authenticated and Profile.objects.filter(user=request.user).count() is 1:
|
||||
profile = Profile.objects.filter(user=request.user).first()
|
||||
return profile.gaveValues
|
||||
return True
|
||||
|
|
|
@ -24,3 +24,12 @@ class ProfileUpdateForm(forms.ModelForm):
|
|||
class Meta:
|
||||
model = Profile
|
||||
fields = ['profile_pic']
|
||||
|
||||
class ValuesUpdateForm(forms.ModelForm):
|
||||
|
||||
economicScore = forms.IntegerField(label="Economic Score")
|
||||
socialScore = forms.IntegerField(label="Social Score")
|
||||
|
||||
class Meta:
|
||||
model = Profile
|
||||
fields = ['economicScore', 'socialScore']
|
||||
|
|
|
@ -9,11 +9,9 @@ from .models import Profile
|
|||
@receiver(post_save, sender=User)
|
||||
def create_profile(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
print ("CREATED")
|
||||
Profile.objects.create(user=instance)
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def save_profile(sender, instance, **kwargs):
|
||||
print ("SAVED")
|
||||
instance.profile.save()
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
|
||||
<div class="content-section">
|
||||
<a href="{% url 'social:begin' 'google-oauth2' %}" title="google" class="border border-dark p-3 btn btn-block btn-lg mx-auto text-white" style="color: white; background-color: #DB4437">
|
||||
<img src="https://cdn2.iconfinder.com/data/icons/font-awesome/1792/google-48.png" >
|
||||
<i class="fa fa-google fa-lg" aria-hidden="true"></i>
|
||||
Sign in with Google
|
||||
</a>
|
||||
<a href="{% url 'social:begin' 'github' %}" title="github" class="border border-dark p-3 btn btn-block btn-lg mx-auto">
|
||||
<img src="https://cdn4.iconfinder.com/data/icons/miu-social/60/github-social-media-48.png" >
|
||||
<i class="fa fa-github fa-lg" aria-hidden="true"></i>
|
||||
Sign in with Github
|
||||
</a>
|
||||
<a href="{% url 'social:begin' 'facebook' %}" title="fb" class="border border-dark p-3 btn btn-block btn-lg mx-auto text-white" style="background-color: rgb(59,89,152);">
|
||||
<img src="https://cdn4.iconfinder.com/data/icons/miu-flat-social/60/facebook-48.png" >
|
||||
<i class="fa fa-facebook fa-lg" aria-hidden="true"></i>
|
||||
Sign in with Facebook
|
||||
</a>
|
||||
|
||||
|
|
|
@ -81,5 +81,59 @@
|
|||
{{ passwordForm|crispy }}
|
||||
<button type="submit" class="btn btn-outline-info">Save changes</button>
|
||||
</form>
|
||||
<hr>
|
||||
<canvas class="mx-auto" id="compass" width="500" height="500" style="border:1px solid #000000;">
|
||||
Your browser does not support the HTML canvas tag.
|
||||
</canvas>
|
||||
|
||||
<script>
|
||||
var c = document.getElementById("compass");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
ctx.fillStyle = "#ff7575";
|
||||
ctx.fillRect(0,0,250,250)
|
||||
|
||||
ctx.fillStyle = "#42abff";
|
||||
ctx.fillRect(250,0,250,250)
|
||||
|
||||
ctx.fillStyle = "#9aec98";
|
||||
ctx.fillRect(0,250,250,250)
|
||||
|
||||
ctx.fillStyle = "#bf9aea";
|
||||
ctx.fillRect(250,250,250,250)
|
||||
|
||||
ctx.lineWidth = 2.5;
|
||||
ctx.moveTo(250,0);
|
||||
ctx.lineTo(250,500);
|
||||
ctx.stroke();
|
||||
ctx.moveTo(0,250);
|
||||
ctx.lineTo(500,250);
|
||||
ctx.stroke();
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc({{ valueX }}, {{ valueY }}, 5, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
|
||||
ctx.fillStyle = "#000";
|
||||
|
||||
ctx.fill();
|
||||
|
||||
ctx.font = "16px Arial";
|
||||
ctx.fillText("You are here", {{ valueX }}+15, {{ valueY }}-15);
|
||||
|
||||
</script>
|
||||
|
||||
<hr>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<fieldset class="form-group">
|
||||
<legend class="border-bottom mb-4"> Retake the political compass test at <a href="https://spekr.org/" target="_blank">spekr.org</a></legend>
|
||||
{{ valuesForm|crispy}}
|
||||
</fieldset>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-outline-info">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -19,4 +19,3 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
© 2020 GitHub, Inc.
|
||||
|
|
22
users/templates/users/values.html
Normal file
22
users/templates/users/values.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{% extends "news/base.html" %}
|
||||
{% load static %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
<h2>Before we start, let's get some info:</h2>
|
||||
<div class="border-top pt-2 pb-2">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h3 class="text-center">First, take a political compass test at:</h3>
|
||||
<a href="https://spekr.org" target="_blank"><img src="{% static 'news/css/res/spekr.png' %}" alt="https://spekr.org"></a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<legend class="border-bottom mb-4">What were your results?</legend>
|
||||
{{ form|crispy }}
|
||||
<button type="submit" class="btn btn-outline-info">Upload results</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -4,13 +4,15 @@ from django.contrib.auth import update_session_auth_hash, login, authenticate
|
|||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm, PasswordChangeForm, UserCreationForm
|
||||
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
|
||||
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm, ValuesUpdateForm
|
||||
|
||||
from social_django.models import UserSocialAuth
|
||||
from .models import Profile
|
||||
|
||||
def register(request):
|
||||
createProfileIfNotExist(request)
|
||||
if checkValues(request) is False:
|
||||
return redirect('values')
|
||||
|
||||
if request.method == 'POST':
|
||||
form = UserRegisterForm(request.POST)
|
||||
|
@ -27,6 +29,8 @@ def register(request):
|
|||
@login_required
|
||||
def profile(request):
|
||||
createProfileIfNotExist(request)
|
||||
if checkValues(request) is False:
|
||||
return redirect('values')
|
||||
|
||||
user = request.user
|
||||
|
||||
|
@ -66,6 +70,7 @@ def profile(request):
|
|||
instance=request.user.profile)
|
||||
|
||||
passwordForm = PasswordForm(request.user, request.POST)
|
||||
valuesForm = ValuesUpdateForm(request.POST, instance=request.user.profile)
|
||||
|
||||
if userForm.is_valid() and profileForm.is_valid():
|
||||
userForm.save()
|
||||
|
@ -77,6 +82,10 @@ def profile(request):
|
|||
update_session_auth_hash(request, passwordForm.user)
|
||||
messages.success(request, 'Your password was successfully updated!')
|
||||
return redirect('profile')
|
||||
elif valuesForm.is_valid():
|
||||
valuesForm.save()
|
||||
messages.success(request, "Thanks for your input! We'll now be serving articles of exactly differing opinons, enjoy!")
|
||||
return redirect('profile')
|
||||
else:
|
||||
messages.error(request, 'Please correct the errors below.')
|
||||
|
||||
|
@ -84,11 +93,19 @@ def profile(request):
|
|||
userForm = UserUpdateForm(instance=request.user)
|
||||
profileForm = ProfileUpdateForm(instance=request.user.profile)
|
||||
passwordForm = PasswordForm(request.user)
|
||||
valuesForm = ValuesUpdateForm(instance=request.user)
|
||||
|
||||
valueX = user.profile.economicScore * 2.5 + 250
|
||||
valueY = user.profile.socialScore * -2.5 + 250
|
||||
print("VALUEX IS " + str(valueX))
|
||||
|
||||
context = {
|
||||
'userForm': userForm,
|
||||
'profileForm': profileForm,
|
||||
'passwordForm': passwordForm,
|
||||
'valuesForm': valuesForm,
|
||||
'valueX': valueX,
|
||||
'valueY': valueY,
|
||||
'github_login': github_login,
|
||||
'google_login': google_login,
|
||||
'facebook_login': facebook_login,
|
||||
|
@ -97,9 +114,35 @@ def profile(request):
|
|||
|
||||
return render(request, 'users/profile.html', context)
|
||||
|
||||
@login_required
|
||||
def values (request):
|
||||
user = request.user
|
||||
|
||||
if request.method == "POST":
|
||||
userForm = ValuesUpdateForm(request.POST, instance=request.user.profile)
|
||||
if userForm.is_valid():
|
||||
userForm.save()
|
||||
profile = request.user.profile
|
||||
profile.gaveValues = True
|
||||
profile.save()
|
||||
messages.success(request, "Thanks for your input! We'll now be serving articles of exactly differing opinons, enjoy!")
|
||||
return redirect('home')
|
||||
else:
|
||||
messages.error(request, 'Please correct the errors below.')
|
||||
else:
|
||||
userForm = ValuesUpdateForm(instance=request.user.profile)
|
||||
|
||||
context = {
|
||||
'form': userForm
|
||||
}
|
||||
|
||||
return render(request, 'users/values.html', context)
|
||||
|
||||
@login_required
|
||||
def password(request):
|
||||
createProfileIfNotExist(request)
|
||||
if checkValues(request) is False:
|
||||
return redirect('values')
|
||||
|
||||
if request.user.has_usable_password():
|
||||
PasswordForm = PasswordChangeForm
|
||||
|
@ -123,3 +166,10 @@ def password(request):
|
|||
def createProfileIfNotExist (request):
|
||||
if request.user.is_authenticated and Profile.objects.filter(user=request.user).count() < 1:
|
||||
Profile.objects.create(user=request.user).save()
|
||||
|
||||
|
||||
def checkValues (request):
|
||||
if request.user.is_authenticated and Profile.objects.filter(user=request.user).count() is 1:
|
||||
profile = Profile.objects.filter(user=request.user).first()
|
||||
return profile.gaveValues
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue
Block a user