GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.45k stars 1.13k forks source link

error with Managers #2998

Closed roshanar closed 7 years ago

roshanar commented 7 years ago

Hi Im using geonode with django_jalali library. in django_jalali calendar we should use objects = jmodels.jmanager for changing date field and datetime field into jalali calnedar,like this:

csw_insert_date = jmodels.jDateTimeField(_('CSW insert date'), auto_now_add=True, null=True)

this code conflict with ResourseBase,Upload and Attribute codes classes of geonode. Resoursebaase class: objects = ResourceBaseManager() Upload: objects = UploadManager() Attribute: objects = AttributeManager()

when I want upload layer this error occur:

'datetime' object has no attribute 'find' Traceback (most recent call last): File "/home/geonode/geonode/geonode/layers/views.py", line 171, in layer_upload metadata_upload_form=form.cleaned_data["metadata_upload_form"] File "/home/geonode/geonode/geonode/layers/utils.py", line 503, in file_upload defaults=defaults File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/modeltranslation/manager.py", line 389, in get_or_create return super(MultilingualQuerySet, self).get_or_create(**kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 407, in get_or_create return self._create_object_from_params(lookup, params) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 439, in _create_object_from_params obj = self.create(**params) File "/usr/local/lib/python2.7/dist-packages/modeltranslation/manager.py", line 381, in create return super(MultilingualQuerySet, self).create(**kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 348, in create obj.save(force_insert=True, using=self.db) File "/usr/local/lib/python2.7/dist-packages/polymorphic/models.py", line 90, in save return super(PolymorphicModel, self).save(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 734, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 771, in save_base update_fields=update_fields, raw=raw, using=using) File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 189, in send response = receiver(signal=self, sender=sender, **named) File "/home/geonode/geonode/geonode/catalogue/models.py", line 56, in catalogue_post_save record = catalogue.get_record(instance.uuid) File "/home/geonode/geonode/geonode/catalogue/backends/pycsw_local.py", line 72, in get_record results = self._csw_local_dispatch(identifier=uuid) File "/home/geonode/geonode/geonode/catalogue/backends/pycsw_local.py", line 171, in _csw_local_dispatch response = csw.dispatch() File "/usr/local/lib/python2.7/dist-packages/pycsw/server.py", line 599, in dispatch self.response = self.iface.getrecordbyid() File "/usr/local/lib/python2.7/dist-packages/pycsw/ogc/csw/csw2.py", line 1082, in getrecordbyid self.parent.kvp['outputschema'], self.parent.repository.queryables['_all'])) File "/usr/local/lib/python2.7/dist-packages/pycsw/plugins/profiles/apiso/apiso.py", line 501, in write_record if val and val.find('T') != -1: AttributeError: 'datetime' object has no attribute 'find'

how can I handle this error!? thanks for your help!

simod commented 7 years ago

hi seems pycsw is involved in this @tomkralidis . Maybe that date format is not supported.

Pls @roshanar use the mailing list geonode-users@lists.osgeo.org to ask for support.