from django.contrib.gis.db import models from django.contrib.auth.models import User from django_countries.fields import CountryField class CaseStudy(models.Model): """Model for case studies submitted to the Ojuso Platform""" # Choice lists for dropdowns SUPPLY_CHAIN_CHOICES = ( ('A', 'Option A'), ('B', 'Option B'), ) GENERATION_TYPE_CHOICES = ( ('W', 'Wind'), ('S', 'Solar'), ) # User who submitted case study author = models.ForeignKey( User, models.SET_NULL, blank=True, null=True, editable=False ) # Location of map pin geom = models.PointField() project_name = models.CharField(max_length=128) supply_chain = models.CharField( max_length=1, choices=SUPPLY_CHAIN_CHOICES ) generation_type = models.CharField( max_length=1, choices=GENERATION_TYPE_CHOICES ) associated_companies = models.CharField(max_length=128) financiers = models.CharField(max_length=128) important_lenders = models.CharField(max_length=128) country = CountryField() affects_indigenous = models.BooleanField() affects_indigenous_reason = models.TextField() proposed_start = models.DateField() proposed_completion = models.DateField() description = models.TextField() link_to_forum = models.URLField() image = models.ImageField() references = models.TextField() commodities = models.CharField(max_length=128) like_to_engage_developer = models.BooleanField() like_to_engage_investors = models.BooleanField() def __str__(self): return "%s in %s" % (self.project_name, self.country.name)