from django.db import models
from django.contrib.auth.models import User
+from pgweb.core.models import Organisation
from pgweb.util.bases import PgModel
class ProfessionalService(models.Model):
submitter = models.ForeignKey(User, null=False, blank=False)
approved = models.BooleanField(null=False, blank=False, default=False)
- name = models.CharField(max_length=100, null=False, blank=False)
+ organisation = models.ForeignKey(Organisation, null=False, blank=False)
description = models.TextField(null=False,blank=False)
employees = models.CharField(max_length=32, null=True, blank=True)
locations = models.CharField(max_length=128, null=True, blank=True)
languages = models.CharField(max_length=128, null=True, blank=True)
customerexample = models.TextField(blank=True, null=True)
experience = models.TextField(blank=True, null=True)
- contact = models.CharField(max_length=128, null=True, blank=True)
+ contact = models.TextField(null=True, blank=True)
url = models.URLField(max_length=128, null=True, blank=True)
provides_support = models.BooleanField(null=False, default=False)
provides_hosting = models.BooleanField(null=False, default=False)
- interfaces = models.CharField(max_length=128, null=True, blank=True)
+ interfaces = models.CharField(max_length=512, null=True, blank=True)
send_notification = True
def __unicode__(self):
- return self.name
+ return self.organisation.name
class Meta:
- ordering = ('name',)
+ ordering = ('organisation__name',)
# DB model is a bit funky here, so use the extra-where functionality to filter properly.
# Field names are cleaned up earlier, so it's safe against injections.
- services = ProfessionalService.objects.filter(approved=True).extra(where=["region_%s AND provides_%s" % (regionname, what),])
+ services = ProfessionalService.objects.select_related('organisation').filter(approved=True).extra(where=["region_%s AND provides_%s" % (regionname, what),])
return render_to_response('profserv/list.html', {
'title': title,