Skip to content

Commit

Permalink
Merge a0d33d9 into 5f5130c
Browse files Browse the repository at this point in the history
  • Loading branch information
gvn committed Sep 10, 2018
2 parents 5f5130c + a0d33d9 commit 25b9a5d
Show file tree
Hide file tree
Showing 19 changed files with 448 additions and 50 deletions.
13 changes: 10 additions & 3 deletions network-api/networkapi/buyersguide/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ class Meta:
camera = Faker('boolean')
microphone = Faker('boolean')
location = Faker('boolean')
uses_encryption = Faker('boolean')
privacy_policy = Faker('url')
share_data = Faker('boolean')
must_change_default_password = Faker('boolean')
security_updates = Faker('boolean')
need_account = Faker('boolean')
privacy_controls = Faker('boolean')
delete_data = Faker('boolean')
share_data = Faker('boolean')
child_rules = Faker('boolean')
privacy_policy = Faker('url')
manage_security = Faker('boolean')
customer_support_easy = Faker('boolean')
phone_number = Faker('phone_number')
live_chat = Faker('url')
email = Faker('email')
worst_case = Faker('sentence')

@post_generation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-10 20:37
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('buyersguide', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='product',
name='privacy_controls',
),
migrations.AddField(
model_name='product',
name='customer_support_easy',
field=models.NullBooleanField(help_text='Makes it easy to contact customer support?'),
),
migrations.AddField(
model_name='product',
name='email',
field=models.CharField(blank='True', help_text='Email', max_length=100),
),
migrations.AddField(
model_name='product',
name='live_chat',
field=models.CharField(blank='True', help_text='Live Chat', max_length=100),
),
migrations.AddField(
model_name='product',
name='manage_security',
field=models.NullBooleanField(help_text='Manages security vulnerabilities?'),
),
migrations.AddField(
model_name='product',
name='must_change_default_password',
field=models.NullBooleanField(help_text='Must change a default password?'),
),
migrations.AddField(
model_name='product',
name='phone_number',
field=models.CharField(blank='True', help_text='Phone Number', max_length=100),
),
migrations.AddField(
model_name='product',
name='security_updates',
field=models.NullBooleanField(help_text='Security updates?'),
),
migrations.AddField(
model_name='product',
name='uses_encryption',
field=models.NullBooleanField(help_text='Does the product use encryption?'),
),
migrations.AlterField(
model_name='product',
name='price',
field=models.CharField(blank='True', help_text='Price', max_length=100),
),
]
80 changes: 70 additions & 10 deletions network-api/networkapi/buyersguide/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def get_product_image_upload_path(instance, filename):
)


# https://docs.google.com/document/d/1jtWOVqH20qMYRSwvb2rHzPNTrWIoPs8EbWR25r9iyi4/edit

class Product(models.Model):
"""
A thing you can buy in stores and our review of it
Expand All @@ -22,6 +24,7 @@ class Product(models.Model):
help_text='Name of Product',
blank="True",
)

company = models.CharField(
max_length=100,
help_text='Name of Company',
Expand All @@ -33,51 +36,108 @@ class Product(models.Model):
help_text='Description of the product',
blank="True"
)

url = models.URLField(
max_length=2048,
help_text='Link to this product page',
blank="True",
)

price = models.CharField(
max_length=100,
help_text='Price range',
help_text='Price',
blank="True",
)

image = models.FileField(
max_length=2048,
help_text='Image representing this prodct',
upload_to=get_product_image_upload_path,
blank=True,
)

# Can it spy on me?

camera = models.NullBooleanField(
help_text='Does this product have or access a camera?',
)

microphone = models.NullBooleanField(
help_text='Does this product have or access a microphone?',
)

location = models.NullBooleanField(
help_text='Does this product access your location?',
)

# What does it know about me?

uses_encryption = models.NullBooleanField(
help_text='Does the product use encryption?',
)

privacy_policy = models.URLField(
help_text='Link to privacy policy for this product',
max_length=2048,
blank="True",
)

share_data = models.NullBooleanField(
help_text='Does the maker share data with other companies?',
)

# Can I control it?

must_change_default_password = models.NullBooleanField(
help_text='Must change a default password?',
)

security_updates = models.NullBooleanField(
help_text='Security updates?',
)

need_account = models.NullBooleanField(
help_text='Do you need an account to use this product?',
)
privacy_controls = models.NullBooleanField(
help_text='Do users have access to privacy controls?',
)

delete_data = models.NullBooleanField(
help_text='Can you request data be deleted?',
)
share_data = models.NullBooleanField(
help_text='Does the maker share data with other companies?',
)

child_rules = models.NullBooleanField(
help_text='Are there rules for children?',
)
privacy_policy = models.URLField(
help_text='Link to privacy policy for this product',
max_length=2048,

# Company shows it cares about its customers?

manage_security = models.NullBooleanField(
help_text='Manages security vulnerabilities?',
)

customer_support_easy = models.NullBooleanField(
help_text='Makes it easy to contact customer support?',
)

phone_number = models.CharField(
max_length=100,
help_text='Phone Number',
blank="True",
)

live_chat = models.CharField(
max_length=100,
help_text='Live Chat',
blank="True",
)

email = models.CharField(
max_length=100,
help_text='Email',
blank="True",
)

# What could happen if something went wrong?

worst_case = models.CharField(
max_length=5000,
help_text="What's the worst thing that could happen by using this product?",
Expand Down
11 changes: 11 additions & 0 deletions network-api/networkapi/buyersguide/templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "./bg_base.html" %}

{% block body-id %}about{% endblock %}

{% block guts %}

<div class="container">
<h1>About page goes here!</h1>
</div>

{% endblock %}
65 changes: 65 additions & 0 deletions network-api/networkapi/buyersguide/templates/bg_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/_css/buyers-guide.compiled.css">
<link rel="stylesheet" href="//code.cdn.mozilla.net/fonts/fira.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Nunito+Sans:400,300,700,300i">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Zilla+Slab:300,400,600,700,300i">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:400,700">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="/_images/favicons/apple-touch-icon-180x180@2x.png">
<link rel="icon" type="image/png" sizes="196x196" href="/_images/favicons/favicon-196x196@2x.png">
<link rel="shortcut icon" href="/_images/favicons/favicon.ico">
<title>Mozilla - *privacy not included</title>
</head>
<body id="pni-{% block body-id %}{% endblock %}">
<header class="container">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center py-3">
<a href="/" class="moz-logo mb-0 mr-3"><span class="sr-only">Mozilla</span></a>
<p class="mb-0 h4-heading">*privacy not&nbsp;included</p>
</div>
<div class="social d-flex align-items-center">
<a class="social-button social-button-fb" href="#TODO"><span class="sr-only">Facebook</a></a>
<a class="social-button social-button-twitter" href="#TODO"><span class="sr-only">Twitter</a></a>
<a class="social-button social-button-email" href="#TODO"><span class="sr-only">Email</a></a>
<a class="d-none d-sm-block btn btn-blue ml-3" href="https://donate.mozilla.org">Donate</a>
</div>
</div>
</header>
<div class="primary-nav mb-3">
<div class="container">
<a class="nav-home" href="/privacynotincluded">Home</a>
<a class="nav-TODO" href="#TODO">Toys & Games</a>
<a class="nav-TODO" href="#TODO">Smart Home</a>
<a class="nav-TODO" href="#TODO">Entertainment</a>
<a class="nav-TODO" href="#TODO">Wearables</a>
<a class="nav-TODO" href="#TODO">Health & Exercise</a>
<a class="nav-TODO" href="#TODO">Pets</a>
<a class="nav-about" href="/privacynotincluded/about">About the Guide</a>
</div>
</div>

<div class="pb-5">{% block guts %}{% endblock %}</div>

<footer class="mofo-footer">
<div class="container">
<ul class="list-unstyled footer-links row justify-content-center">
<li class="col-auto"><a class="footer-link-email" href="mailto:network@mozillafoundation.org">Email</a></li>
<li class="col-auto"><a class="footer-link-twitter" href="https://twitter.com/mozilla">Twitter</a></li>
<li class="col-auto"><a class="footer-link-cc-license" href="https://creativecommons.org/licenses/by/4.0">License</a></li>
<li class="col-auto"><a class="footer-link-participation-guidelines" href="https://www.mozilla.org/about/governance/policies/participation/">Participation Guidelines</a></li>
<li class="col-auto"><a class="footer-link-legal" href="https://mozilla.org/en-US/about/legal/">Legal</a></li>
<li class="col-auto"><a class="footer-link-privacy" href="https://mozilla.org/en-US/privacy/websites/">Privacy</a></li>
<li class="col-auto"><a class="footer-link-donate" id="donate-footer-btn" href="https://donate.mozilla.org?utm_source=foundation.mozilla.org&amp;utm_medium=referral&amp;utm_content=footer" target="_blank" rel="noopener noreferrer">Donate</a></li>
</ul>
<div class="org-info mozilla">
<div class="logo-container"><a class="logo" href="https://mozilla.org"></a></div>
<p>Mozilla is a global non-profit dedicated to putting you in control of your online experience and shaping the future of the web for the public good. Visit us at <a href="https://mozilla.org">mozilla.org</a>.</p>
</div>
</div>
</footer>
</body>
</html>
<script src="/_js/bg-main.compiled.js"></script>
18 changes: 14 additions & 4 deletions network-api/networkapi/buyersguide/templates/buyersguide_home.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Buyer's guide homepage!
{% extends "./bg_base.html" %}

{% for product in products %}
<div><a href="{{product.name | urlencode}}">{{product.name}}</a></div>
{% endfor %}
{% block body-id %}home{% endblock %}

{% block guts %}

<div class="container">
<h1>Buyer's guide homepage!</h1>

{% for product in products %}
<div><a href="./product/{{product.name | urlencode}}">{{product.name}}</a></div>
{% endfor %}
</div>

{% endblock %}
46 changes: 29 additions & 17 deletions network-api/networkapi/buyersguide/templates/product_page.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
<h2>{{product.name}}</h2>
{% extends "./bg_base.html" %}

<img src="{{mediaUrl}}{{product.image}}" width="500"/>
<div>
{{product.company}}
{% block body-id %}TODO-CATEGORY{% endblock %}

{% block guts %}

<div class="container">
<h2>{{product.name}}</h2>

<div class="creepometer mb-5"></div>

<img src="{{mediaUrl}}{{product.image}}" width="500"/>
<div>
{{product.company}}
</div>
<div>{{product.blurb}}</div>
<div>{{product.url}}</div>
<div>{{product.price}}</div>
<div>Camera: {{product.camera}}</div>
<div>Microphone: {{product.microphone}}</div>
<div>Location: {{product.location}}</div>
<div>Need account: {{product.need_account}}</div>
<div>Privacy Controls: {{product.privacy_controls}}</div>
<div>Delete Data: {{product.delete_data}}</div>
<div>Share Data: {{product.share_data}}</div>
<div>Child rules: {{product.child_rules}}</div>
<div>Privacy Policy: {{product.privacy_policy}}</div>
<div>Worst case scenario: {{product.worst_case}}</div>
</div>
<div>{{product.blurb}}</div>
<div>{{product.url}}</div>
<div>{{product.price}}</div>
<div>Camera: {{product.camera}}</div>
<div>Microphone: {{product.microphone}}</div>
<div>Location: {{product.location}}</div>
<div>Need account: {{product.need_account}}</div>
<div>Privacy Controls: {{product.privacy_controls}}</div>
<div>Delete Data: {{product.delete_data}}</div>
<div>Share Data: {{product.share_data}}</div>
<div>Child rules: {{product.child_rules}}</div>
<div>Privacy Policy: {{product.privacy_policy}}</div>
<div>Worst case scenario: {{product.worst_case}}</div>

{% endblock %}
3 changes: 2 additions & 1 deletion network-api/networkapi/buyersguide/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

urlpatterns = [
url(r'^$', views.buyersguide_home, name='buyersguide-home'),
url(r'^(?P<productname>[\w\ ]+)/', views.product_view, name='product-view'),
url(r'^about/', views.about_view, name='about-view'),
url(r'^product/(?P<productname>[\w\ ]+)/', views.product_view, name='product-view'),
]
5 changes: 5 additions & 0 deletions network-api/networkapi/buyersguide/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ def buyersguide_home(request):
def product_view(request, productname):
product = Product.objects.get(name__iexact=productname)
return render(request, 'product_page.html', {'product': product, 'mediaUrl': settings.MEDIA_URL})


@login_required
def about_view(request):
return render(request, 'about.html')
Loading

0 comments on commit 25b9a5d

Please sign in to comment.