Example #1
0
    def save(self, force_insert=False, force_update=False):
        """
    Create the slug, then save the Brewery and a Geo item.
    """
        from django.template.defaultfilters import slugify

        if not self.slug:
            self.slug = get_unique_slug_value(Brewery, slugify(self.name))
        self._update_rating()
        super(Brewery, self).save(force_insert=force_insert, force_update=force_update)
        if self.city.location():
            GeolocatedItem.objects.create_or_update(
                self, location=(self.city.location().latitude, self.city.location().longitude), city=self.city
            )
Example #2
0
    def save(self, force_insert=False, force_update=False):
        """
    Calculate the ABV and ABW if possible, create the slug, update some counts, then save the beer.
    """
        from django.template.defaultfilters import slugify

        if not self.slug:
            self.slug = get_unique_slug_value(Beer, slugify(self.name))
        self._calculate_alcohol()
        self._calculate_interestingness()
        self._update_rating()
        self._update_rating_by_men()
        self._update_rating_by_women()
        self._update_rating_by_staff()
        self._update_preferred_vessel()
        super(Beer, self).save(force_insert=force_insert, force_update=force_update)