Skip to content

Commit

Permalink
fix update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gothack329 committed Mar 24, 2018
1 parent 31ec80d commit 3b448e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
9 changes: 9 additions & 0 deletions article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from django.contrib import messages
from .models import *
from userpage.models import *
from django.contrib.auth.decorators import login_required
from django.db import transaction


# Create your views here.
Expand Down Expand Up @@ -83,8 +85,15 @@ def publish(request):
return render(request,'article/publish.html',{'article_form':article_form,'operation':'发布'})


@login_required
@transaction.atomic
def update(request, article_id):
art = Article.objects.get(pk=article_id)
if request.user.username == art.author_id.user.username:
pass
else:
return redirect('/article/%d/' % (article_id,))

if request.method == 'POST':
article_form = ArticleForm(request.POST,request.FILES,instance=art)

Expand Down
Binary file modified db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion edconline/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
DEBUG = True

ALLOWED_HOSTS = ['*']

LOGIN_URL = '/userpage/login/'

# Application definition

Expand Down
12 changes: 7 additions & 5 deletions static/bootstrap/css/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

@media (min-width:500px){
.container{width:480px}
.banner{height:300px}
}

html,body {
background-color:#f6f8fa;
Expand Down Expand Up @@ -72,7 +75,6 @@ ul.nav.navbar-nav li a:hover {

div.container-fluid {
margin:0;

position:relative;
min-height:100%;
/*设置padding-bottom值大于等于footer的height值,以保证main的内容能够全部显示出来而不被footer遮盖;*/
Expand All @@ -81,7 +83,7 @@ div.container-fluid {
}

.container {
width:80%;
min-width:80%;
}

.sidebar , .content {
Expand All @@ -91,7 +93,7 @@ div.container-fluid {
.card {
width:100%;
padding:10px;
margin:10px;
margin-top:10px;
border: 1px solid #e2e2e2;
box-shadow: 1px 1px 1px 1px #e2e2e2;
background-color:white;
Expand Down Expand Up @@ -268,4 +270,4 @@ footer, footer a{
.foot-wrap .foot-top ul li {
float:left;
padding-right:20px;
}
}

0 comments on commit 3b448e0

Please sign in to comment.