# Path: opendiamond/scopeserver/metadata/models.py
# class MetadataCollection(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 .models import MetadataCollection
        del kwargs['user']
        super(MetadataCollectionForm, self).__init__(*args, **kwargs)
        self.fields['collections'].queryset = user.metadatacollection_set.all()

    collections = forms.ModelMultipleChoiceField(
        queryset=MetadataCollection.objects.all(),
        widget=forms.CheckboxSelectMultiple
    )

    keywords = forms.CharField(label='Keywords',
                               help_text='Comma-separated phrases. '
                                         'Ignored if left blank',
                               required=False)  # no 'strip' in Django 1.3

    divisor = forms.IntegerField(label='Buckets',
                                 help_text='Integer. Bucket the images.'
                                           ' Ignored if left blank.',
                                 required=False)

    expression = forms.CharField(label="Expression",
                                 help_text='Condition applied to bucket ID.'
                                           ' Examples: "<3", "=3", ">3".'
                                           ' "3" will be converted to "=3".'
                                           ' Ignored if left blank.',
                                 required=False)


class ManageForm(forms.Form):
    user = forms.ModelChoiceField(queryset=User.objects.all())
    collections = forms.ModelMultipleChoiceField(

# Path: opendiamond/scopeserver/metadata/models.py
# class MetadataCollection(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/metadata/forms.py
from builtins import object
from django import forms
from django.contrib.auth.models import User
from .models import MetadataCollection

        del kwargs['user']
        super(MetadataCollectionForm, self).__init__(*args, **kwargs)
        self.fields['collections'].queryset = user.metadatacollection_set.all()

    collections = forms.ModelMultipleChoiceField(
        queryset=MetadataCollection.objects.all(),
        widget=forms.CheckboxSelectMultiple
    )

    keywords = forms.CharField(label='Keywords',
                               help_text='Comma-separated phrases. '
                                         'Ignored if left blank',
                               required=False)  # no 'strip' in Django 1.3

    divisor = forms.IntegerField(label='Buckets',
                                 help_text='Integer. Bucket the images.'
                                           ' Ignored if left blank.',
                                 required=False)

    expression = forms.CharField(label="Expression",
                                 help_text='Condition applied to bucket ID.'
                                           ' Examples: "<3", "=3", ">3".'
                                           ' "3" will be converted to "=3".'
                                           ' Ignored if left blank.',
                                 required=False)


class ManageForm(forms.Form):
    user = forms.ModelChoiceField(queryset=User.objects.all())
    collections = forms.ModelMultipleChoiceField(

        queryset=MetadataCollection.objects.all(),