8000 close #18 · moktadirul-raju/DjangoBlog@b6db85c · GitHub
[go: up one dir, main page]

Skip to content

Commit b6db85c

Browse files
committed
close #18
1 parent 925918b commit b6db85c

14 files changed

+11
-6
lines changed
18 Bytes
Binary file not shown.

backend/views.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def create_post(request):
7272
post.updated_date = datetime.now()
7373

7474
post.save()
75-
75+
7676
existing_post = Post.objects.get(id=post.id)
7777
for tag in tags:
7878
real_tag = Tag.objects.get(text=tag)
@@ -262,8 +262,11 @@ def update_settings(request):
262262

263263
settings = BlogSettings.objects.get(id=1)
264264

265-
settings.site_icon = icon
266-
settings.site_logo = logo
265+
if icon:
266+
settings.site_icon = icon
267+
if logo:
268+
settings.site_logo = logo
269+
2672 8000 70
settings.site_title = title
268271
settings.tagline = tagline
269272
settings.keywords = keywords
@@ -290,7 +293,9 @@ def update_profile(request):
290293
password = request.POST.get('password')
291294

292295
profile = UserProfileInfo.objects.get(id=profile_id)
293-
profile.profile_pic = pic
296+
if pic:
297+
profile.profile_pic = pic
298+
294299
profile.save()
295300

296301
user = request.user

db.sqlite3

0 Bytes
Binary file not shown.
Loading

media/icons/ramanujan_VSHaQko.jpg

63 KB
Loading

media/icons/ramanujan_w37Dj92.jpg

63 KB
Loading
Loading

media/logos/ramanujan_6ZwjWfp.jpg

63 KB
Loading

media/logos/ramanujan_jviIyfA.jpg

63 KB
Loading
63 KB
Loading
63 KB
Loading
63 KB
Loading

templates/backend/profile.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="col-md-4">
55

66
<div class="post">
7-
<form method="POST" action="{% url 'backend:update_profile'%}">
7+
<form method="POST" action="{% url 'backend:update_profile'%}" enctype="multipart/form-data">
88
{% csrf_token %}
99
<input type="hidden" name="profile_id" value="{{profile.id}}">
1010
<div class="form-group">

templates/backend/settings.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="col-md-4">
55

66
<div class="post">
7-
<form method="post" action="{% url 'backend:update_settings'%}">
7+
<form method="post" action="{% url 'backend:update_settings'%}" enctype="multipart/form-data">
88
{% csrf_token %}
99
<div class="form-group">
1010
<img src="/media/{{settings.site_icon}}" alt="Icon" id="icon" width="50px;" height="50px;" >

0 commit comments

Comments
 (0)
0