ojuso-map/apps/map/models.py

57 lines
1.7 KiB
Python
Raw Normal View History

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
)
2017-06-16 16:06:22 +00:00
project_name = models.CharField(max_length=128)
# Location of map pin
2017-05-22 23:12:04 +00:00
location = models.PointField()
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)