Search Results

Search found 2 results on 1 pages for 'tsoporan'.

Page 1/1 | 1 

  • Django "comment_was_flagged" signal

    - by tsoporan
    Hello, This is my first time working with django signals and I would like to hook the "comment_was_flagged" signal provided by the comments app to notify me when a comment is flagged. This is my code, but it doesn't seem to work, am I missing something? from django.contrib.comments.signals import comment_was_flagged from django.core.mail import send_mail def comment_flagged_notification(sender, **kwargs): send_mail('testing moderation', 'testing', 'test@localhost', ['[email protected]',]) comment_was_flagged.connect(comment_flagged_notification) (I am just testing the email for now, but I have assured the email is sending properly.) Thanks!

    Read the article

  • Django formset doesn't validate

    - by tsoporan
    Hello, I am trying to save a formset but it seems to be bypassing is_valid() even though there are required fields. To test this I have a simple form: class AlbumForm(forms.Form): name = forms.CharField(required=True) The view: @login_required def add_album(request, artist): artist = Artist.objects.get(slug__iexact=artist) AlbumFormSet = formset_factory(AlbumForm) if request.method == 'POST': formset = AlbumFormSet(request.POST, request.FILES) if formset.is_valid(): return HttpResponse('worked') else: formset = AlbumFormSet() return render_to_response('submissions/addalbum.html', { 'artist': artist, 'formset': formset, }, context_instance=RequestContext(request)) And the template: <form action="" method="post" enctype="multipart/form-data">{% csrf_token %} {{ formset.management_form }} {% for form in formset.forms %} <ul class="addalbumlist"> {% for field in form %} <li> {{ field.label_tag }} {{ field }} {{ field.errors }} </li> {% endfor %} </ul> {% endfor %} <div class="inpwrap"> <input type="button" value="add another"> <input type="submit" value="add"> </div> </form> What ends up happening is I hit "add" without entering a name then HttpResponse('worked') get's called seemingly assuming it's a valid form. I might be missing something here, but I can't see what's wrong. What I want to happen is, just like any other form if the field is required to spit out an error if its not filled in. Any ideas?

    Read the article

1