admin: fix source creation view
This commit is contained in:
		
							
								
								
									
										0
									
								
								passbook/admin/forms/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								passbook/admin/forms/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										6
									
								
								passbook/admin/forms/source.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								passbook/admin/forms/source.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| """passbook core source form fields""" | ||||
| # from django import forms | ||||
|  | ||||
| SOURCE_FORM_FIELDS = ['name', 'slug', 'enabled'] | ||||
|  | ||||
| # class SourceForm(forms.Form) | ||||
| @ -31,7 +31,7 @@ class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): | ||||
|  | ||||
|     def get_form_class(self): | ||||
|         source_type = self.request.GET.get('type') | ||||
|         model = next(x if x.__name__ == source_type else None for x in Source.__subclasses__()) | ||||
|         model = next(x for x in Source.__subclasses__() if x.__name__ == source_type) | ||||
|         if not model: | ||||
|             raise Http404 | ||||
|         return path_to_class(model.form) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer