def search_tag(request): if request.method == "GET" and request.GET.has_key("search"): form = SearchForm(request.GET) if form.is_valid(): pass else: form = SearchForm() return { 'form': form }
@vary_on_headers(*CACHE_VARY_ON_HEADERS) @cache_page_with_dynamic_key(generate_cache_key_from_request) # 1 minute def browse(request): active_filter = "new" try: profile = request.user.profile_set.latest('pk') except ObjectDoesNotExist, e: profile = None except AttributeError, e: # anonymous user profile = None if request.method == "POST" and not request.POST.has_key("poll_id"): form = SearchForm(request.POST) if form.is_valid(): pass else: form = SearchForm() genres = Genre.objects.all() print "####### genres: %s" % genres languages = Language.objects.all() content_type = ContentType.objects.get_for_model(Story) if request.GET.has_key("popular"): stories = Story.objects.extra( select = { 'stat_count': '(select count(*) FROM story_stat where content_type_id = ' + str(content_type.id) + ' and object_id = story_story.id)' },