# Path: festi/survey/models.py
# def random_name(instance, filename):
#     def __unicode__(self):
#     def as_dict(self):
#     def export_csv(self, f):
#     def as_dict(self):
# class Base(models.Model):
#     class Meta:
# class Event(Base):
# class Speaker(models.Model):
#     class Meta:
# class Survey(Base):
#     class Meta:


from django import forms
from .models import User, Survey
        model = User
        fields = ('uid', 'name', 'profile_image_url', 'email')


class UserUpdateForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('name', 'profile_image_url', 'email')


class SurveyCreateForm(forms.ModelForm):
    def __init__(self, data=None, *args, **kwargs):
        user_id = data.get('user')
        if user_id:
            try:
                found_user = User.objects.get(uid=user_id)
                data = data.copy()
                data.update({'user': found_user.id})
            except User.DoesNotExist:
                pass

        super(SurveyCreateForm, self).__init__(data, *args, **kwargs)

    class Meta:
        model = Survey
        fields = ('event', 'user', 'props')


class SurveyUpdateForm(forms.ModelForm):
    class Meta:

# Path: festi/survey/models.py
# def random_name(instance, filename):
#     def __unicode__(self):
#     def as_dict(self):
#     def export_csv(self, f):
#     def as_dict(self):
# class Base(models.Model):
#     class Meta:
# class Event(Base):
# class Speaker(models.Model):
#     class Meta:
# class Survey(Base):
#     class Meta:


# Path: festi/survey/forms_api.py
from django import forms
from .models import User, Survey

        model = User
        fields = ('uid', 'name', 'profile_image_url', 'email')


class UserUpdateForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('name', 'profile_image_url', 'email')


class SurveyCreateForm(forms.ModelForm):
    def __init__(self, data=None, *args, **kwargs):
        user_id = data.get('user')
        if user_id:
            try:
                found_user = User.objects.get(uid=user_id)
                data = data.copy()
                data.update({'user': found_user.id})
            except User.DoesNotExist:
                pass

        super(SurveyCreateForm, self).__init__(data, *args, **kwargs)

    class Meta:
        model = Survey
        fields = ('event', 'user', 'props')


class SurveyUpdateForm(forms.ModelForm):
    class Meta:

        model = Survey