def setUp(self): try: register(User) except AlreadyRegistered: pass self.obj = User.objects.create(username="******") self.point = Point(5, 5) self.poly = Polygon(((0, 0), (0, 10), (10, 10), (0, 10), (0, 0)), ((4, 4), (4, 6), (6, 6), (6, 4), (4, 4)))
def setUp(self): try: register(User) except AlreadyRegistered: pass self.obj = User.objects.create(username='******') self.point = Point(5, 5) self.poly = Polygon(((0, 0), (0, 10), (10, 10), (0, 10), (0, 0)), ((4, 4), (4, 6), (6, 6), (6, 4), (4, 4)))
if self.created_at == None: self.created_at = datetime.now() self.updated_at = datetime.now() super(Media, self).save() def _set_tags(self, tags): Tag.objects.update_tags(self, tags) def _get_tags(self): return Tag.objects.get_for_object(self) def _get_geotag(self): return Geotag.objects.get_for_object(self) def _remove_geotag(self): geotag_obj = Geotag.objects.get_for_object(self) if geotag_obj is not None: geotag_obj.delete() def get_authors(self): return Profile.objects.filter(user__in=self.authors.values_list('id',flat=True)).distinct().order_by('last_name') media_authors = property(get_authors) def get_parent_model(self): """ Helper method for inheritance """ return Media geotagging.register(Media)