Quantcast
Channel: timonweb.com: posts tagged as django
Browsing all 32 articles
Browse latest View live

AngularJS plus Django: A match made in heaven

I've just finished watching "AngularJS plus Django: A match made in heaven" DjangoCon US 2014 talk by Nina Zakharenko (Video | Slides) and it was quite helpful. Since I'm working with API's and mobile...

View Article



Django Uwsgi Nginx 504 Gateway Timeout

I had a long running process (data import) and encountered 504 Gateway Timeout error. I use Nginx / uwsgi pair to serve my Django app. After doing some research it turned out that the problem is in...

View Article

Saving file field uploads not in MEDIA_ROOT directory

I had a requirement recently to upload files to some kind of a private directory, not accessible via www. Of course, I used Django model's FileField to solve the task, but the problem was in a fact...

View Article

Installing libsass (django_libsass) on Mac OS Yosemite

I started playing with wagtail recently (a very promisiing Django CMS) and they use django_libsass to compile their sass into css. Unfortunatelly, if you'll try to install django libsass via PIP on Mac...

View Article

Running Django manage.py commands from anywhere

One of the most annoying aspects of developing in Django for me is running manage.py commands: you need to be in the same directory with manage.py file in order to run a command. This is not...

View Article


New in Django 1.11: Template-based widget rendering

There's a very interesting change coming with Django 1.11 - Template-based widget rendering.To make customizing widgets easier, form widget rendering is now done using the template system. In older...

View Article

Make Your Developer's Life Easier By Reducing Number Of Opened Tabs in Pycharm

When coding, I often find myself overwhelmed by a number of opened tabs in my editor. I just seem to have opened every single .py file of a Django project. And it's kinda hard to find a way in this...

View Article

How To Get a List Of All User Permissions Available in Django Based Project

Django comes with a simple permissions system. It provides a way to assign permissions to specific users and groups of users. The system adds "change, remove and add" permissions automatically to every...

View Article


How To Show Correct List Item Indexes When Using Pagination in Django

In your Django template put something like this:<ul>{% for object in object_list %} <li>{{ forloop.counter0|add:page_obj.start_index }}. {{ object }}</li>{% endfor %}...

View Article


How To Exclude node_modules Directory When Running collectstatic Command in...

If you use npm or yarn to install frontend packages inside your Django project, you may notice, that when you run python manage.py collectstatic command, it ends up collecting huge amounts of...

View Article

Make Django Rest Framework and Axios Work Together Nicely

This is a solution to the problem I encountered while marrying Django Rest Framework powered API and Axios JS HTTP client: Axios issues GET requests with multi-value parameters in a bit different way...

View Article

Image may be NSFW.
Clik here to view.

Make Django Rest Framework and Axios Work Together Nicely

This is a solution to the problem I encountered while marrying Django Rest Framework powered API and Axios JS HTTP client: Axios issues GET requests with multi-value parameters in a bit different way...

View Article

Image may be NSFW.
Clik here to view.

Accessing Model's/Object's Verbose Name in Django Template

Let's say you have a model:fromdjango.dbimportmodelsclassSnippet(models.Model):....classMeta:verbose_name='Snippet'verbose_name_plural='Snippets'And you want to print model's verbose name in a Django...

View Article


Image may be NSFW.
Clik here to view.

Automatic Created and Updated DateTime Fields for Django Models

I'm leaving this to my future self, as I keep forgetting it over and over again.If you want to add "create" and "update" time logging to your model, it's as simple...

View Article

Image may be NSFW.
Clik here to view.

How to Hide And Auto-populate Title Field of a Page in Wagtail CMS

Givenfromdjango.dbimportmodelsfromwagtail.wagtailsnippets.modelsimportregister_snippetclassCountryPage(Page):country=models.ForeignKey('wagtail_simple_countries.Country',blank=False,null=True,on_delete...

View Article


Image may be NSFW.
Clik here to view.

Overriding Field Widgets In Django Doesn't Work. Template Not Found. The...

One day you may want to override a default Django form input widget. Let's say; you'll want to tweak a Date widget, so it has type="date" on it.So you'd go out and do the regular drill:1) Find the...

View Article

Image may be NSFW.
Clik here to view.

Django Filters Problem: How To Display All Results When The Filter Is Not Set

If a view extends django-filter'sFilterView it may look similar to...

View Article


Image may be NSFW.
Clik here to view.

How To Prevent Users From Creating Certain Page Types in Wagtail CMS

Sometimes in Wagtail, we have pages that should only have a single instance in the system. Let's say we have a blog that has an index page driven by BlogIndexPage model. We create it once and want to...

View Article

Image may be NSFW.
Clik here to view.

Make Django's collectstatic command forgiving

Have this ever happened to you? You run a python manage.py collecstatic command, it progresses for some time and then throws an error, something like:ValueError: The file...

View Article

Image may be NSFW.
Clik here to view.

Adding custom filters to Django admin is easy!

I'm building a backend for a scraping tool that has two simple models Website and Page, where Website can have many pages.In a simplified form it looks...

View Article
Browsing all 32 articles
Browse latest View live




Latest Images