Skip to content

Commit 80ad738

Browse files
committed
switch to mysql
1 parent 2e16782 commit 80ad738

38 files changed

+303
-85
lines changed

.idea/workspace.xml

+163-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Camera/settings.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@
7878

7979
DATABASES = {
8080
'default': {
81-
'ENGINE': 'django.db.backends.sqlite3',
82-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81+
'ENGINE': 'django.db.backends.mysql',#'django.db.backends.sqlite3',
82+
'NAME': 'tedcamera_db',#os.path.join(BASE_DIR, 'db.sqlite3'),
83+
'USE': 'ted',
84+
'PASSWORD': 'zyy',
85+
'HOST': 'localhost',
86+
'PORT': ''
8387
}
8488
}
8589

@@ -102,3 +106,5 @@
102106
# https://docs.djangoproject.com/en/1.8/howto/static-files/
103107

104108
STATIC_URL = '/static/'
109+
110+
#MEDIA_ROOT = '/home/ted/Python/Django/Camera/cam/static/cam/image'

Camera/settings.pyc

95 Bytes
Binary file not shown.

D750_zbzkuUG.jpg

4.74 MB
Loading

cam/admin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class CameraAdim(admin.ModelAdmin):
1111

1212
fieldsets = [
1313
(None, {'fields': ['brand', 'camera_model']}),
14-
('stars', {'fields': ['stars']}),
15-
('comments', {'fields': ['comment'], 'classes': ['collapse']}),
14+
('Info', {'fields': ['stars', 'price', 'comment']}),
15+
#('picture', {'fields': ['camera_picture']}),
1616
]
1717
inlines = [ReviewInline]
1818
list_display = ('brand', 'camera_model', 'comment')

cam/admin.pyc

-44 Bytes
Binary file not shown.

cam/migrations/0006_user.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cam', '0005_camera_price'),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='User',
16+
fields=[
17+
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
18+
('firstName', models.CharField(max_length=20)),
19+
('lastName', models.CharField(max_length=20)),
20+
('email', models.EmailField(max_length=254)),
21+
],
22+
),
23+
]

cam/migrations/0006_user.pyc

1003 Bytes
Binary file not shown.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cam', '0006_user'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='camera',
16+
name='camera_model',
17+
field=models.CharField(max_length=255, serialize=False, primary_key=True),
18+
),
19+
migrations.AlterField(
20+
model_name='camera',
21+
name='comment',
22+
field=models.CharField(default=b'Nice DLSR Camera', max_length=255),
23+
),
24+
]
950 Bytes
Binary file not shown.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cam', '0007_auto_20150810_1907'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='camera',
16+
name='camera_picture',
17+
field=models.ImageField(upload_to=b'../../static/cam/images/camera_model'),
18+
),
19+
]
857 Bytes
Binary file not shown.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cam', '0008_auto_20150810_1939'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='camera',
16+
name='camera_picture',
17+
field=models.ImageField(upload_to=b'/camera_model'),
18+
),
19+
]
834 Bytes
Binary file not shown.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('cam', '0009_auto_20150810_2013'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='camera',
16+
name='camera_picture',
17+
field=models.ImageField(upload_to=b''),
18+
),
19+
]
821 Bytes
Binary file not shown.

cam/models.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
# Create your models here.
66
class Camera(models.Model):
77

8-
camera_model = models.CharField(max_length=256, primary_key=True)
8+
camera_model = models.CharField(max_length=255, primary_key=True)
99
brand = models.CharField(max_length=20)
1010

11-
camera_picture = models.ImageField()
11+
camera_picture = models.ImageField()#upload_to='/camera_model')
1212
stars = models.IntegerField(default=0, validators=[MinValueValidator(0),
1313
MaxValueValidator(5)])
14+
1415
price = models.FloatField(default=0, validators=[MinValueValidator(0)])
1516

1617
#release_date = models.DateField(auto_now=False, auto_now_add=False)
17-
comment = models.CharField(max_length=500, default='Nice DLSR Camera')
18+
comment = models.CharField(max_length=255, default='Nice DLSR Camera')
19+
1820

1921

2022
def __unicode__(self):
@@ -42,4 +44,10 @@ def __unicode__(self):
4244
# stars = models.IntegerField(default=0,)
4345
#
4446
# def __unicode__(self):
45-
# return ': '.join([self.brand, self.lens_model])
47+
# return ': '.join([self.brand, self.lens_model])
48+
49+
class User(models.Model):
50+
51+
firstName = models.CharField(max_length=20)
52+
lastName = models.CharField(max_length=20)
53+
email = models.EmailField()

cam/models.pyc

290 Bytes
Binary file not shown.
1.39 MB
Loading

cam/templates/cam/basic.html

+2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
<!-- Navigation Bar--!>
3030
{% include 'cam/navbar.html' %}
3131
32+
<!-- Add specific block here-->
3233
{% block home %}{% endblock %}
3334
{% block about %}{% endblock %}
35+
{% block register %}{% endblock %}
3436

3537

3638
<!-- FOOTER -->

cam/templates/cam/register.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends 'cam/basic.html' %}
2+
3+
{% block register %}
4+
5+
{% endblock %}

cam/urls.py

+2
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
url(r'^reviews/', views.CameraView.as_view(), name='reviews'),
1515

1616
url(r'^brands/', views.CameraList.as_view(), name='brands'),
17+
18+
url(r'^register/', views.RegisterView.as_view(), name='register'),
1719
]

cam/urls.pyc

74 Bytes
Binary file not shown.

cam/views.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class AboutView(generic.ListView):
1616
model = Camera
1717
template_name = 'cam/about.html'
1818

19+
class RegisterView(generic.ListView):
20+
model = Camera
21+
template_name = 'cam/register.html'
22+
1923
class CameraList(generic.ListView):
2024
model = Camera
2125
template_name = 'cam/brands.html'

cam/views.pyc

229 Bytes
Binary file not shown.

5D3.jpg camera_model/5D3.jpg

File renamed without changes.

6D.jpg camera_model/6D.jpg

File renamed without changes.

70D.jpg camera_model/70D.jpg

File renamed without changes.

A6000.JPG camera_model/A6000.JPG

File renamed without changes.

A7.JPG camera_model/A7.JPG

File renamed without changes.

A7R.jpg camera_model/A7R.jpg

File renamed without changes.

D7200.jpg camera_model/D7200.jpg

File renamed without changes.

camera_model/D750.jpg

4.74 MB
Loading

camera_model/D810.jpg

1.39 MB
Loading
1.39 MB
Loading
Loading

datadump.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"fields": {"model": "logentry", "app_label": "admin"}, "model": "contenttypes.contenttype", "pk": 1}, {"fields": {"model": "permission", "app_label": "auth"}, "model": "contenttypes.contenttype", "pk": 2}, {"fields": {"model": "group", "app_label": "auth"}, "model": "contenttypes.contenttype", "pk": 3}, {"fields": {"model": "user", "app_label": "auth"}, "model": "contenttypes.contenttype", "pk": 4}, {"fields": {"model": "contenttype", "app_label": "contenttypes"}, "model": "contenttypes.contenttype", "pk": 5}, {"fields": {"model": "session", "app_label": "sessions"}, "model": "contenttypes.contenttype", "pk": 6}, {"fields": {"model": "camera", "app_label": "cam"}, "model": "contenttypes.contenttype", "pk": 7}, {"fields": {"model": "review", "app_label": "cam"}, "model": "contenttypes.contenttype", "pk": 9}, {"fields": {"model": "user", "app_label": "cam"}, "model": "contenttypes.contenttype", "pk": 10}, {"fields": {"expire_date": "2015-08-23T15:14:56.802Z", "session_data": "ZTA5ZmEwMzgwNGY1M2I4NmIxZmE3YThmNmU0OTNjYzM1NmE2NzZmNTp7Il9hdXRoX3VzZXJfaGFzaCI6IjNlZDYxY2Q5YzkyY2Q2NGIyZjVkNGExOGQwZDU4YzVjMDIyYzU0OTkiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0="}, "model": "sessions.session", "pk": "698zofbzq0qzx4lspo8wldwjmz9iyryj"}, {"fields": {"expire_date": "2015-08-23T05:03:18.399Z", "session_data": "ZTA5ZmEwMzgwNGY1M2I4NmIxZmE3YThmNmU0OTNjYzM1NmE2NzZmNTp7Il9hdXRoX3VzZXJfaGFzaCI6IjNlZDYxY2Q5YzkyY2Q2NGIyZjVkNGExOGQwZDU4YzVjMDIyYzU0OTkiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0="}, "model": "sessions.session", "pk": "8eurv4mby6qawhnmq5at4gyu0rvefwpn"}, {"fields": {"camera_picture": "./5D3.jpg", "comment": "Nice DLSR Camera", "brand": "Canon", "price": 0.0, "stars": 5}, "model": "cam.camera", "pk": "5D3"}, {"fields": {"camera_picture": "./6D.jpg", "comment": "Nice DLSR Camera", "brand": "Canon", "price": 0.0, "stars": 4}, "model": "cam.camera", "pk": "6D"}, {"fields": {"camera_picture": "./70D.jpg", "comment": "Nice DLSR Camera", "brand": "Canon", "price": 0.0, "stars": 4}, "model": "cam.camera", "pk": "70D"}, {"fields": {"camera_picture": "./A6000.JPG", "comment": "Nice DLSR Camera", "brand": "Sony", "price": 0.0, "stars": 3}, "model": "cam.camera", "pk": "A6000"}, {"fields": {"camera_picture": "./A7.JPG", "comment": "Nice DLSR Camera", "brand": "Sony", "price": 0.0, "stars": 4}, "model": "cam.camera", "pk": "A7"}, {"fields": {"camera_picture": "./A7R.jpg", "comment": "Nice DLSR Camera", "brand": "Sony", "price": 0.0, "stars": 5}, "model": "cam.camera", "pk": "A7R"}, {"fields": {"camera_picture": "./D7200.jpg", "comment": "Nice DLSR Camera", "brand": "Nikon", "price": 0.0, "stars": 3}, "model": "cam.camera", "pk": "D7200"}, {"fields": {"camera_picture": "./D750.jpg", "comment": "Nice DLSR Camera", "brand": "Nikon", "price": 0.0, "stars": 4}, "model": "cam.camera", "pk": "D750"}, {"fields": {"camera_picture": "./D810.jpg", "comment": "Nice DLSR Camera", "brand": "Nikon", "price": 0.0, "stars": 5}, "model": "cam.camera", "pk": "D810"}, {"fields": {"writer": "Ted", "review": "Nikon's top camera", "camera": "D810", "review_date": "2015-08-09"}, "model": "cam.review", "pk": 1}, {"fields": {"codename": "add_logentry", "name": "Can add log entry", "content_type": 1}, "model": "auth.permission", "pk": 1}, {"fields": {"codename": "change_logentry", "name": "Can change log entry", "content_type": 1}, "model": "auth.permission", "pk": 2}, {"fields": {"codename": "delete_logentry", "name": "Can delete log entry", "content_type": 1}, "model": "auth.permission", "pk": 3}, {"fields": {"codename": "add_permission", "name": "Can add permission", "content_type": 2}, "model": "auth.permission", "pk": 4}, {"fields": {"codename": "change_permission", "name": "Can change permission", "content_type": 2}, "model": "auth.permission", "pk": 5}, {"fields": {"codename": "delete_permission", "name": "Can delete permission", "content_type": 2}, "model": "auth.permission", "pk": 6}, {"fields": {"codename": "add_group", "name": "Can add group", "content_type": 3}, "model": "auth.permission", "pk": 7}, {"fields": {"codename": "change_group", "name": "Can change group", "content_type": 3}, "model": "auth.permission", "pk": 8}, {"fields": {"codename": "delete_group", "name": "Can delete group", "content_type": 3}, "model": "auth.permission", "pk": 9}, {"fields": {"codename": "add_user", "name": "Can add user", "content_type": 4}, "model": "auth.permission", "pk": 10}, {"fields": {"codename": "change_user", "name": "Can change user", "content_type": 4}, "model": "auth.permission", "pk": 11}, {"fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 4}, "model": "auth.permission", "pk": 12}, {"fields": {"codename": "add_contenttype", "name": "Can add content type", "content_type": 5}, "model": "auth.permission", "pk": 13}, {"fields": {"codename": "change_contenttype", "name": "Can change content type", "content_type": 5}, "model": "auth.permission", "pk": 14}, {"fields": {"codename": "delete_contenttype", "name": "Can delete content type", "content_type": 5}, "model": "auth.permission", "pk": 15}, {"fields": {"codename": "add_session", "name": "Can add session", "content_type": 6}, "model": "auth.permission", "pk": 16}, {"fields": {"codename": "change_session", "name": "Can change session", "content_type": 6}, "model": "auth.permission", "pk": 17}, {"fields": {"codename": "delete_session", "name": "Can delete session", "content_type": 6}, "model": "auth.permission", "pk": 18}, {"fields": {"codename": "add_camera", "name": "Can add camera", "content_type": 7}, "model": "auth.permission", "pk": 19}, {"fields": {"codename": "change_camera", "name": "Can change camera", "content_type": 7}, "model": "auth.permission", "pk": 20}, {"fields": {"codename": "delete_camera", "name": "Can delete camera", "content_type": 7}, "model": "auth.permission", "pk": 21}, {"fields": {"codename": "add_review", "name": "Can add review", "content_type": 9}, "model": "auth.permission", "pk": 25}, {"fields": {"codename": "change_review", "name": "Can change review", "content_type": 9}, "model": "auth.permission", "pk": 26}, {"fields": {"codename": "delete_review", "name": "Can delete review", "content_type": 9}, "model": "auth.permission", "pk": 27}, {"fields": {"codename": "add_user", "name": "Can add user", "content_type": 10}, "model": "auth.permission", "pk": 28}, {"fields": {"codename": "change_user", "name": "Can change user", "content_type": 10}, "model": "auth.permission", "pk": 29}, {"fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 10}, "model": "auth.permission", "pk": 30}, {"fields": {"username": "ted", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2015-08-09T15:14:56.726Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$20000$MjnDOAtZW9TS$pfiSb2yOFB173waj5MsdxTqacHo/HChupk3voSwdD2s=", "email": "[email protected]", "date_joined": "2015-08-09T04:49:48.040Z"}, "model": "auth.user", "pk": 1}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:33:07.111Z", "object_repr": "Canon: 70D", "object_id": "70D", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 1}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:33:29.697Z", "object_repr": "Canon: 70D", "object_id": "70D", "change_message": "No fields changed.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 2}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:33:48.052Z", "object_repr": "Canon: 6D", "object_id": "6D", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 3}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:34:08.914Z", "object_repr": "Canon: 5D3", "object_id": "5D3", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 4}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:34:34.372Z", "object_repr": "nikon: D810", "object_id": "D810", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 5}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:34:42.220Z", "object_repr": "Canon: 5D3", "object_id": "5D3", "change_message": "Changed stars.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 6}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:35:02.920Z", "object_repr": "nikon: D750", "object_id": "D750", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 7}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:35:25.949Z", "object_repr": "nikon: D7200", "object_id": "D7200", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 8}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:35:58.375Z", "object_repr": "Sony: A6000", "object_id": "A6000", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 9}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:36:15.440Z", "object_repr": "Sony: A7", "object_id": "A7", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 10}, {"fields": {"action_flag": 1, "action_time": "2015-08-09T05:36:28.621Z", "object_repr": "Sony: A7R", "object_id": "A7R", "change_message": "", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 11}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:36:45.645Z", "object_repr": "Nikon: D810", "object_id": "D810", "change_message": "Changed brand.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 12}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:36:53.206Z", "object_repr": "Nikon: D750", "object_id": "D750", "change_message": "Changed brand.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 13}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:37:03.683Z", "object_repr": "Nikon: D7200", "object_id": "D7200", "change_message": "Changed brand.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 14}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T05:52:22.018Z", "object_repr": "Nikon: D810", "object_id": "D810", "change_message": "No fields changed.", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 15}, {"fields": {"action_flag": 2, "action_time": "2015-08-09T15:20:26.233Z", "object_repr": "Nikon: D810", "object_id": "D810", "change_message": "Added review \"Ted: Nikon's top camera\".", "user": 1, "content_type": 7}, "model": "admin.logentry", "pk": 16}]

db.sqlite3

3 KB
Binary file not shown.

0 commit comments

Comments
 (0)