def clean(self, *args, **kwargs): cleaned_data = super(SubmissionForm, self).clean(*args, **kwargs) movie = Movie.exists(compile(r'.+\/tt(\d+)\/').match(cleaned_data['imdb_link']).group(1)) if movie: raise forms.ValidationError('%s has already submitted this movie' % movie.added_by.first_name.capitalize()) return cleaned_data
def clean(self, *args, **kwargs): cleaned_data = super(SubmissionForm, self).clean(*args, **kwargs) movie = Movie.exists( compile(r'.+\/tt(\d+)\/').match( cleaned_data['imdb_link']).group(1)) if movie: raise forms.ValidationError('%s has already submitted this movie' % movie.added_by.first_name.capitalize()) return cleaned_data
def get_context_data(self, **kwargs): context = super(Widget, self).get_context_data(**kwargs) context['rating'] = Movie.get_rating_for(self.get_queryset()) return context