Skip to content

Commit

Permalink
First view done for #58
Browse files Browse the repository at this point in the history
  • Loading branch information
eronlloyd committed Dec 16, 2022
1 parent 9e237bc commit b28f6e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions democracrm/organizing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,23 @@ class Campaign(CRMBase):
class Meta:
ordering = ['category', '-priority', 'name']

def __str__(self):
return self.name

def priority_label(self):
labels = {
5: 'top',
4: 'high',
3: 'medium',
2: 'low',
1: 'none'
}
return labels[self.priority]

# TODO: Add target goals for each public office for legislation passage

# TODO: Should these methods be in the SupportLevel model?

def target_supporters(self):
return self.supportlevel_set.filter(
Q(campaign_support='Supports') | Q(campaign_support='Strongly Supports'))
Expand Down Expand Up @@ -148,9 +163,6 @@ def target_support_analysis(self):
analysis[target_name] = []
return analysis

def __str__(self):
return self.name


class Chapter(CRMBase):
"""
Expand Down
3 changes: 3 additions & 0 deletions democracrm/organizing/templates/organizing/platform.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ <h5 class="card-title">{{ campaign.name }}</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<a href="#" class="btn btn-primary">Learn More</a>
</div>
<div class="card-header">
Priority: {{ campaign.priority_label | title }}
Status: {{ campaign.status | title }}</div>
</div>
</div>
{% endfor %}
Expand Down

0 comments on commit b28f6e5

Please sign in to comment.