symposion_app/symposion/reviews/forms.py
Hiroshi Miura a95825ede8 python3 compatibility
- Things are suggested in python3 porting guide.
https://docs.djangoproject.com/en/1.8/topics/python3/

     1. adding ```from django.utils.encoding import
     python_2_unicode_compatible```

     2. ``` __str__``` instead of ```__unicode__```
     https://docs.djangoproject.com/en/1.8/topics/python3/#str-and-unicode-methods

     3. Adding ```from __future__ import unicode_literals``` at the top
     of your Python modules
     https://docs.djangoproject.com/en/1.8/topics/python3/#unicode-literals

     4. Removing the `u` prefix before unicode strings;
     https://docs.djangoproject.com/en/1.8/topics/python3/#unicode-literals

- also closed #66

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2015-08-03 23:32:25 +09:00

41 lines
1.1 KiB
Python

from __future__ import unicode_literals
from django import forms
from markitup.widgets import MarkItUpWidget
from symposion.reviews.models import Review, Comment, ProposalMessage, VOTES
class ReviewForm(forms.ModelForm):
class Meta:
model = Review
fields = ["vote", "comment"]
widgets = {"comment": MarkItUpWidget()}
def __init__(self, *args, **kwargs):
super(ReviewForm, self).__init__(*args, **kwargs)
self.fields["vote"] = forms.ChoiceField(
widget=forms.RadioSelect(),
choices=VOTES.CHOICES
)
class ReviewCommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ["text"]
widgets = {"text": MarkItUpWidget()}
class SpeakerCommentForm(forms.ModelForm):
class Meta:
model = ProposalMessage
fields = ["message"]
widgets = {"message": MarkItUpWidget()}
class BulkPresentationForm(forms.Form):
talk_ids = forms.CharField(
max_length=500,
help_text="Provide a comma seperated list of talk ids to accept."
)