Exemple #1
0
class Location(Item):
    slug = AutoSlugField(populate_from='name', unique=True)
    name = models.CharField(max_length=120)
    point = PointField()

    def get_absolute_url(self):
        return '/location/%s/' % self.pk
Exemple #2
0
class ProjectLocationMixin(models.Model):
    class Meta:
        abstract = True

    point = PointField(
        null=True,
        blank=True,
        verbose_name=_('Can your project be located on the map?'),
        help_text=_('Locate your project. '
                    'Click inside the marked area '
                    'or type in an address to set the marker. A set '
                    'marker can be dragged when pressed.'))

    administrative_district = models.ForeignKey(
        AdministrativeDistrict,
        on_delete=models.CASCADE,
        null=True,
        blank=True,
        verbose_name=_('Administrative district'))