Skip to content

Commit

Permalink
Merge da98f69 into 88df0d2
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitu210 committed May 28, 2016
2 parents 88df0d2 + da98f69 commit 9ae1332
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
3env/
build/
develop-eggs/
dist/
Expand Down
14 changes: 0 additions & 14 deletions django_blog_it/django_blog_it/templates/dashboard/menu/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,6 @@ <h1 align="center"><i class="fa fa-database"></i> Menus list</h1>

</div>

<div class="form-group">

<select class='input select2 select2_menu form-control' id="menu" name="menu" multiple>

{% for menu in menu_choices %}
<option value="{{ menu.id }}" {% for menu_id in requested_menus %}{% ifequal menu.id menu_id|add:'0' %}selected{% endifequal %}{% endfor %}>
{{ menu }}
</option>
{% endfor %}

</select>

</div>

<div class="form-group">
<button type="submit" class="btn btn-default" id="search_new_button"><i class='fa fa-search'></i> Search</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion django_blog_it/django_blog_it/templatetags/recurse.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def render(self, context):
def do_recurse(parser, token):
bits = list(token.split_contents())
if len(bits) != 6 and bits[2] != 'with' and bits[4] != 'as':
raise template.TemplateSyntaxError, "Invalid tag syxtax expected '{% recurse [childVar] with [parents] as [parent] %}'"
raise template.TemplateSyntaxError("Invalid tag syxtax expected '{% recurse [childVar] with [parents] as [parent] %}'")
child = parser.compile_filter(bits[1])
var = parser.compile_filter(bits[3])
name = bits[5]
Expand Down
14 changes: 4 additions & 10 deletions django_blog_it/django_blog_it/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,23 +539,17 @@ def bulk_actions_pages(request):
@active_admin_required
def menus(request):
menu_list = Menu.objects.filter(parent=None)
menu_choices = menu_list
context = {'menu_list': menu_list, 'menu_choices': menu_choices}
context = {'menu_list': menu_list}

if request.method == "POST":
requested_menus = request.POST.getlist('menu')

if request.POST.get('select_status', ''):
if request.POST.get('select_status') == "True":
menu_list = menu_list.filter(is_active=True)
menu_list = menu_list.filter(status=True)
else:
menu_list = menu_list.filter(is_active=False)
menu_list = menu_list.filter(status=False)

elif request.POST.getlist('category', []):
menu_list = menu_list.filter(id__in=request.POST.getlist('category'))

context = {'root_menu_items': menu_list, 'requested_menus': requested_menus,
'menu_choices': menu_choices}
context = {'root_menu_items': menu_list}
return render(request, 'dashboard/menu/list.html', context)


Expand Down
5 changes: 1 addition & 4 deletions django_blog_it/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls import url
from django.conf.urls.static import static
from .django_blog_it.views import *
from .posts.views import *
from .settings import MEDIA_URL, MEDIA_ROOT

print MEDIA_ROOT
print MEDIA_URL

urlpatterns = [
url(r'^$', index, name='index'),
Expand Down

0 comments on commit 9ae1332

Please sign in to comment.