from django.db import models

# Create your models here.

@@ -9,49 +9,1752 @@
 ngo.
-db import models%0A%0A# Create your models here.
+contrib.auth.models import User%0Afrom django.conf import settings%0Afrom django.core.validators import RegexValidator%0Afrom django.db import models%0Afrom django.db.models.signals import pre_save%0Afrom django.dispatch import receiver%0Afrom django.template.defaultfilters import slugify%0A%0Aimport bleach%0Aimport markdown%0A%0Aname_validator = RegexValidator(%0A    regex=r%22%5B%5Cw-%5C.:%5Cs%5D+%22,%0A    message=%22Names can contain letters, numbers, dashes,%22 +%5C%0A    %22periods, colons, and whitespace.%22%0A)%0A%0Aclass Team(models.Model):%0A%0A    class Meta:%0A        ordering = %5B'name'%5D%0A        get_latest_by = %22created%22%0A%0A    slug = models.SlugField(primary_key=True)%0A%0A    name = models.CharField(max_length=50, validator=name_validator,%0A                            help_text=%22Your team's project name!%22)%0A    description = models.TextField(blank=True,%0A                                   help_text=%22Tell us about your project! Or don't. It's up to you!%22)%0A    rendered_description = models.TextField(editable=False)%0A%0A    members = models.ManyToManyField(User)%0A%0A    created = models.DateTimeField(auto_now_add=True)%0A%0A    @models.permalink%0A    def get_absolute_url(self):%0A        kwds = %7B'slug': self.slug%7D%0A        return ('team_detail', (), kwds)%0A%0A%0A@receiver(pre_save, sender=Team)%0Adef team_pre_save(sender, instance, **kwargs):%0A    %22%22%22Called before a Team is saved%0A    - Sets slug according to name%0A    - Renders description field%0A    %22%22%22%0A    instance.slug = slugify(instance.name)%0A%0A    rendered = markdown.markdown(instance.description, safe_mode='escape')%0A    clean_rendered = bleach.clean(rendered,%0A                                  tags=settings.ALLOWED_HTML_TAGS,%0A                                  attributes=settings.ALLOWED_HTML_ATTRS)%0A    instance.rendered_description = clean_rendered
 %0A

Add inital team model