Am Sonntag, 2. Juli 2017 12:09:55 UTC+2 schrieb Derek:
There is almost too much information here, but not enough actual details on your errors to help someone help you debug your logic.
Thanks for your answer. But I'm afraid that if I post queryset lines I tryed, it will be more misleading than helpful (my knowledge concerning this is currently too poor, maybe I misunderstood what I found on the internet) :-(
One thing I can suggest is that the admin functionality should look more like:class ExportFunction(admin.ModelAdmin):
...actions = ['export_all_as_yaml', ] # name is a stringdef export_all_as_yaml(self, request, queryset): # nest inside the class...
At least, that is how I use actions. Hope this helps somewhat.
Ok, I did. I also tried:
def export_all_as_yaml(modeladmin, request, queryset):
response = HttpResponse(content_type="application/yaml")
for fac in FactoryName.objects.all():
serializers.serialize("yaml", Export.interior_package.options.objects.filter(FactoryName__name=fac).all(), stream=response)
return response
Result:
'ForwardManyToOneDescriptor' object has no attribute 'options'
[...]
in line
serializers.serialize("yaml", Export.interior_package.options.objects.filter(FactoryName__name=fac).all(), stream=response)
Thanks for any suggestions!
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3b3c19a-ce1b-4f52-8296-2a117b0e7e7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment