# Path: browser/models.py
# class SearchSet(models.Model):
# 	user_id = models.CharField(max_length=200)
# 	job_name = models.CharField(max_length=200)
# 	job_id = models.CharField(max_length=200)
# 	job_start = models.CharField(max_length=30)
# 	job_status = models.CharField(max_length=20)
# 	job_progress = models.IntegerField()
# 	ss_file = models.FileField(upload_to='/var/django/melodi/abstracts')
# 	ss_desc = models.CharField(max_length=5000)
# 	pTotal = models.IntegerField()
# 
# 	class Meta:
# 		unique_together = ('user_id', 'job_name',),
# 
# 	#def __str__(self):
# 	#	return "User: " + self.user_id


from django import forms
from .models import SearchSet
from django.forms import ModelForm, Textarea, HiddenInput
)

class ComSearchSets(forms.Form): #Note that it is not inheriting from forms.ModelForm
	a = forms.CharField(max_length=200,widget=forms.HiddenInput(),required=False,error_messages={'required': 'Error - Please ensure you have created at least two article sets and then select two from the table below'})
	#change required to False if want to permit analysis on one article set
	b = forms.CharField(max_length=200,widget=forms.HiddenInput(),required=True,error_messages={'required': 'Error - Please ensure you have created at least two article sets and then select two from the table below'})
	comType = forms.MultipleChoiceField(required=True,widget=forms.CheckboxSelectMultiple(attrs={'checked' : 'checked'}), choices=COMTYPES, error_messages={'required': 'Please select at least one search option'})

class CreateSearchSet(forms.ModelForm):
	class Meta:
		model = SearchSet
		fields = ['job_name','user_id','ss_file','ss_desc']
		widgets = {
			'job_name': Textarea(attrs={'cols': 25, 'rows': 1, 'placeholder':'e.g. bmi_medline'}),
            'ss_desc': Textarea(attrs={'cols': 45, 'rows': 1,'placeholder':'e.g. BMI Pubmed search'}),
			'user_id': HiddenInput()
        }

class CreateSemSet(forms.ModelForm):
	class Meta:
		model = SearchSet
		fields = ['job_name','ss_desc','user_id']
		widgets = {
			'job_name': Textarea(attrs={'cols': 25, 'rows': 1, 'placeholder':'e.g. bmi_semmed'}),
            'ss_desc': Textarea(attrs={'cols': 35, 'rows': 1, 'class': 'ui-widget','id':'tags','placeholder':'e.g. body mass index'}),
			'user_id': HiddenInput()
        }

class CreatePubSet(forms.ModelForm):
	class Meta:

# Path: browser/models.py
# class SearchSet(models.Model):
# 	user_id = models.CharField(max_length=200)
# 	job_name = models.CharField(max_length=200)
# 	job_id = models.CharField(max_length=200)
# 	job_start = models.CharField(max_length=30)
# 	job_status = models.CharField(max_length=20)
# 	job_progress = models.IntegerField()
# 	ss_file = models.FileField(upload_to='/var/django/melodi/abstracts')
# 	ss_desc = models.CharField(max_length=5000)
# 	pTotal = models.IntegerField()
# 
# 	class Meta:
# 		unique_together = ('user_id', 'job_name',),
# 
# 	#def __str__(self):
# 	#	return "User: " + self.user_id


# Path: browser/forms.py
from django import forms
from .models import SearchSet
from django.forms import ModelForm, Textarea, HiddenInput

)

class ComSearchSets(forms.Form): #Note that it is not inheriting from forms.ModelForm
	a = forms.CharField(max_length=200,widget=forms.HiddenInput(),required=False,error_messages={'required': 'Error - Please ensure you have created at least two article sets and then select two from the table below'})
	#change required to False if want to permit analysis on one article set
	b = forms.CharField(max_length=200,widget=forms.HiddenInput(),required=True,error_messages={'required': 'Error - Please ensure you have created at least two article sets and then select two from the table below'})
	comType = forms.MultipleChoiceField(required=True,widget=forms.CheckboxSelectMultiple(attrs={'checked' : 'checked'}), choices=COMTYPES, error_messages={'required': 'Please select at least one search option'})

class CreateSearchSet(forms.ModelForm):
	class Meta:
		model = SearchSet
		fields = ['job_name','user_id','ss_file','ss_desc']
		widgets = {
			'job_name': Textarea(attrs={'cols': 25, 'rows': 1, 'placeholder':'e.g. bmi_medline'}),
            'ss_desc': Textarea(attrs={'cols': 45, 'rows': 1,'placeholder':'e.g. BMI Pubmed search'}),
			'user_id': HiddenInput()
        }

class CreateSemSet(forms.ModelForm):
	class Meta:
		model = SearchSet
		fields = ['job_name','ss_desc','user_id']
		widgets = {
			'job_name': Textarea(attrs={'cols': 25, 'rows': 1, 'placeholder':'e.g. bmi_semmed'}),
            'ss_desc': Textarea(attrs={'cols': 35, 'rows': 1, 'class': 'ui-widget','id':'tags','placeholder':'e.g. body mass index'}),
			'user_id': HiddenInput()
        }

class CreatePubSet(forms.ModelForm):
	class Meta:

		model = SearchSet