Badger should fail gracefully if auth_groups hasn't been populated
Let's say you've just installed symposion for the first time, and you're running the intial `./manage.py migrate` In that circumstance, there isn't an auth_group table. Naturally this means you get Some Errors when trying to look for a particular group. This change handles that error and drives on.
This commit is contained in:
		
							parent
							
								
									4e183317d0
								
							
						
					
					
						commit
						35b75b6f96
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -25,6 +25,7 @@ import pdb | |||
| from django.core.management.base import BaseCommand | ||||
| 
 | ||||
| from django.contrib.auth.models import User, Group | ||||
| from django.db.utils import OperationalError | ||||
| from pinaxcon.registrasion.models import AttendeeProfile | ||||
| from registrasion.controllers.cart import CartController | ||||
| from registrasion.controllers.invoice import InvoiceController | ||||
|  | @ -124,8 +125,13 @@ def set_colour(soup, slice_id, colour): | |||
|     style = elem.get('style') | ||||
|     elem.set('style', style.replace('fill:#316a9a', 'fill:#%s' % colour)) | ||||
| 
 | ||||
| Volunteers = Group.objects.filter(name='Conference volunteers').first().user_set.all() | ||||
| Organisers = Group.objects.filter(name='Conference organisers').first().user_set.all() | ||||
| ## It's possible that this script will be run before the database has been populated | ||||
| try: | ||||
|     Volunteers = Group.objects.filter(name='Conference volunteers').first().user_set.all() | ||||
|     Organisers = Group.objects.filter(name='Conference organisers').first().user_set.all() | ||||
| except (OperationalError, AttributeError): | ||||
|     Volunteers = [] | ||||
|     Organisers = [] | ||||
| 
 | ||||
| def is_volunteer(attendee): | ||||
|     ''' | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley