예제 #1
0
 def delete(self, key):
     if auth.user_is_admin():
         Idea.get(key).delete()
     else:
         Messages.add('Only and administrator may delete submitted ideas. ' +
                      'This incident has been logged.')
     return self.redirect('/ideas')
예제 #2
0
파일: views.py 프로젝트: naughtond/innuvate
def submitidea(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		if post.has_key('tags') and post.has_key('title') and post.has_key('content'):
			try:
				content = post['content']
				idea = Idea()
				idea.tags = post['tags'].strip().split(',')
				idea.author = str(request.user)
				print "user: "******"Insufficient POST data (need 'content' and 'title'!)"
	return HttpResponseServerError(error_msg)
예제 #3
0
def go(request):
	user = request.user
				
	articles = None
	#articles = Article.objects(reported=True)
	articles = Article.objects(Q(reported=True) & Q(isvisible=True))
	s_articles = []
	for art in articles:
		s_articles.append(art)		
		
	ideas = None
	ideas = Idea.objects(Q(reported=True) & Q(isvisible=True))
	s_ideas = []
	for idea in ideas:		
		s_ideas.append(idea)


	promoted = Idea.objects(ispromoted=True)
	s_promoted = []
	for prom in promoted:
		s_promoted.append(prom)

	
	template_values = {
		'articles': s_articles,
		'ideas': s_ideas,
		'user' : user,
		'promoted': s_promoted,
	}

	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/manage.html')
	return render_to_response(path, template_values)
예제 #4
0
 def delete(self, key):
     """Deletes a project idea."""
     if auth.user_is_admin():
         Idea.get(key).delete()
     else:
         Messages.add('Only and administrator may delete submitted ' +
                      'ideas. This incident has been logged.')
     return self.redirect('/ideas')
예제 #5
0
    def post(self):
        user = users.get_current_user()
        new_idea = [];
        idea_name = self.request.get("idea-name")
        if not user:
        	new_idea = Idea(parent=ndb.Key("Entity", "anon"),
        	 		title=idea_name)
        else:
            new_idea = Idea(parent=ndb.Key("Entity",user.email().lower()),
			    title=idea_name)
        if(idea_name != ""):
            new_idea.put()
        self.redirect(self.request.referer)
예제 #6
0
파일: views.py 프로젝트: naughtond/innuvate
def approve(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		if post.has_key('id') and post.has_key('type'):
			try:
				iid = post['id']
				type = post['type']
				if type =='idea':
					ideas = Idea.objects(id=iid)
					if(len(ideas) >0):
						idea = ideas[0]
						idea.reported = False
						idea.save()
				else:
					articles = Article.objects(id=iid)
					if(len(articles) >0):
						art = articles[0]
						art.reported = False						
						art.save()
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"
	return HttpResponseServerError(error_msg)
예제 #7
0
파일: views.py 프로젝트: naughtond/innuvate
def unpublish(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		if post.has_key('id') and post.has_key('type'):
			try:
				iid = post['id']
				type = post['type']
				if type =='idea':
					ideas = Idea.objects(id=iid)
					if(len(ideas) >0):
						idea = ideas[0]
						idea.isvisible = False						
						idea.save()
						try:
							t = ThreadClass("Idea Unpublished", "Your idea '"+idea.title +"' has been unpublished.",[idea.email]+"'")
							t.start()					
						except Exception as inst:
							print 'exception sending email '+str(inst)
				else:
					articles = Article.objects(id=iid)
					if(len(articles) >0):
						art = articles[0]
						art.isvisible = False						
						art.save()
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"
	return HttpResponseServerError(error_msg)
예제 #8
0
def go(request):
	user = request.user
	
	filtertag =  request.META['HTTP_REFERER']
	showtag = False
	if filtertag.find('/tag/') >=0:
		showtag = True
		filtertag = filtertag.split('/')[4]
	else:
		filtertag = None
	
	
	ideas = None
	ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-votecount')
	s_ideas = []
	for idea in ideas:
		if str(request.user) in idea.voters:
			idea.hasvoted = True
		if showtag:
			if filtertag in idea.tags:
				s_ideas.append(idea)
		else:
			s_ideas.append(idea)

	
	template_values = {
		'ideas': s_ideas,
		'user' : user,
	}

	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/allideas.html')
	return render_to_response(path, template_values)
예제 #9
0
def get_ideas(board):
    """1. Get Ideas - takes board object"""
    # 1a query database for all ideas with colour
    ideas = Idea.get_colour_ideas_by_board(board)

    # 1c extract colours into dictionary with weighting
    data = dict()

    if len(ideas) == 0:
        add_colour_to_dictionary(data, '#ffffff')  # add white if there are no colour tags
    else:
        for idea in ideas:
            add_colour_to_dictionary(data, Idea.get_colour(idea))

    """sort dictionary by value descending"""
    return sort_dictionary_by_desc_value(data)
예제 #10
0
def store_idea_content(request, idea=None):
	if not idea:
		idea = Idea.new_with_post(request)
	else:
		idea.update_with_post(request)
	idea.full_clean()
	idea.save()
예제 #11
0
def import_posts(commit=True):
    ideas = Idea.all().fetch(1000)
    #ideas = [Idea.get_by_id(9)]
    print 'Importing posts for %s idea(s)...' % len(ideas)

    to_put = []
    for idea in ideas:
        soup = make_soup(idea.source_url)

        # We get the idea's actual body from the RSS feed
        rss = feedparser.parse(idea_feed_url(idea))
        body = rss.feed.subtitle.replace(
            '\nFeed Created by spigit.com feed manager.', '')
        idea.body = clean_body(body)
        to_put.append(idea)

        headers = soup.find('td', 'main')\
            .findAll('div', 'commentheader', recursive=False)
        for header in headers:
            content = header.findNextSiblings('div', limit=1)[0]
            post = make_post(idea, header, content, commit=False)
            to_put.extend(post)

    to_put = filter(None, to_put)

    if commit:
        db.put(to_put)

    return to_put
예제 #12
0
파일: views.py 프로젝트: naughtond/innuvate
def promote(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		print "promote ID: "+post['id']
		if post.has_key('id') :
			try:
				iid = post['id']
				ideas = Idea.objects(id=iid)
				print "len: "+str(len(ideas))
				if(len(ideas) >0):
					idea = ideas[0]
					idea.ispromoted = True
					incrementStat('promotions',1)
					people = Person.objects(email=idea.email)
					if people and len(people)>0:
						person = people[0]
						person.timesPromoted = person.timesPromoted +1
						rating = Score.objects(type='promotion')[0].value
						person.currentRating = person.currentRating + rating
						person.save()
					idea.save()
					try:
						t = ThreadClass("Idea Promoted", "Your idea '"+str(idea.title)+"' has been promoted and will now go forward for idea selection, it may or may not be chosen for implementation.",[idea.email])
						t.start()					
					except Exception as inst:
						print 'exception sending email '+str(inst)
						traceback.print_exc()
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"
	return HttpResponseServerError(error_msg)
예제 #13
0
    def get(self, id):
        idea = Idea.get_by_id(int(id))
        if idea is None:
            self.error(404)
            self.response.out.write('Idea not found.')
            return

        self.render('idea.html', {'idea': idea})
예제 #14
0
def getStructuredDataFromEmail(email):
	ideas = []
	idea_query = Idea.query(ancestor=ndb.Key("Entity", email)).order(-Idea.dateCreated)
	for idea in idea_query:
		temp = [idea.key.urlsafe(), idea.title, [], idea.dateCreated]
		temp[2] = getStructuredFeaturesFromKey(idea.key)
		ideas.append(temp)
	return ideas
예제 #15
0
 def post(self):
     """Posts a new project idea."""
     name = self.request.get('name')
     description = self.request.get('description')
     Idea(name=name,
         description=description,
         author=auth.current_user()).put()
     return self.redirect('/ideas')
예제 #16
0
def getStructuredDataFromEmail(email):
    ideas = []
    idea_query = Idea.query(
        ancestor=ndb.Key("Entity", email)).order(-Idea.dateCreated)
    for idea in idea_query:
        temp = [idea.key.urlsafe(), idea.title, [], idea.dateCreated]
        temp[2] = getStructuredFeaturesFromKey(idea.key)
        ideas.append(temp)
    return ideas
예제 #17
0
def go(request):
	
	views.incrementStat('ideaviews',1)
	pathinfo = request.META['PATH_INFO']
	pathinfo = pathinfo[10:]
	pathinfo = pathinfo.replace('/','')
	
	user = request.user
	ideas = None
	idea = None
	try:
#		ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-votecount')[:20]
		ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False) & Q(id=pathinfo)).order_by('-votecount')[:20]
	except:
		ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-votecount')[:20]
	if ideas == None or len(ideas) == 0:
		ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-votecount')[:20]
	if len(ideas)>0:
		idea = ideas[0]
		vc = idea.viewcount
		if str(user) in idea.voters:
			idea.hasvoted = True
		if vc==None:
			vc = 1
		else:
			vc = vc + 1
		idea.viewcount = vc
		idea.save()
		
		if user.is_authenticated():
			try:
				t = ThreadClass(request)
				t.start()					
			except Exception as inst:
				print 'exception updating view rating '+str(inst)
		
	template_values = {
		'idea': idea,
		'user' : user,
	}

	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/idea.html')
	return render_to_response(path, template_values)
예제 #18
0
def go(request):
	user = request.user
	
	filtertag =  request.META['HTTP_REFERER']
	showtag = False
	tabselected=None
	ideaid=None
	if filtertag.find('/tag/') >=0:
		showtag = True
		filtertag = filtertag.split('/')[4]
	elif filtertag.find('/idea/') >=0:
		ideaid = filtertag.split('/')[5]
		filtertag=None
		tabselected='4'
	else:
		filtertag = None
	
	tags = Idea.objects.item_frequencies('tags', normalize=True)
	top_tags = sorted(tags.items(), key=itemgetter(1), reverse=True)[:6]
	tagobs = []
	for key in top_tags:
		tg = tagclass()
		tg.tag = key[0]
		tg.val = key[1]
		tg.color = str(random.randrange(10,30,1))
		if len(tg.tag)>0:
			tagobs.append(tg)

	
	ideas = None
	ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-votecount')[:20]
	s_ideas = []
	for idea in ideas:
		if str(request.user) in idea.voters:
			idea.hasvoted = True
		if showtag:
			if filtertag in idea.tags:
				s_ideas.append(idea)
		else:
			s_ideas.append(idea)

	
	template_values = {
		'ideas': s_ideas,
		'user' : user,
		'tags': tagobs,
		'filtertag':filtertag,
		'tabselected':tabselected,
		'ideaid':ideaid,
	}

	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/topten.html')
	return render_to_response(path, template_values)
예제 #19
0
 def setUp(self):
     """Set up a temp database before each test"""
     basedir = os.path.abspath(os.path.dirname(__file__))
     app.config['TESTING'] = True
     self.test_db_path = os.path.join(basedir, TEST_DB)
     app.config[
         'SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + self.test_db_path
     self.app = app.test_client()
     db.create_all()
     fixtures = [Idea(text=f'idea{i}') for i in range(5)]
     db.session.bulk_save_objects(fixtures)
     db.session.commit()
예제 #20
0
 def approve(self, key):
     if auth.user_is_admin():
         idea = Idea.get(key)
         Project(name=idea.name,
                 description=idea.description,
                 author=idea.author,
                 post_time=idea.post_time).put()
         idea.delete()
         return self.redirect('/projects')
     else:
         Messages.add('Only and administrator may approve submitted ' +
                      'ideas. This incident has been logged.')
         return self.redirect('/ideas')
예제 #21
0
파일: views.py 프로젝트: naughtond/innuvate
def initIdeas(request):
	for i in range(100):
		idea = Idea()
		idea.title = "idea "+str(i)
		idea.content = "This is a test Idea"
		idea.author = "jimmy"
		idea.save()
	return HttpResponseRedirect('/')
예제 #22
0
 def approve(self, key):
     """Promotes a project idea to an accepted project."""
     if auth.user_is_admin():
         idea = Idea.get(key)
         Project(name=idea.name,
                 description=idea.description,
                 author=idea.author,
                 post_time=idea.post_time).put()
         idea.delete()
         return self.redirect('/projects')
     else:
         Messages.add('Only and administrator may approve submitted ' +
                      'ideas. This incident has been logged.')
         return self.redirect('/ideas')
예제 #23
0
파일: views.py 프로젝트: Cardboard/camil
def save_idea(form):
    # process data in form.cleaned_data
    title = form.cleaned_data['title']
    title_nospaces = str(title.replace(' ', '_').lower())
    status = form.cleaned_data['status']
    short_desc = form.cleaned_data['short_desc']
    long_desc = form.cleaned_data['long_desc']
    date_formed = form.cleaned_data['date_formed']
    links_strings = form.cleaned_data['links'].split(',')
    tags_strings = form.cleaned_data['tags'].split(',')
    sources_strings = form.cleaned_data['sources'].split(',')
    images_strings = form.cleaned_data['images'].split(',')
    # save new idea with cleaned form data
    new_idea = Idea(title=title,status=status,short_desc=short_desc,
		    long_desc=long_desc,date_formed=date_formed)
    new_idea.save()
    # add links, tags, sources, and images
    for link in links_strings:
	new_link = Link(url=link)
	new_link.save()
	new_idea.links.add(new_link)
    for tag in tags_strings:
	new_tag = Tag(tag=tag)
	new_tag.save()
	new_idea.tags.add(new_tag)
    for source in sources_strings:
	new_source = Source(source=source)
	new_source.save()
	new_idea.sources.add(new_source)
    for image in images_strings:
	new_image = Image(url=image)
	new_image.save()
	new_idea.images.add(new_image)
    # save after adding data
    new_idea.save()
    return title
예제 #24
0
def create_idea():
    """Receives JSON and stores new Idea to db"""

    idea = request.get_json()
    new_idea = Idea(
        idea_session_id = idea['session'],
        name = idea['name'],
        creator_id = g.user.id
    )
    db.session.add(new_idea)
    db.session.commit() 
    idea['id'] = new_idea.id
    idea['description'] = None
    idea['creator_id'] = g.user.id
    return _todo_response(idea)
예제 #25
0
파일: views.py 프로젝트: naughtond/innuvate
def report(request):
	tag =  request.path_info
	tag = tag.split('/')[2]
	ideas = Idea.objects(id=tag)
	if len(ideas)>0:
		idea = ideas[0]
		idea.reported = True
		incrementStat('ideasreported',1)
		person = getPerson(request)
		if person:
			person.timesReport = person.timesReport +1
			rating = Score.objects(type='report')[0].value
			person.currentRating = person.currentRating + rating
			person.save()
		idea.save()
	return HttpResponseRedirect('/')
예제 #26
0
def go(request):
	user = request.user
	
	ideas = None
	ideas = Idea.objects(Q(isvisible=True) & Q(ispromoted=False)).order_by('-date')[:20]
	s_ideas = []
	for idea in ideas:
		s_ideas.append(idea)

	
	template_values = {
		'ideas': s_ideas,
		'user' : user,
	}

	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/newideas.html')
	return render_to_response(path, template_values)
예제 #27
0
def ideas():

    if request.method == 'POST':
        title = request.form.get('title')
        description = request.form.get('description')
        author = request.form.get('author')
        category_id = request.form.get('category_id')

        idea = Idea(title, description, author, category_id).save()
        db.session.add(idea)
        db.session.commit()

        return redirect(url_for('show_idea', id=idea.id))

    context = {'title': 'Ideas', 'ideas': Idea.query.all()}

    return render_template('ideas/index.html', **context)
예제 #28
0
파일: views.py 프로젝트: naughtond/innuvate
def demote(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		if post.has_key('id') :
			try:
				iid = post['id']
				ideas = Idea.objects(id=iid)
				if(len(ideas) >0):
					idea = ideas[0]
					idea.ispromoted = False
					idea.save()
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"
	return HttpResponseServerError(error_msg)
예제 #29
0
 def post(self):
     user = users.get_current_user()
     new_idea = []
     idea_name = self.request.get("idea-name")
     if not user:
         new_idea = Idea(parent=ndb.Key("Entity", "anon"), title=idea_name)
     else:
         new_idea = Idea(parent=ndb.Key("Entity",
                                        user.email().lower()),
                         title=idea_name)
     if (idea_name != ""):
         new_idea.put()
     self.redirect(self.request.referer)
def validate_create_idea():
    if "user_id" not in session:
        return redirect("/")
    print(request.form["idea_content"])
    is_valid = True
    if not request.form["idea_content"]:
        is_valid = False
        flash("You cannot post an empty idea.")
    if len(request.form["idea_content"]) > 255:
        flash("Ideas must be less than 255 characters.")
        is_valid = False

    if is_valid:
        new_idea = Idea(content=request.form["idea_content"],
                        author_id=session["user_id"]["id"])
        db.session.add(new_idea)
        db.session.commit()
        flash("Idea saved!")

    return redirect("/userpage")
예제 #31
0
파일: views.py 프로젝트: naughtond/innuvate
def addcomment(request):
	error_msg = u"No POST data sent."
	print 'addcomment called'	
	if request.method == "POST":
		post = request.POST.copy()
		if post.has_key('content') and post.has_key('id'):
			try:
				iid = post['id']
				ideas = Idea.objects(id=iid)
				if(len(ideas) >0):
					idea = ideas[0]
					comment = Comment()
					comment.content = post['content']
					if not comment.content or comment.content.strip()=="":
						return HttpResponseRedirect('/')
					comment.author = str(request.user)
					idea.comments.append(comment)
					incrementStat('comments',1)
					person = getPerson(request)
					if person:
						person.lastActive = datetime.datetime.now()
						person.timesCommented = person.timesCommented + 1
						rating = Score.objects(type='comment')[0].value
						person.currentRating = person.currentRating + rating
						person.save()
					idea.save()
					try:
						t = ThreadClass(comment.author+" has commented on your idea: '"+idea.title+"'", comment.author+" commented: '"+comment.content+"'",[idea.email])
						t.start()					
					except Exception as inst:
						print 'exception sending email '+str(inst)
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			print 'didnt comment, no data'
			return HttpResponseRedirect('/')
#			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"

	return HttpResponseServerError(error_msg)
예제 #32
0
파일: views.py 프로젝트: naughtond/innuvate
def vote(request):
	error_msg = u"No POST data sent."	
	if request.method == "POST":
		post = request.POST.copy()
		print 'post = '+str(post)
		if post.has_key('id') and post.has_key('star1'):
			try:
				iid = post['id']
				ideas = Idea.objects(id=iid)
				if(len(ideas) >0):
					idea = ideas[0]
					curcount = idea.votecount
					print post['star1']
					voteval = int(post['star1'])		
					idea.votecount = idea.votecount + voteval
					idea.voters.append(str(request.user))
					incrementStat('unique_idea_votes',1)
					incrementStat('total_idea_vote_count',voteval)
					person = getPerson(request)
					if person:
						person.lastActive = datetime.datetime.now()
						rating = Score.objects(type='vote')[0].value
						person.currentRating = person.currentRating + rating
						person.timesVoted = person.timesVoted + 1
						person.save()
					idea.save()
					try:
						t = ThreadClass("Idea voted on", "Your idea '"+idea.title +"' has been given a voting of "+str(voteval)+".",[idea.email])
						t.start()					
					except Exception as inst:
						print 'exception sending email '+str(inst)
				return HttpResponseRedirect('/')
			except Exception as inst:
				return HttpResponseServerError('wowza! an error occurred, sorry!</br>'+str(inst))
		else:
			print 'no vote cast, no stars selected'
#			error_msg = u"Insufficient POST data (need 'slug' and 'title'!)"
			return HttpResponseRedirect('/')
	return HttpResponseServerError(error_msg)
예제 #33
0
def create_idea():
    if "user_id" not in session:
        return redirect("/")
    is_valid = True
    if not request.form["idea_content"]:
        is_valid = False
        flash("You cannot post an empty idea.")
    if len(request.form["idea_content"]) > 255:
        flash("Ideas must be less than 255 characters.")
        is_valid = False

    if is_valid:
        new_idea = Idea(content=request.form["idea_content"],
                        author_id=session["user_id"]["id"])
        db.session.add(new_idea)
        db.session.commit()
        flash("Idea saved!")
        user_data = User.query.filter_by(
            user_id=session["user_id"]["id"]).all()
        idea_data = Idea.query.order_by(desc(Idea.created_at)).join(User).all()
        return render_template("/partials/idea_feed.html",
                               user_data=user_data[0],
                               idea_data=idea_data)
예제 #34
0
 def get_ideas(self, facet, criteria):
     return Idea.all().filter('stage =', criteria).fetch(1000)
예제 #35
0
from app import db
from models import Idea

ideas = []
with open('ideas.txt') as f:
    for line in f:
        ideas.append(Idea(text=line.strip()))

s = db.session
s.bulk_save_objects(ideas)
s.commit()
예제 #36
0
 def get_ideas(self, facet, criteria):
     return Idea.all().filter('author =', facet).fetch(1000)
예제 #37
0
 def get(self):
     """Displays a list of all project ideas."""
     return self.render('ideas', {'ideas': Idea.all()})
예제 #38
0
def submit(request, redirect, stype):

    ## To submit an idea the profile has to be completed (Licensing...)
    if isProfilUncomplete(request):
        return profile(request, True)
    else:
        if request.method == 'POST':

            if stype == 'idea':
                form = IdeaForm(request.POST)
            else:
                form = DesignForm(request.POST, request.FILES)

            if form.is_valid():
                cd = form.cleaned_data

                if stype == 'idea':
                    myt = Idea(name = cd['name'],
                               description = cd['description'],
                               creator = request.user,
                               category = cd['category'],
                               like = 0,
                               dontlike= 0,
                               dontcare = 0,
                               nbsupports = 0,
                               activated = 'A')
                elif stype == 'designstation':
                    myt = DesignStation(name = cd['title'],
                               description = cd['description'],
                               creator = request.user,
                               pict = cd['image'],
                               like = 0,
                               dontlike= 0,
                               dontcare = 0,
                               nbsupports = 0,
                               activated = 'A')
                else:
                    myt = DesignBike(name = cd['title'],
                               description = cd['description'],
                               creator = request.user,
                               pict = cd['image'],
                               like = 0,
                               dontlike= 0,
                               dontcare = 0,
                               nbsupports = 0,
                               activated = 'A')

                    
                myt.save()

                return HttpResponseRedirect(redirect)
            else:
                return render_to_response('submit.html',
                                          {'me': request.user.username,
                                           'form': form, 
                                           'current_menu':stype},
                                          context_instance=RequestContext(request))
        else:

            if stype == 'idea':
                form = IdeaForm()
            else:
                form = DesignForm()

            return render_to_response('submit.html',
                                      {'me': request.user.username,
                                       'form': form,
                                       'current_menu':stype},
                                      context_instance=RequestContext(request))
예제 #39
0
 def get(self):
     return self.render('ideas', { 'ideas': Idea.all() })
예제 #40
0
 def get(self):
     ideas = Idea.all().order('stage').fetch(1000)
     grouped_ideas = groupby(ideas, attrgetter('stage'))
     # Force evaluation of the generators, so they can be reused
     grouped_ideas = [(key, list(group)) for key, group in grouped_ideas]
     self.render('index.html', {'grouped_ideas': grouped_ideas})
예제 #41
0
 def get_ideas(self, facet, criteria):
     return Idea.all().filter('tags =', urllib.unquote(criteria))\
         .fetch(1000)