Hi, I store some data like email text, headers and from email address in encoded format in the database. I want to have a page where I can display all this information in readonly format.
What is the ideal place & way to decode this information and pass it to django UI. I was thinking of reading all the information in my views.py. But then I don't want to affect my DB. aka information in DB should remain encoded. eg. class FooViewSet(viewsets.ModelViewSet): queryset = Message.objects.all() Message object has headers, body and from fields which are encoded before storing in db. If I perform any operation on queryset those changes will be reflected in DB so I cannot do that. If I do something like below then I get exception for using list as queryset becomes a list object instead of queryset object. class FooViewSet(viewsets.ModelViewSet): queryset = list(Message.objects.all()) for obj in queryset: body = base64.b64decode(obj.body) obj.body = body --089e01183b7099cbb7052b01766b-- Traceback (most recent call last): File "sztp/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application django.setup() File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/apps.py", line 15, in ready dt_settings.patch_all() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 232, in patch_all patch_root_urlconf() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 220, in patch_root_urlconf reverse('djdt:render_panel') File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 550, in reverse app_list = resolver.app_dict[ns] File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 352, in app_dict self._populate() File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 285, in _populate for pattern in reversed(self.url_patterns): File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 402, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 396, in urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "./sztp/urls.py", line 52, in <module> url(r'^orca/', include('orca.urls.urls')), File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 33, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "./orca/urls/urls.py", line 26, in <module> router.register(r'notification', views.NotificationViewSet) File "/usr/local/lib/python2.7/dist-packages/rest_framework/routers.py", line 61, in register base_name = self.get_default_base_name(viewset) File "/usr/local/lib/python2.7/dist-packages/rest_framework/routers.py", line 140, in get_default_base_name return queryset.model._meta.object_name.lower() AttributeError: 'list' object has no attribute 'model' -- 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 https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce9b3654-6c73-4582-aae6-104d4145b466%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.