<div dir="ltr">Hi,<div>most probably you are hitting the post-save signal on ResourceBase indefinitely.</div><div><br></div><div>You should intercept the signal method and updating the resource base only in the case you are adding the the m2m relationship a new ResourceBase.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno lun 21 ott 2019 alle ore 18:06 Giambattista Mameli <<a href="mailto:mameli.giambattista@gmail.com">mameli.giambattista@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br clear="all"><div>Hi guys,<br>I developed a custom GeoNode Project implementing a M:M relationship on the ResourceBase table<br><br>Here the steps:<br><br>1) model creation of the new table<br><br>class DomainArea(models.Model):<br>    identifier = models.CharField('Domain Area name', max_length=255, unique=True)<br>    description = models.TextField(default='')<br>    gn_description = models.TextField(<br>        'GeoNode description', default='', null=True)<br>    is_choice = models.BooleanField(default=True)<br><br>    def __unicode__(self):<br>        return u"{0}".format(self.gn_description)<br><br>    class Meta:<br>        ordering = ("identifier",)<br>        verbose_name_plural = 'Domain Areas'<br><br>2) add the relation between the ResourceBase table and the new created table<br><br>        domainarea = models.ManyToManyField(<br>            DomainArea,<br>            related_name='resourcebase_domainarea',<br>            blank=True)<br>        ResourceBase.add_to_class('domain_area', domainarea)<br><br>3) Add the function to handle the new value in the admin panel<br><br>  admin.site.register(DomainArea)<br><br>All the steps work good, Django creates the new table with all the relationship and I can handle via admin panel both values and associations between domain areas and Layers/Docs/Maps.<br><br>The problem is when I modify these values.<br><br>After the first association, all the updates go wrong (timeout, even with a very long timeout set).  <br> <br>This is the error message:<br><br>*******<br>Traceback:<br><br>File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner<br>  41.             response = get_response(request)<br><br>File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response<br>  249.             response = self._get_response(request)<br><br>File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response<br>  187.                 response = self.process_exception_by_middleware(e, request)<br><br>File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response<br>  185.                 response = wrapped_callback(request, callback_args, *callback_kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper<br>  552.                 return self.admin_site.admin_view(view)(*args, **kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view<br>  149.                     response = view_func(request, args, *kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func<br>  57.         response = view_func(request, args, *kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner<br>  224.             return view(request, args, *kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in change_view<br>  1512.         return self.changeform_view(request, object_id, form_url, extra_context)<br><br>File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper<br>  67.             return bound_func(*args, **kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view<br>  149.                     response = view_func(request, args, *kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func<br>  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in changeform_view<br>  1409.             return self._changeform_view(request, object_id, form_url, extra_context)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in _changeform_view<br>  1449.                 self.save_model(request, new_object, form, not add)<br><br>File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in save_model<br>  980.         obj.save()<br><br>File "/usr/local/lib/python2.7/site-packages/polymorphic/models.py" in save<br>  83.         return super(PolymorphicModel, self).save(*args, **kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py" in save<br>  808.                        force_update=force_update, update_fields=update_fields)<br><br>File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base<br>  848.                 update_fields=update_fields, raw=raw, using=using,<br><br>File "/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py" in send<br>  193.             for receiver in self._live_receivers(sender)<br><br>File "/usr/local/lib/python2.7/site-packages/geonode/decorators.py" in wrapper<br>  53.                 return func(*args, **kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/geonode/geoserver/signals.py" in geoserver_post_save<br>  85.         producer.geoserver_upload_layer(payload)<br><br>File "/usr/local/lib/python2.7/site-packages/geonode/messaging/producer.py" in sync_if_local_memory<br>  71.                 worker.run(timeout=broker_socket_timeout)<br><br>File "/usr/local/lib/python2.7/site-packages/kombu/mixins.py" in run<br>  170.                     for _ in self.consume(limit=None, **kwargs):<br><br>File "/usr/local/lib/python2.7/site-packages/kombu/mixins.py" in consume<br>  192.                     conn.drain_events(timeout=safety_interval)<br><br>File "/usr/local/lib/python2.7/site-packages/kombu/connection.py" in drain_events<br>  315.         return self.transport.drain_events(self.connection, **kwargs)<br><br>File "/usr/local/lib/python2.7/site-packages/kombu/transport/virtual/base.py" in drain_events<br>  966.                     raise socket.timeout()<br>*****<br><br>Any help will be greatly appreciated<br><br>Thanks in advance<br></div><br><div dir="ltr"><div></div></div></div>
_______________________________________________<br>
geonode-devel mailing list<br>
<a href="mailto:geonode-devel@lists.osgeo.org" target="_blank">geonode-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geonode-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;font-size:11pt;white-space:pre-wrap">==</span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">GeoServer Professional Services from the experts! Visit <a href="http://goo.gl/it488V" target="_blank">http://goo.gl/it488V</a> for more information.</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">==</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Ing. Alessio Fabiani</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">@alfa7691</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Founder/Technical Lead</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">GeoSolutions S.A.S.</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Via di Montramito 3/A - </span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">55054  Massarosa (LU) - </span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Italy</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">phone: +39 0584 962313</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">fax:     +39 0584 1660272</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">mob:   +39 331 6233686</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);background-color:rgb(255,255,255);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">-------------------------------------------------------</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.</span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><br></span></p></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>