new model for suggestions
@@ -433,3 +433,40 @@ class Contact(models.Model):
def __unicode__(self):
# As with Stream, do not return the partner name here.
return self.full_name
+
+
+
+class Suggest(models.Model):
+
+ class Meta:
+ app_label = 'resources'
+ verbose_name = 'suggestion'
+ verbose_name_plural = 'suggestions'
+ ordering = ['suggested_company_name']
+
+ suggested_company_name = models.CharField(max_length=40,
+ # Translators: In the administrator interface, this text is help text for a field where staff can add partner suggestions.
+ help_text=_("Potential partner's name (e.g. McFarland)."))
+
+ description = models.TextField(blank=True, max_length=1000,
+ # Translators: In the administrator interface, this text is help text for a field where staff can provide a description of a potential partner.
+ help_text=_("Optional description of this potential partner."))
+
+ company_url = models.URLField(blank=True, null=True,
+ # Translators: In the administrator interface, this text is help text for a field where staff can link to a potential partner's website.
+ help_text=_("Link to the potential partner's website."))
+
+ plus_ones = models.ManyToManyField(User,
+ # Translators: In the administrator interface, this text is help text for a field where staff can link multiple users to a suggestion.
+ help_text=_("Users who support this suggestion."))
+
+ def __unicode__(self):
+ return self.suggested_company_name
+
+ def save(self, *args, **kwargs):
+ """Invalidate this suggestions's pandoc-rendered html from cache"""
+ super(Suggest, self).save(*args, **kwargs)
+
+ description_cache_key = make_template_fragment_key(
+ 'suggested_partner_description', [self.pk])
+ cache.delete(description_cache_key)
