Python django.views.generic.edit.View() Examples
The following are 2
code examples of django.views.generic.edit.View().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.views.generic.edit
, or try the search function
.
Example #1
Source File: views.py From pyas2 with GNU General Public License v2.0 | 5 votes |
def resend_message(request, pk, *args, **kwargs): """ Function for resending an outbound message from the Message List View""" # Get the message to be resent orig_message = models.Message.objects.get(message_id=pk) # Setup the python and django path python_executable_path = pyas2init.gsettings['python_path'] managepy_path = pyas2init.gsettings['managepy_path'] # Copy the message payload to a temporary location temp = tempfile.NamedTemporaryFile(suffix='_%s' % orig_message.payload.name, delete=False) with open(orig_message.payload.file, 'rb+') as source: temp.write(source.read()) # execute the django admin command "sendas2message" to transfer the file to partner lijst = [ python_executable_path, managepy_path, 'sendas2message', orig_message.organization.as2_name, orig_message.partner.as2_name, temp.name ] pyas2init.logger.info(_(u'Re-send message started with parameters: "%(parameters)s"'), {'parameters': str(lijst)}) try: subprocess.Popen(lijst).pid except Exception as msg: notification = _(u'Errors while trying to re-send message: "%s".') % msg messages.add_message(request, messages.INFO, notification) pyas2init.logger.info(notification) else: messages.add_message(request, messages.INFO, _(u'Re-Sending the message to your partner ......')) return HttpResponseRedirect(reverse('home'))
Example #2
Source File: views.py From micro-finance with MIT License | 5 votes |
def reports(request): return render(request, "reports.html") # --------------------------------------------------- # # Branch Model class Based View #