Beispiel #1
0
 def post(self, request, *arg, **kwargs):
     if self.request.accepted_renderer.format == 'html':
         form = PitchForm(request.POST)
         if form.is_valid():
             pitch = form.save(commit=False)
             pitch.creator = request.user
             pitch.group_id = kwargs["group_pk"]
             pitch.save()
             Comment.add_root(creator=User.objects.all()[0],
                              content_object=pitch, text='')
             return redirect('/groups/' + str(kwargs["group_pk"]))
Beispiel #2
0
def populate_db():
    get = lambda id: Comment.objects.get(pk=id)
    chad = User.objects.create(username='******', password=make_password('chad'), email='*****@*****.**')
    brad = User.objects.create(username='******', password=make_password('brad'), email='*****@*****.**')
    secsi = Group.objects.create(name='SECSI', creator=chad, description='South East Complex Systems Institute')
    secsi.members.add(chad)
    secsi.members.add(brad)
    secsi.save()
    p1 = secsi.pitch_set.create(creator=chad, title='let\'s get a keg.', text="okay bros we " +
                                                                              "know we can't throw a rager and get all " +
                                                                              "the other bros over if we don't have a keg. " +
                                                                              "let's get a keg.")
    croot = Comment.add_root(creator=User.objects.all()[1], text='', content_object=p1)
    c1 = get(croot.pk).add_child(creator=brad, text='fuckkk bro i got so hammered at that ' +
                                                    'last kegger that i broke my keg tap. im good for the cash '
                                                    'but since that last dui it\'s hard to get down to liqueur loft.'
                                                    'can one of you get another tap?')
    c2 = get(c1.pk).add_child(creator=chad, text='np bro i still have the one from the throwdown at blake\'s.')