Merge branch 'fresh-start' into cms-features
Conflicts: symposion_project/settings.py
This commit is contained in:
		
						commit
						4ebfc6d2ba
					
				
					 2 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,9 @@ from django.db import models
 | 
			
		|||
from timezones.fields import TimeZoneField
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONFERENCE_CACHE = {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Conference(models.Model):
 | 
			
		||||
    """
 | 
			
		||||
    the full conference for a specific year, e.g. US PyCon 2012.
 | 
			
		||||
| 
						 | 
				
			
			@ -19,6 +22,19 @@ class Conference(models.Model):
 | 
			
		|||
    
 | 
			
		||||
    def __unicode__(self):
 | 
			
		||||
        return self.title
 | 
			
		||||
    
 | 
			
		||||
    def save(self, *args, **kwargs):
 | 
			
		||||
        super(Conference, self).save(*args, **kwargs)
 | 
			
		||||
        if self.id in CONFERENCE_CACHE:
 | 
			
		||||
            del CONFERENCE_CACHE[self.id]
 | 
			
		||||
    
 | 
			
		||||
    def delete(self):
 | 
			
		||||
        pk = self.pk
 | 
			
		||||
        super(Conference, self).delete()
 | 
			
		||||
        try:
 | 
			
		||||
            del CONFERENCE_CACHE[pk]
 | 
			
		||||
        except KeyError:
 | 
			
		||||
            pass
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Section(models.Model):
 | 
			
		||||
| 
						 | 
				
			
			@ -38,3 +54,18 @@ class Section(models.Model):
 | 
			
		|||
    
 | 
			
		||||
    def __unicode__(self):
 | 
			
		||||
        return self.name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def current_conference():
 | 
			
		||||
    from django.conf import settings
 | 
			
		||||
    try:
 | 
			
		||||
        conf_id = settings.CONFERENCE_ID
 | 
			
		||||
    except AttributeError:
 | 
			
		||||
        from django.core.exceptions import ImproperlyConfigured
 | 
			
		||||
        raise ImproperlyConfigured("You must set the CONFERENCE_ID setting.")
 | 
			
		||||
    try:
 | 
			
		||||
        current_conf = CONFERENCE_CACHE[conf_id]
 | 
			
		||||
    except KeyError:
 | 
			
		||||
        current_conf = Conference.objects.get(pk=conf_id)
 | 
			
		||||
        CONFERENCE_CACHE[conf_id] = current_conf
 | 
			
		||||
    return current_conf
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -207,6 +207,7 @@ DEBUG_TOOLBAR_CONFIG = {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
MARKITUP_FILTER = ("markdown.markdown", {"safe_mode": True})
 | 
			
		||||
CONFERENCE_ID = 1
 | 
			
		||||
 | 
			
		||||
# local_settings.py can be used to override environment-specific settings
 | 
			
		||||
# like database and email that differ between development and production.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue