Skip to content

Commit

Permalink
Merge branch 'master' of github.com:durden/dash
Browse files Browse the repository at this point in the history
  • Loading branch information
durden committed Jul 31, 2011
2 parents 7015d7b + 122ff6b commit 5ff0eb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
5 changes: 2 additions & 3 deletions apps/codrspace/templates/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div id="content">{{ form.content }}</div>
<div id="status">
{{ form.status }}
<input type="submit" value="Save changes" />
<input type="submit" name="submit_post" value="Save changes" />
</div>

{% if posts %}
Expand All @@ -44,7 +44,7 @@
<div id="media-form-wrap">
{% csrf_token %}
{{ media_form.file }}
<input type="submit" value="Upload File" />
<input type="submit" name="submit_file" value="Upload File" />
</div>

{% if media_set %}
Expand All @@ -68,7 +68,6 @@
<script type="text/javascript">

$(".media-item a").click(function(){
console.log('read me fast');
$("#id_content").val($('#id_content').val()+ $(this).text());
$("#id_content")[0].scrollTop = $("#id_content")[0].scrollHeight;
return false;
Expand Down
25 changes: 11 additions & 14 deletions apps/codrspace/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,26 @@ def add(request, template_name="add.html"):

if request.method == "POST":

# # media post
# if 'file' in request.FILES:

# media
media_form = MediaForm(request.POST, request.FILES)
if media_form.is_valid():
media = media_form.save(commit=False)
media.uploader = request.user
media.filename = unicode(media_form.cleaned_data.get('file', ''))
media.save()

# # post post hehe
# if 'title' in request.POST:

# post
form = PostForm(request.POST)
if form.is_valid():
if form.is_valid() and 'submit_post' in request.POST:
post = form.save(commit=False)
post.author = request.user
if post.status == 'published':
post.publish_dt = datetime.now()
post.save()
return redirect('edit', pk=post.pk)
else:
print list(form.errors)

# if something to submit
if post.title or post.content:
post.author = request.user
if post.status == 'published':
post.publish_dt = datetime.now()
post.save()
return redirect('edit', pk=post.pk)

else:
form = PostForm()
Expand Down

0 comments on commit 5ff0eb6

Please sign in to comment.