Skip to content

Commit

Permalink
add-draw-review
Browse files Browse the repository at this point in the history
Former-commit-id: 59d5e2d78365333efa91b43e16501d4f43fc1e7b
  • Loading branch information
Ubuntu committed Nov 24, 2021
1 parent a9ac9b7 commit 9b66263
Show file tree
Hide file tree
Showing 13 changed files with 405 additions and 13 deletions.
Binary file modified db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion movies/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Meta:
class ReviewForm(ModelForm):
class Meta:
model = Review
fields = ('title','content')
fields = ('title','content','draw')

class ReviewCommentForm(ModelForm):
class Meta:
Expand Down
18 changes: 18 additions & 0 deletions movies/migrations/0011_review_draw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-11-24 08:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('movies', '0010_movie_trailer_url'),
]

operations = [
migrations.AddField(
model_name='review',
name='draw',
field=models.ImageField(blank=True, upload_to='images/'),
),
]
1 change: 1 addition & 0 deletions movies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Review(models.Model):
title = models.CharField(max_length=50)
content = models.TextField()
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
draw = models.ImageField(blank=True, upload_to='images/')
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

Expand Down
74 changes: 74 additions & 0 deletions movies/static/movies/css/draw.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}

blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
body {
background-color: none;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
'Open Sans', 'Helvetica Neue', sans-serif;
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0px;
}

.canvas{
width: 700px;
height: 700px;
background-color: white;
border-radius: 15px;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.controls {
margin-top: 80px;
display: flex;
flex-direction: column;
align-items: center;
}

.controls__btns button {
all: unset;
cursor: pointer;
background-color: white;
padding: 5px 0px;
width: 80px;
text-align: center;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
border: 2px solid rgb(0, 0, 0, 0.2);
color: rgba(0, 0, 0, 0.8);
text-transform: uppercase;
font-weight: 800;
font-size: 12px;
}

.controls__btns button:active{
transform: scale(0.98);
}

.controls .controls__btns {
margin-bottom: 30px;
}

.controls .controls__colors {
display: flex;
}

.controls__colors .controls__color {
width: 50px;
height: 50px;
border-radius: 25px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.controls .controls__range {
margin-bottom: 30px;
}
9 changes: 7 additions & 2 deletions movies/templates/movies/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,21 @@ <h4 style="text-align: right;"> <a href="{% url 'movies:review_create' movie.pk
<div OnClick="location.href ='{% url 'movies:review' review.pk %}'" style="cursor:pointer;">
<div class="app-card__subtext">
<div class="d-flex justify-content-between align-items-center">
<h5> <{{ review.title }}> </h5>
<h3> <{{ review.title }}> </h5>
{% if request.user == review.user %}
<form action="{% url 'movies:review_delete' movie.pk review.pk %}" method="POST">
{% csrf_token %}
<button class="btn btn-danger" style="font-weight: 250px; font-size: 15px; margin-left: 5px; width:60px;">삭제</button>
</form>
{% endif %}
</div>
<p>{{ review.content }}</p>
<h5>{{ review.content }}</h5>
<p style="text-align: right;">{{ review.user }}</p>
<div>
{% if review.draw %}
<img src="{{review.draw.url}}" alt="" style="height:250px; border-radius:10%; opacity: 0.8;">
{% endif %}
</div>
</div>
</div>
<hr>
Expand Down
12 changes: 10 additions & 2 deletions movies/templates/movies/review.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="content-section mt-3">
<div class="app-card mt-3 d-flex">
<div class="d-flex justify-content-between align-items-center">
<h3> {{ review.title }} </h3>
<h1> {{ review.title }} </h1>
{% if request.user == review.user %}
<div class="d-flex">
<button class="btn btn-success" onclick="location.href = '{% url 'movies:review_update' review.pk %}'" style="font-weight: 250px; font-size: 15px; margin-left: 5px; width:60px;">수정</button>
Expand All @@ -25,10 +25,18 @@ <h3> {{ review.title }} </h3>
<h5 style="text-align: right;"> {{ review.user }} </h5>
</div>
</div>

{% if review.draw %}
<div class="content-section">
<div class="app-card mt-3">
<img src="{{ review.draw.url }}" alt="" style="width:400px; height:400px; border-radius:10%; opacity: 0.8;">
</div>
</div>
{% endif %}

<div class="content-section">
<div class="app-card mt-3">
<h5> {{ review.content }} </h5>
<h3> {{ review.content }} </h3>
</div>
</div>

Expand Down
Loading

0 comments on commit 9b66263

Please sign in to comment.