This one's a tricky one, and I hope someone has some ideas:
I'm trying to rig up a 'metadata changed' event. I got it to work!
...At least, everything except for accessing via the API(directly via the
app works).
The problem is that I can't figure out how to get access to the current
user within the scope of class DocumentMetadata, function Save(). (this is
in apps/metadata/models.py)
Here's my traceback:
(...)
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/mayan/apps/metadata/api_views.py",
line 206, in put
return super(APIDocumentMetadataView,
self).put(user=self.request.user,*args,**kwargs)
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/rest_framework/generics.py",
line 289, in put
return self.update(request, *args, **kwargs)
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/rest_framework/mixins.py",
line 70, in update
self.perform_update(serializer)
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/rest_framework/mixins.py",
line 74, in perform_update
serializer.save()
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/rest_framework/serializers.py",
line 186, in save
self.instance = self.update(self.instance, validated_data)
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/rest_framework/serializers.py",
line 880, in update
instance.save()
File
"/Data/Projects/mayan/local/lib/python2.7/site-packages/mayan/apps/metadata/models.py",
line 181, in save
traceback.print_stack(file=sys.stdout)
I can access request.user on line 206 in api_views.py, but then it goes
through several calls in the rest_framework library.
I just can't figure out how to pass that variable through to where I need
it, in models.py, not without modifying the rest_framework library(which
would mean having to keep a special copy of this around).
Any thoughts?
-Rob
--
---
You received this message because you are subscribed to the Google Groups
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.