Ejemplo n.º 1
0
 def save(self, *args, **kwargs):
     if not self.geocode:
         geocode = get_geocode(self.city, self.state, self.address, self.zipcode)
         if geocode:
             self.geocode = ', '.join(geocode)
     self.info_formatted = sanetize_text(self.info)
     if self.recap:
         self.recap_formatted = sanetize_text(self.recap)
     if not self.end_date:
         self.end_date = self.start_date
     super(Event, self).save(*args, **kwargs)
Ejemplo n.º 2
0
 def save(self, *args, **kwargs):
     if not self.geocode:
         geocode = get_geocode(self.city, self.state, self.address,
                               self.zipcode)
         if geocode:
             self.geocode = ', '.join(geocode)
     self.info_formatted = sanetize_text(self.info)
     if self.recap:
         self.recap_formatted = sanetize_text(self.recap)
     if not self.end_date:
         self.end_date = self.start_date
     super(Event, self).save(*args, **kwargs)
Ejemplo n.º 3
0
 def save(self, *args, **kwargs):
     if not self.has_image:
         # most models will have get_image. video falls back to thumb_url
         if self.get_image() or hasattr(self, 'thumb_url'):
             self.has_image = True
     self.summary_formatted = sanetize_text(self.summary)
     super(BaseContentModel, self).save(*args, **kwargs)
Ejemplo n.º 4
0
    def save(self, *args, **kwargs):
        needs_geocode = False
        if self.id is None:  # For new user, only set a few things:
            self.display_name = self.get_display_name()
            needs_geocode = True
        else:
            old_self = self.__class__.objects.get(id=self.id)
            if old_self.city != self.city or old_self.state != self.state or self.geocode is None:
                needs_geocode = True
            if old_self.display_name != self.display_name or old_self.first_name != self.first_name or old_self.last_name != self.last_name:
                self.display_name = self.get_display_name(
                )  # check if display name has changed
            if old_self.avatar and old_self.avatar != self.avatar:
                os.remove(old_self.avatar.path)
        if self.city and self.state and needs_geocode:
            geocode = get_geocode(self.city,
                                  self.state,
                                  street_address=self.street_address,
                                  zipcode=self.zip)
            if geocode and geocode != '620':
                self.geocode = ', '.join(geocode)
        if self.signature:
            self.signature = strip_tags(self.signature)
        if self.bio:
            self.bio_formatted = sanetize_text(self.bio)

        super(Profile, self).save(*args, **kwargs)
Ejemplo n.º 5
0
 def save(self, *args, **kwargs):
     """
     Store summary if none was given
     and created formatted version of body text.
     """
     if not self.summary:
         self.summary = truncatewords(self.body, 50)
     self.body_formatted = sanetize_text(self.body)
     super(Article, self).save()
Ejemplo n.º 6
0
 def save(self, *args, **kwargs):
     """
     Store summary if none was given
     and created formatted version of body text.
     """
     if not self.summary:
         self.summary = truncatewords(self.body, 50)
     self.body_formatted = sanetize_text(self.body)
     super(Article, self).save()
Ejemplo n.º 7
0
    def save(self, *args, **kwargs):
        needs_geocode = False
        if self.id is None:  # For new user, only set a few things:
            self.display_name = self.get_display_name()
            needs_geocode = True
        else:
            old_self = self.__class__.objects.get(id = self.id)
            if old_self.city != self.city or old_self.state != self.state or self.geocode is None:
                needs_geocode = True
            if old_self.display_name != self.display_name or old_self.first_name != self.first_name or old_self.last_name != self.last_name:
                self.display_name = self.get_display_name()  # check if display name has changed
            if old_self.avatar and old_self.avatar != self.avatar:
                os.remove(old_self.avatar.path)
        if self.city and self.state and needs_geocode:
            geocode = get_geocode(self.city, self.state, street_address=self.street_address, zipcode=self.zip)
            if geocode and geocode != '620':
                self.geocode = ', '.join(geocode)
        if self.signature:
            self.signature = strip_tags(self.signature)
        if self.bio:
            self.bio_formatted = sanetize_text(self.bio)

        super(Profile, self).save(*args, **kwargs)
Ejemplo n.º 8
0
 def save(self, *args, **kwargs):
     self.text_formatted = sanetize_text(self.text)
     super(BaseSidebarContentModel, self).save(*args, **kwargs)
Ejemplo n.º 9
0
 def save(self, *args, **kwargs):
     """
     Create formatted version of body text.
     """
     self.body_formatted = sanetize_text(self.body)
     super(Contact, self).save()
Ejemplo n.º 10
0
 def save(self, *args, **kwargs):
     self.text_formatted = sanetize_text(self.text)
     super(Memory, self).save(*args, **kwargs)
Ejemplo n.º 11
0
 def save(self, *args, **kwargs):
     self.update_formatted = sanetize_text(self.update)
     super(Update, self).save(*args, **kwargs)
Ejemplo n.º 12
0
 def save(self, *args, **kwargs):
     self.text_formatted = sanetize_text(self.text)
     super(Memory, self).save(*args, **kwargs)
Ejemplo n.º 13
0
 def save(self, *args, **kwargs):
     self.update_formatted = sanetize_text(self.update)
     super(Update, self).save(*args, **kwargs)
Ejemplo n.º 14
0
 def save(self, *args, **kwargs):
     """
     Create formatted version of body text.
     """
     self.body_formatted = sanetize_text(self.body)
     super(Contact, self).save()