<commit_before>from django.conf import settings
from django.db import models
from django.db.models.signals import post_save

from tower import ugettext_lazy as _

from activity.models import broadcast
from users.models import Profile


class Venue(models.Model):
    name = models.CharField(verbose_name=_(u'Name'), max_length=100)
    slug = models.SlugField(verbose_name=_(u'URL Slug'), unique=True,
                            max_length=100)
    address = models.CharField(verbose_name=_(u'Street Address 1'),
                               max_length=150, blank=True)
    address_two = models.CharField(verbose_name=_(u'Street Address 2'),
                                   max_length=150, blank=True)
    city = models.CharField(verbose_name=_(u'City'), max_length=100,
                            blank=True)
    state = models.CharField(verbose_name=_(u'State/Province'), max_length=100,
                                            blank=True)
    zip_code = models.CharField(verbose_name=_(u'Zip/Postal Code'),
                                max_length=15, blank=True)
    country = models.CharField(verbose_name=_(u'Country'), max_length=100,
                               blank=True)

    def __unicode__(self):
        return self.name

    @property
    def full_address(self):
        fields = (self.address, self.address_two, self.city, self.state,
                  self.country, self.zip_code)
        populated = []
        for field in fields:
            if field:
                populated.append(field)
        return u', '.join(populated)


class Event(models.Model):
    name = models.CharField(verbose_name=_(u'Event Name'),
                            max_length=100)
    slug = models.SlugField(verbose_name=_(u'Slug'), unique=True,
                            max_length=100)
    start = models.DateTimeField(verbose_name=_(u'Start Date'))
    end = models.DateTimeField(verbose_name=_(u'End Date'))
    description = models.TextField(verbose_name=_(u'Description'))
    attendees = models.ManyToManyField(Profile, verbose_name=_(u'Attendees'),
                                       blank=True)
    venue = models.ForeignKey(Venue, null=True, default=None)
    featured = models.BooleanField(
        verbose_name=_(u'Featured?'), default=False,
        help_text=_(u'Display this event on the splash page'))
    featured_image = models.ImageField(
        verbose_name=_(u'Featured Image'),
        blank=True, null=True, upload_to=settings.EVENT_IMAGE_PATH,
        help_text=_(u'This image will appear on the splash page if this ' +
                    'is a featured project'))
    created_by = models.ForeignKey('users.Profile', related_name='events',
                                   null=True, default=None)

    @property
    def featured_image_or_default(self):
        return self.featured_image or 'img/featured-default.gif'

    def __unicode__(self):
        return self.name


def event_save_handler(sender, instance, **kwargs):
    """TODO: Support event creation."""
    title = u'An event was changed.'
    broadcast(instance, title)
post_save.connect(event_save_handler, sender=Event)<commit_msg>Remove activities for events (for now)<commit_after>from django.conf import settings
from django.db import models

from tower import ugettext_lazy as _

from users.models import Profile


class Venue(models.Model):
    name = models.CharField(verbose_name=_(u'Name'), max_length=100)
    slug = models.SlugField(verbose_name=_(u'URL Slug'), unique=True,
                            max_length=100)
    address = models.CharField(verbose_name=_(u'Street Address 1'),
                               max_length=150, blank=True)
    address_two = models.CharField(verbose_name=_(u'Street Address 2'),
                                   max_length=150, blank=True)
    city = models.CharField(verbose_name=_(u'City'), max_length=100,
                            blank=True)
    state = models.CharField(verbose_name=_(u'State/Province'), max_length=100,
                                            blank=True)
    zip_code = models.CharField(verbose_name=_(u'Zip/Postal Code'),
                                max_length=15, blank=True)
    country = models.CharField(verbose_name=_(u'Country'), max_length=100,
                               blank=True)

    def __unicode__(self):
        return self.name

    @property
    def full_address(self):
        fields = (self.address, self.address_two, self.city, self.state,
                  self.country, self.zip_code)
        populated = []
        for field in fields:
            if field:
                populated.append(field)
        return u', '.join(populated)


class Event(models.Model):
    name = models.CharField(verbose_name=_(u'Event Name'),
                            max_length=100)
    slug = models.SlugField(verbose_name=_(u'Slug'), unique=True,
                            max_length=100)
    start = models.DateTimeField(verbose_name=_(u'Start Date'))
    end = models.DateTimeField(verbose_name=_(u'End Date'))
    description = models.TextField(verbose_name=_(u'Description'))
    attendees = models.ManyToManyField(Profile, verbose_name=_(u'Attendees'),
                                       blank=True)
    venue = models.ForeignKey(Venue, null=True, default=None)
    featured = models.BooleanField(
        verbose_name=_(u'Featured?'), default=False,
        help_text=_(u'Display this event on the splash page'))
    featured_image = models.ImageField(
        verbose_name=_(u'Featured Image'),
        blank=True, null=True, upload_to=settings.EVENT_IMAGE_PATH,
        help_text=_(u'This image will appear on the splash page if this ' +
                    'is a featured project'))
    created_by = models.ForeignKey('users.Profile', related_name='events',
                                   null=True, default=None)

    @property
    def featured_image_or_default(self):
        return self.featured_image or 'img/featured-default.gif'

    def __unicode__(self):
        return self.name
{'fraction_non_alphanumeric': 0.1041182331451345, 'fraction_numerical': 0.010295582862836267, 'mean_word_length': 2.4515759312320915, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4187292', 'n_tokens_mistral': 1764, 'n_tokens_neox': 1673, 'n_words': 339}