Thanks Liam Il giorno giovedì 3 aprile 2014 19:05:28 UTC+2, Liam Thompson ha scritto: > > Hi Alex > > Let me have another look through your code and I'll try to come up with > something useful. > > Liam > > > > > On 03/04/2014 18:20, Alessandro Caruso wrote: > > I got the traceback (thanks to a middleware which collects it and a send > > it back to the ajax request even if DEBUG=False) > > > > Environment: > > > > > > Request Method: POST > > Request URL: http://server:8080/assets/edit/videoconference/30 > > > > Django Version: 1.4.5 > > Python Version: 2.7.3 > > Installed Applications: > > ('django.contrib.auth', > > 'django.contrib.contenttypes', > > 'django.contrib.sessions', > > 'django.contrib.sites', > > 'django.contrib.messages', > > 'django.contrib.staticfiles', > > 'django.contrib.admin', > > 'django.contrib.admindocs', > > 'south', > > 'beeusers', > > 'beeactions', > > 'assets', > > 'reservations', > > 'ldapusers', > > 'tickets', > > 'videoconferences') > > Installed Middleware: > > ('django.middleware.common.CommonMiddleware', > > 'django.contrib.sessions.middleware.SessionMiddleware', > > 'django.middleware.csrf.CsrfViewMiddleware', > > 'django.contrib.auth.middleware.AuthenticationMiddleware', > > 'django.contrib.messages.middleware.MessageMiddleware', > > 'assets.middleware.ExceptionMiddleware') > > > > > > Traceback: > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/core/handlers/base.py" > > > > in get_response > > 111. response = callback(request, > > *callback_args, **callback_kwargs) > > File "/home/srvadmin/prenota_dev/assets/views.py" in asset_edit > > 107. form = VideoconferenceForm(instance=obj) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/forms/models.py" > > > > in __init__ > > 238. object_data = model_to_dict(instance, opts.fields, > > opts.exclude) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/forms/models.py" > > > > in model_to_dict > > 128. data[f.name] = [obj.pk for obj in > > f.value_from_object(instance)] > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/fields/related.py" > > > > in value_from_object > > 1272. return getattr(obj, self.attname).all() > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/manager.py" > > > > in all > > 116. return self.get_query_set() > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/fields/related.py" > > > > in get_query_set > > 567. return super(ManyRelatedManager, > > > self).get_query_set().using(db)._next_is_sticky().filter(**self.core_filters) > > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/query.py" > > > > in filter > > 624. return self._filter_or_exclude(False, *args, **kwargs) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/query.py" > > > > in _filter_or_exclude > > 642. clone.query.add_q(Q(*args, **kwargs)) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/sql/query.py" > > > > in add_q > > 1250. can_reuse=used_aliases, > > force_having=force_having) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/sql/query.py" > > > > in add_filter > > 1122. process_extras=process_extras) > > File > > > "/home/srvadmin/.virtualenvs/prenota_dev/lib/python2.7/site-packages/django/db/models/sql/query.py" > > > > in setup_joins > > 1316. "Choices are: %s" % (name, ", > > ".join(names))) > > > > Exception Type: FieldError at /assets/edit/videoconference/30 > > Exception Value: Cannot resolve keyword 'viewed_videoconferences' into > > field. Choices are: action, beeuser, date_joined, email, first_name, > > groups, id, is_active, is_staff, is_superuser, last_login, last_name, > > logentry, managed_assets, password, reservation, ticket, > > user_permissions, username > > > > > > The only differences from the original code are the two related_names > > (managed_assets for managers and viewed_videoconferences for viewers). > > > > It seems to me that Django is trying to save a User object throwing an > > error because it can't find a viewed_videoconferences field in the User > > model (obviously) > > > > > > Il giorno mercoledì 2 aprile 2014 18:30:11 UTC+2, Liam Thompson ha > scritto: > > > > Hi Alex > > > > You might try that command, it's quick through the shell. > > > > I suppose there are many ways to do forms, but I've populated my > > modelforms through an __init__ to make sure its loaded fresh for > every > > form requested, not just on the loading of the server. So object > versus > > class if that makes sense. > > > > Does it make a difference in your case ? I don't know, I'm still new > at > > this so making some suggestions. > > > > Liam > > > > > > > > > > -- > > You received this message because you are subscribed to a topic in the > > Google Groups "Django users" group. > > To unsubscribe from this topic, visit > > https://groups.google.com/d/topic/django-users/DL1EHxT_5EQ/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > > django-users...@googlegroups.com <javascript:> > > <mailto:django-users+unsubscr...@googlegroups.com <javascript:>>. > > To post to this group, send email to > > django...@googlegroups.com<javascript:> > > <mailto:django...@googlegroups.com <javascript:>>. > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/add83ad6-c092-47f2-9ef4-2957760b4cda%40googlegroups.com > > > < > https://groups.google.com/d/msgid/django-users/add83ad6-c092-47f2-9ef4-2957760b4cda%40googlegroups.com?utm_medium=email&utm_source=footer>. > > > > For more options, visit https://groups.google.com/d/optout. >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/42911649-b742-4042-9537-1594792c3ce3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.