form for slot scheduling
This commit is contained in:
		
							parent
							
								
									fe29c708b9
								
							
						
					
					
						commit
						6d2cc584cf
					
				
					 1 changed files with 24 additions and 0 deletions
				
			
		
							
								
								
									
										24
									
								
								symposion/schedule/forms.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								symposion/schedule/forms.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| from django import forms | ||||
| 
 | ||||
| from symposion.schedule.models import Slot, Presentation | ||||
| 
 | ||||
| 
 | ||||
| class SlotEditForm(forms.Form): | ||||
|      | ||||
|     presentation = forms.ModelChoiceField( | ||||
|         queryset=Presentation.objects.filter(slot__isnull=True), | ||||
|         required=True, | ||||
|     ) | ||||
|     slot_pk = forms.CharField( | ||||
|         max_length=10, | ||||
|         widget=forms.HiddenInput, | ||||
|         required=True, | ||||
|     ) | ||||
|      | ||||
|     def clean_slot_pk(self): | ||||
|         value = self.cleaned_data["slot_pk"] | ||||
|         try: | ||||
|             Slot.objects.get(pk=value) | ||||
|         except Slot.DoesNotExist: | ||||
|             raise forms.ValidationError("Invalid slot.") | ||||
|         return value | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Luke Hatcher
						Luke Hatcher