Skip to content

Commit 4d88795

Browse files
committed
Ted camera
1 parent 75d3321 commit 4d88795

34 files changed

+334
-418
lines changed

.idea/workspace.xml

Lines changed: 135 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cam/admin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
from django.contrib import admin
22

33
# Register your models here.
4-
from .models import Camera
4+
from .models import Camera, Review
5+
6+
class ReviewInline(admin.TabularInline):
7+
model = Review
8+
extra = 1
59

610
class CameraAdim(admin.ModelAdmin):
11+
712
fieldsets = [
813
(None, {'fields': ['brand', 'camera_model']}),
914
('stars', {'fields': ['stars']}),
10-
('review', {'fields': ['review'], 'classes': ['collapse']}),
11-
15+
('comments', {'fields': ['comment'], 'classes': ['collapse']}),
1216
]
17+
inlines = [ReviewInline]
18+
list_display = ('brand', 'camera_model', 'comment')
19+
search_fields = ['camera_model']
1320

1421
admin.site.register(Camera, CameraAdim)

cam/admin.pyc

402 Bytes
Binary file not shown.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
import django.core.validators
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('cam', '0002_auto_20150809_0500'),
12+
]
13+
14+
operations = [
15+
migrations.CreateModel(
16+
name='Review',
17+
fields=[
18+
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19+
('review_date', models.DateField(auto_now=True)),
20+
('writer', models.CharField(max_length=20)),
21+
('review', models.TextField(default=b'no reviews')),
22+
],
23+
),
24+
migrations.RemoveField(
25+
model_name='camera',
26+
name='review',
27+
),
28+
migrations.AddField(
29+
model_name='camera',
30+
name='comment',
31+
field=models.CharField(default=b'Nice DLSR Camera', max_length=500),
32+
),
33+
migrations.AlterField(
34+
model_name='camera',
35+
name='camera_picture',
36+
field=models.ImageField(upload_to=b''),
37+
),
38+
migrations.AlterField(
39+
model_name='camera',
40+
name='stars',
41+
field=models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(5)]),
42+
),
43+
migrations.AddField(
44+
model_name='review',
45+
name='camera',
46+
field=models.ForeignKey(to='cam.Camera'),
47+
),
48+
]
1.69 KB
Binary file not shown.
Lines changed: 19 additions & 0 deletions
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', '0003_auto_20150809_1514'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='review',
16+
name='writer',
17+
field=models.CharField(default=b'Ted', max_length=20),
18+
),
19+
]
839 Bytes
Binary file not shown.

cam/models.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,23 @@ class Camera(models.Model):
1212
MaxValueValidator(5)])
1313

1414
#release_date = models.DateField(auto_now=False, auto_now_add=False)
15-
review = models.TextField(default="no review")
15+
comment = models.CharField(max_length=500, default='Nice DLSR Camera')
1616

1717

1818
def __unicode__(self):
1919
return ': '.join([self.brand, self.camera_model])
2020

21+
22+
class Review(models.Model):
23+
24+
camera = models.ForeignKey(Camera)
25+
review_date = models.DateField(auto_now=True, auto_now_add=False)
26+
writer = models.CharField(max_length=20, default='Ted')
27+
28+
review = models.TextField(default="no reviews")
29+
30+
def __unicode__(self):
31+
return ': '.join([self.writer, self.review])
2132
# class Lens(models.Model):
2233
#
2334
# Camera = models.ForeignKey(Camera)

cam/models.pyc

636 Bytes
Binary file not shown.

cam/static/cam/css/carousel.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ body {
3939

4040
/* Carousel base class */
4141
.carousel {
42-
height: 500px;
43-
margin-bottom: 60px;
42+
height: 400px;
43+
margin-bottom: 10px;
4444
}
4545
/* Since positioning the image, we need to help out the caption */
4646
.carousel-caption {
@@ -66,7 +66,7 @@ body {
6666

6767
/* Center align the text within the three columns below the carousel */
6868
.marketing .col-lg-4 {
69-
margin-bottom: 20px;
69+
margin-bottom: 10px;
7070
text-align: center;
7171
}
7272
.marketing h2 {
@@ -82,7 +82,7 @@ body {
8282
------------------------- */
8383

8484
.featurette-divider {
85-
margin: 80px 0; /* Space out the Bootstrap <hr> more */
85+
margin: 10px 0; /* Space out the Bootstrap <hr> more */
8686
}
8787

8888
/* Thin out the marketing headings */

0 commit comments

Comments
 (0)