# Path: opendiamond/scopeserver/gatekeeper/models.py
# class Collection(models.Model):
#     name = models.CharField(max_length=100)
#     gid = models.CharField(max_length=23)
#     allowed_users = models.ManyToManyField(User, blank=True)
#     servers = models.ManyToManyField(Server)
# 
#     def __unicode__(self):
#         return self.name
# 
# Path: opendiamond/scopeserver/cocktail/models.py
# class CocktailBase(models.Model):
#     name = models.CharField(max_length=256)
#     dataset = models.CharField(max_length=256)
#     allowed_users = models.ManyToManyField(User, blank=True)
#     servers = models.ManyToManyField(Server)
# 
#     def __unicode__(self):
#         return self.name


from builtins import object
from django import forms
from django.contrib.auth.models import User
from opendiamond.scopeserver.gatekeeper.models import Collection
from .models import CocktailBase
#
#  This software is distributed under the terms of the Eclipse Public
#  License, Version 1.0 which can be found in the file named LICENSE.
#  ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
#  RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT
#



class CocktailBaseForm(forms.Form):
    def __init__(self, *args, **kwargs):
        user = kwargs['user']
        del kwargs['user']
        super(CocktailBaseForm, self).__init__(*args, **kwargs)
        self.fields['bases'].queryset = user.collection_set.all()
        self.fields['mixers'].queryset = user.cocktailbase_set.all()

    bases = forms.ModelChoiceField(
        queryset=Collection.objects.all(),
        initial=1,
        widget=forms.RadioSelect
    )

    mixers = forms.ModelChoiceField(
        queryset=CocktailBase.objects.all(),
        empty_label='None',
        widget=forms.RadioSelect,
        required=False,
    )


# Path: opendiamond/scopeserver/gatekeeper/models.py
# class Collection(models.Model):
#     name = models.CharField(max_length=100)
#     gid = models.CharField(max_length=23)
#     allowed_users = models.ManyToManyField(User, blank=True)
#     servers = models.ManyToManyField(Server)
# 
#     def __unicode__(self):
#         return self.name
# 
# Path: opendiamond/scopeserver/cocktail/models.py
# class CocktailBase(models.Model):
#     name = models.CharField(max_length=256)
#     dataset = models.CharField(max_length=256)
#     allowed_users = models.ManyToManyField(User, blank=True)
#     servers = models.ManyToManyField(Server)
# 
#     def __unicode__(self):
#         return self.name


# Path: opendiamond/scopeserver/cocktail/forms.py
from builtins import object
from django import forms
from django.contrib.auth.models import User
from opendiamond.scopeserver.gatekeeper.models import Collection
from .models import CocktailBase

#
#  This software is distributed under the terms of the Eclipse Public
#  License, Version 1.0 which can be found in the file named LICENSE.
#  ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
#  RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT
#



class CocktailBaseForm(forms.Form):
    def __init__(self, *args, **kwargs):
        user = kwargs['user']
        del kwargs['user']
        super(CocktailBaseForm, self).__init__(*args, **kwargs)
        self.fields['bases'].queryset = user.collection_set.all()
        self.fields['mixers'].queryset = user.cocktailbase_set.all()

    bases = forms.ModelChoiceField(
        queryset=Collection.objects.all(),
        initial=1,
        widget=forms.RadioSelect
    )

    mixers = forms.ModelChoiceField(
        queryset=CocktailBase.objects.all(),
        empty_label='None',
        widget=forms.RadioSelect,
        required=False,
    )


    classes = forms.CharField(label='Classes: ',