Django Useful Apps

linkaiyi
Follow

Django Translation

Django Rosetta: https://github.com/mbi/django-rosetta

To create message files, you use the django-admin makemessages tool. And you use django-admin compilemessages to produce the binary .mo files that are used by gettext

Django Viewflow

View Flow: https://github.com/viewflow/viewflow

Setup default django project

Cookiecutter: https://github.com/cookiecutter/cookiecutter

Display Diagram Chart

Mermaid: https://github.com/knsv/mermaid

List of useful django apps

Awesome Django: https://github.com/vinta/awesome-python

display charts for reporting:

Chart.js: https://www.chartjs.org/

Django template strip the whitespaces

{{ value|cut:" " }}

Save uploaded file to model

from django.http import HttpResponseRedirect
from django.shortcuts import render
from .forms import UploadFileForm
from .models import ModelWithFileField

def upload_file(request):
    if request.method == 'POST':
        form = UploadFileForm(request.POST, request.FILES)
        if form.is_valid():
            instance = ModelWithFileField(file_field=request.FILES['file'])
            instance.save()
            return HttpResponseRedirect('/success/url/')
    else:
        form = UploadFileForm()
    return render(request, 'upload.html', {'form': form})
Object has 0 attachments

Was this article helpful?

This article is viewed 16 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support