| by jpic | python django A Delegative Democracy implementation made in BlackLoop HackerSpace for Les Indignés back in the days I used to squatt hackerspaces in-between gigs (now running my own). It’s a bit old but probably still valid, given the complexity is handled in SQL with a WITH RECURSIVE query. Anyway, hope this will inspire you ! Have a great week

pyfront: Meteorish django responsive frontend

| by jpic | python django django-channels
pyfront is a research project implementing data binding over django-channels.


| by jpic | python django


| by jpic | django channels asgi

Django & JS research report

| by jpic | python django best-practice npm nodejs js
This article aims to report the current state of research about dealing with both JS and Django, for people that aim to primarly deal with Django and enjoy the same workflow they have with python package with their frontend development, and find patterns to connect them while keeping them loosely coupled at whatever limit feels right for them. Nuff said, let’s hack ! crudlfap relies on django-webpack-loader, which does its job very well. Read More


| by jpic | python django best-practice GDAPS - Generic Django Apps Plugin System Awesome app by Christian González, undergoing research & development for frontend framework plugin EPIC !!! This is the README so far: This library allows Django to make real “pluggable” apps. A standard Django “app” is reusable (if done correctly), but is not really pluggable, like being distributed and “plugged” into a Django main application without modifications. CAVE: This software is in a very early development state. Read More


| by jpic | python django An alternative to django forms that works with django models and offers a lot of unfrustrating features, tri.form by Anders Hovmöller. Make sure that you also take a look to all their other apps which are pretty interesting !

Automatic test rewrite for django-dbdiff/django-responsediff/cli2

| by jpic | python django best-practice tdd
Still in the competition for most code coverage with least test code that is written manually and needs to be maintained manually, all our test autowriting software has been updated to support a new environment variable : FIXTURE_REWRITE. Instead of deleting fixtures manually to regenerate them by running the tests, you can now just run your tests with the FIXTURE_REWRITE env var. This will overwrite the fixtures and make the tests look like it passed. Read More


| by jpic | python djcli django
djcli 1.1 screenshot!


| by jpic | python django crudlfap


| by jpic | django javascript python django-webpack-loader code splitting support by @alihazemfarouk, that has a sister pull request.


| by jpic | python django For hacker only: Full feature CLI CRUD+ for Django vidéo demo.


| by jpic | python django best-practices The new CLI for Django that you will wonder how you lived without !


| by jpic | python django Probably my ugliest python hack, which I’m not proud about, but I live with it.


| by jpic | python django Brilliant update for django-jet !


| by jpic | python django crudlfap
CRUDLFA+ 0.5.0, g-drive-ish design

clilabs 1.1.1 release

| by jpic | django python best-practice
Clilabs now benefit a new command that automates a series of 3 lines that’s I’ve been typing over and over again during 10 years of Django hacking. $ clilabs help +django:settings Setting up django has failed ! DJANGO_SETTINGS_MODULE env var not set ! Show settings from django. How many times have you done the following ? python shell from django.conf import settings settings.DATABASES # or something Well it’s over now ! Read More

djcli: the new Django automation CLI command

| by jpic | python django devops
djcli is the package , a new CLI under design phase, it is a simple python package, that provides a command with name djcli, to do more with Django on the CLI: $ pip install djcli find the content for this variable in your project $ export DJANGO_SETTINGS_MODULE=your.settings you will probably run this from your directory parent to $ djcli create auth.user username=pony is_superuser=1 i just checked and chpasswd command in django supports only interactive $ djcli chpasswd /path/to/password username=pony Read More


| by jpic | python django best-practice devops playlabs
“Extreme DevOps” screenshot, where you see branchname == lastbuildjobname, designed for dynamic environments, demonstrates auto-deploy an environment per push on a subdomain with the branch name. From betagouv/MRS#636, with PlayLabs, currently in Alpha stage.

Django tests that write themselves

| by jpic | python django best-practices
This is a plain advertisement for two excellent test utils maintained by YourLabs: django-dbdiff django-responsediff If you’re volunteering on a project, and that there are many newbie contributors - who turn out to be militants with a high determination - then you definitively want to check out these apps as they will highly facilitate your volunteering in a project as sole professional dev.


| by jpic | python django best-practice Want to split your react components accross your django apps or anything like that ? Try django-collectdir, which implements a instant realtime django-app directory watcher with beautiful colors for development !

django-autocomplete-light 3.3.2 release

| by jpic | python django django-autocomplete-light
3.3.2 fixes a regression with static files loading in django.contrib.admin that was introduced in 3.3.1 Note that it also supports Wagtail now, thanks to @coredumperror

django-autocomplete-light 3.3.1 release

| by jpic | python django django-autocomplete-light
Thanks to awesome contributors from all around the world, DAL 3.3.1 is out, one month after 3.3.0, that was the first non-rc release of 3.3.0 which starts to require Django 2.0. 3.3.1 Fixed a bug in the way jquery.init.js was being used by @coredumperror Set select2 container CSS class to :all: @hbielenia Added missing renderer parameter to render method for django 2.1 @monim67 Fix ImportError with SELECT2_TRANSLATIONS in Django 1. Read More

djcall 0.0.5 release

| by jpic | python django uwsgi spooler cron
django-call is a model wrapper around uWSGI native cron and spooler features, including the signal framework allowing to program callbacks on cron or run them in a given spooler with a given priority for example. For example right now on a betagouv project it logs the following when uWSGI starts: [uwsgi-signal] signum 1 registered (wid: 0 modifier1: 0 target: worker) [djcall] uwsgi.register_signal(1, mrsstat.models.Stat.objects.create_missing) [uwsgi-signal] signum 2 registered (wid: 0 modifier1: 0 target: worker) [djcall] uwsgi. Read More

Django-autocomplete-light 3.3.0 release

| by jpic | python django-autocomplete-light django
Changes since 3.3.0-rc6: - use admin statics - #981: create option behaviour - #995: automatically generated views for generic foreign key fields - Getting placeholder and minimumInputLength from dal select - #1017: Initial migrations and database - Turkish translation - Added support for forwarded fields to Select2GenericForeignKeyModelField Since 3.2.10: 3.3.0-rc6 #959: Django 2.0 widgets may load jQuery after dal #959 3.3.0-rc5 #895: Self() and JavaScript() forward features 3. Read More


| by jpic | python django uwsgi django-uwsgi-spooler Finnaly a Django app to wrap around uWSGI’s builtin spooler ! I should have done this years ago, but I was expecting to make a boring module, it turned out a lot more exciting than expected ! First things first, django-uwsgi-spooler has only one expectation from your callbacks: be an importable function and take a task argument. The only other expectation is that you can use the Task model it provides, for example: Task(callback_name='yourmodule. Read More


| by jpic | python django Gratz for another amazing release !


| by jpic | python framework django best-practice Nagare, a brilliant Python framework definitely worth studying ;)


| by jpic | python django crudlfap
In the first screen we see that two posts in the list have a different button in the Actions column. The first row is a post that I’m the owner of, therefore the Actions shows a button for a dropdown menu. The second row is a post that I’m not owner of, but that has been published, so, I only have the detail link on that row. In the second screenshot, using the checkboxes reveals possible groupped actions on the bottom of the screen, here “Delete objects” which serves as reference action. Read More


| by jpic | python django nextjs react django-appwatch
How to put a NextJS server in front of Django with django-appwatch In this article, we’ll get started on a new Django project with NextJS in front of Django. We choose to put NextJS in front of Django because NextJS is an isomorphic UI framework for React, that’s pretty simple to use. - Create your Django project as usual, - Do in your repo: yarn add next react - Install django-appwatch with pip install django-appwatch, - Add appwatch to INSTALLED_APPS, - Run command manage. Read More


| by jpic | python django javascript react djnext best-practice Django-NextJS Isomorphic UI Development with Decorator pattern for Django with: - nextjs out of the box experience for frontend development, - rendering of nextjs pages with context in Django with NextJS template engine. For fun & profit ## Run the example project Run this commands as non root:: git clone cd djnext pip install –user –editable .[dev] yarn install djnext watchstatic # maintains nextjs pages/ directory for yarn dev yarn dev # run localhost:3000 djnext dev # run localhost:8000 ## Choose NextJS page template in Django Example project lives in src/djnext_example, see src/djnext_example/artist/urls. Read More


| by jpic | python django crudlfap
Some screenshots from a backoffice using CRUDLFA+


| by jpic | python django best-practice Pretty cool alternative to django.contrib.admin.LogEntry


| by jpic | materializecss crudlfap python django turbolinks stimulusjs
Still finishing CRUDLFA+ framework for Django 2.0, see example esponsive detail page for BetaGouv with MaterializeCSS.


| by jpic | python django kubernetes best-practice

CRUDLFA+ 0.3 Series

| by jpic | python django crudlfap
CRUDLFA+ is an expirement (read: pre-alpha state) of what Django could be if: generic views provided templates and javascript for a rich experience out of the box, class based views leveraged OOP a bit more to add DRY goodness, leveraged externals apps from the Django ecosystem. Let’s compare it side by side. Consider this simple model: class Email(models.Model): email = models.EmailField() caisse = models.ForeignKey('Caisse', on_delete=models.CASCADE) def __str__(self): return self. Read More


| by jpic | python django javascript react best-practice Beautiful example of Django/React integration !


| by jpic | python django javascript best-practice Django isomorphic research !


| by jpic | python django adapters How adapters can be amazingly simple and fun !

Model in Django: not what you think they are

| by jpic | python django
It’s funny how my imagination was completely anihilated when I actually read django model field source code. I thought a Django Model was dedicated to designing the database. But a Model field is not a DB Field. A Model field has a DB field, and a formfield method. Unfortunnately, formfield is not changeable unless you override the method which means creating your own model field. Also unfortunate, Model has no form() method like their fields have formfield() method. Read More


| by jpic | python django best-practice adapters django-adapters new proposal ! This time less clumsy and I hope probably more like what Marc had in mind !

django-adapters audit writeup

| by jpic | best-practice python django
It’s been probably 30 hours I’ve spent trying to contribute to the django-adapters. This article describes the approach we take when making investment audits on software @ YourLabs, and my conclusions on this project. I started by reading what had been done and issues. My first mistake was to not be patient enough to really read and profoundly understand absolutely every piece that had been done. It seems to me that what django-adapters tries to do is invent a new pattern to solve the kind of problems we usually deal with as developers: Read More

Djangonauts: Say no to selenium drug

| by jpic | selenium best-practice python django js
When you start applying best development practices such as TDD, you discover that you make much better software. First, you can TDD your python code with anything, django has a test runner, otherwise you have pytest and many friends. Then, you make python to interact with javascript. In the Django community, it seems that there is a conscensus around “use selenium to test your JS”. I’ve been like this myself for years, but the thing with selenium is that it’s functional testing, not unit testing, it does bring short term ROI, but on the long term it becomes costy to maintain over time. Read More

Django settings refactoring apps

| by jpic | django python
Found another way cool app shared by Linus Lewandowski on django-dev mailing list, here’s the excerpt from django-12factor: “The Twelve-Factor App” is an awesome methodology for building SaaS apps. django-12factor makes Django more 12factor-y. Right now, this focuses on the Config - “Store config in the environment”; Heroku users with addons will be particularly familiar with this. Still not sure of the benefits? Check out “Twelve-Factor Config: Misunderstandings and Advice”. Read More

django-dbdiff 0.7.3 release

| by jpic | django-dbdiff python django
I’m pretty lazy when it comes to writing tests for existing code, however, I’m even lazier when it comes to repetitive manual testing action, catching up with untested legacy code when I want a lot of coverage now, at least to ease upstream dependency upgrade testing. PHPUnit has had a DBUnit component since at least 10 years, and Junit too, I ported the concept to Django, first in several apps. Extracted it in the package to de-duplicating the data import tests from django-representatives and django-representatives-votes which is re-used in django-cities-light. Read More

get_context_data() considered harmful

| by jpic | django python
Hello everybody <3 Let’s talk about ideas for deprecation / discouraging the use of get_context_data(). get_context_data() is useful to support legacy templates from the pre-CBV era, since CBV we can now access any attributes from the view instance with {{ view }}. I’ve seen things like this in many projects, I wonder if it’s the case for other people too: def get_context_data(self, **kwargs): c = super().get_context_data(**kwargs) c['something'] = self.something return c And I’m guilty as charged you can find commits from myself like this all over internet. Read More

Getting generic views to support “fake” models

| by jpic | python django crudlfap
Sometimes, we need to make views around objects which are not stored in the database. They may be calculated on the fly in python, or come from some data source that’s not the database, or which aggregates several objects in the database. This is supported out of the box with CRUDLFA+, the modern web framework for Django. All you need to implement is: a Model class with what you want in it, just set Meta. Read More

YourLabs Business Service is born

| by jpic | python django yourlabs crudlfap
It’s my pleasure to announce the official birth of our new company, YourLabs Business Service. This company will work in conjunction with the YourLabs foundation and of course sponsor the Django apps ecosystem. We are hiring freelancers to: maintain apps in the Django ecosystem that we use in CRUDLFA+, our modern web framework for Django, sysadmins and other hackers to co-manage our infrastructure: respond to monitoring alerts and this kind of things, contribute to our customer projects, This is a 99% remote position, or 100% if you want to miss all the parties and conferences we’ll setup or join, but it’s not a full time job, yet, rather a paying side project for things you probably already do. Read More

What does the CRUDLFA+ acronym stands for ?

| by jpic | python django crudlfap
Well, it definitely stands for something ! And since this is becoming a FAQ, here’s my answer: It stands for: Create Read Update Delete Form Autocomplete and more ! We started by making a CRUD because the customer was complaining his come was not DRY and that we should have a CRUD in Django - the customer comes from the modern PHP framework world. We soon figured we needed a crudL, for the list. Read More

django==2.0a1 released

| by jpic | django python
You can install it with: pip install django==2.0a1 Time to test some apps With <3

CRUDLFA+ 0.1.1 Video Demo

| by jpic | python django crudlfap
This is a quick video I made so our friends can see CRUDLFA+, the DRY framework for Django, looks like so far: With <3 Jamesy aka jpic

Rethinking Django’s URL Router

| by jpic | django python crudlfap
This all started when a web developer learning Django was struggling to maintain a quantity of HTML and came to me: “I have a question for you, Django, can you generate a menu for me please ?". Oh my, is this person going to be the next wasting their time building something that’s too complicated and worthless just like I have back when I used to try this kind of stunt ? Read More

DAL 3.2.6 Release

| by jpic | django-autocomplete-light django python
django-autocomplete-light 3.2.6 was released on github and pypi, with: #838: Use namespaced jQuery in `get_forwards` by @ryan-copperleaf & @gagarski #836: Queryset sequence view to display actual model name by @jsoa 3.2.5 and 3.2.6 were briefly hosted on PyPi and are the same. Enjoy <3

django-autocomplete-light 3.2.4

| by jpic | django-autocomplete-light django python
#813: Return 400 on invalid input by @EvaSDK

django-autocomplete-light 3.2.3 release

| by jpic | django-autocomplete-light python django
3.2.3 Two seriously good community contributed bugfixes #799: Support serializing UUIDs and add tests for models with UUIDs as PKs by @blag #826: Prevent rendering of empty option on multi select by @beruic Bravo ! Tests are passing reliabily these days. The code climate is pretty sunny to contribute patches. Help wanted on unit tests: there is a bunch of units and currently everything is tested together with selenium. Read More

DAL 3.2.2: Django 1.11 support

| by jpic | django-autocomplete-light python django
django-autocomplete-light 3.2.2 was released, it supports django 1.11 and is not known to break backward compatibility.

Welcome Erik Telepovský as new release manager for django-session-security

| by jpic | django-session-security python django
Let’s give a warm welcome to django-session-security‘s new release manager, Erik Telepovský from

django-session-security 2.5.0 release

| by jpic | python django django-session-security
DSS release 2.5.0 was published in PyPi: #79 remove compiled binary from source to comply with Debian source code repository policy by @nirgal #81 support django 1.10 by @eriktelepovsky #84 a11y support to modal dialog by @lynnco #85 support for mobile device activity by @kalekseev #88 dutch translation update by @rdekker1 #91 test django 1.11 and 2.0 instead of 1.7 by @jpic Rename default branch to master

Django: status of 1.11

| by jpic | python django
Django 1.11 alpha is announced for January 16, review priority will be given to any ticket marked “ready for checkin” by January 9, Tim says, which means its still time to make a contribution to Django 1.11 ! The only “major feature” on the 1.11 roadmap is template-based widget re ndering which is (hopefully) in final reviews. There are still plenty of “patches needing review” if you want to help there. Read More

Django-autocomplete-light 3.2.0 release

| by jpic | python django-autocomplete-light django
We have two major features: Advanced field forward options, List based autocompletion. Complete changelog: #745: Add list autocomplete by @dmosberger, and, #754: dal_queryset_sequence documentation update by @chubz #734: Move create_option functionality into it’s own method @andybak #741: Fix initial value not set when selected choices aren’t strings @thauk-copperleaf #733: Advanced forward features @gagarski #752: Add doc test to CI by @jpic #730: Resolve SystemCheckError fields.E304 @thecardcheat #721: Note about placement of DAL before grappelli by @chubz #748: Update docs example about loading jquery outside the admin @jpic

django-responsediff 0.7.1 released

| by jpic | python django django-responsediff
This release includes a bugfix for the new feature added in 0.7.0, occuring with non-ascii characters in selector-based tests with python 2. Fix by @njoyard, test case by @jpic.

yourlabs-security mailing list

| by jpic | python django security
This post announces the creation of a mailing list for security issues concerning yourlabs. Members can read messages, but external users may only post to it: Thanks Clayton Delay for the suggestion. You may request to be part of the list here.

django-session-security 2.4.0 release

| by jpic | django python django-session-security
This new release enforces SESSION_EXPIRE_AT_BROWSER_CLOSE, because it makes no sense to use django-session-security without it, by design. However, a vulnerability caused by having SESSION_EXPIRE_AT_BROWSER_CLOSE disabled was fixed, thanks Clayton Delay for the report.

django-responsediff 0.7.0 release

| by jpic | python django django-responsediff
This new release includes: the possibility to filter content, contributed by @njoyard the possibility to crawl the website and test all pages

django-autocomplete-light 3.1.7 release

| by jpic | django-autocomplete-light python django
#714: Update select2 by @meesterguyman #705: Improve compat with dj1.9 by @9nix00 #706: Fix extra require by @blueyed #710: Added note for static files not checked by @geekashu #708: Provide path with dal_select2.E001 by @blueyed #700: Enable HTML markup in select2 item labels by @njoyard

django-cities-light 3.3.0 release

| by jpic | django python django-cities-light
Thanks to the amazing work by the YourLabs community, I’m proud to release 3.3.0 of django-cities-light: #118: Add Django 1.10 support, drop Django 1.7 support by @jpic #113: Fix DeprecationWarning by @mbaragiola #106: New management command to work with fixtures by @max-arnold #108: translation_items_pre_import_signal by @FaBay89 #106: New management command feature by @greeday2 Njoy B)

DAL 3.1.6 release

| by jpic | django python django-autocomplete-light
django-autocomplete-light v3.1.6 was released, thanks to these fine contributions: #671: Create_field support with querysetsequence by @jpic #679: Allow create message translation by @maisim #682: Extend ‘forward’ attribute to creating objects as well by @toudi #666: Improved missing ‘created_field’ error by @guettli #670: Javascript loading documentation by @jpic #678: Added example to update autocompletes in JS by @jpic

django-autocomplete-light 3.1.5 release

| by jpic | django python django-autocomplete-light
This release enables field-forwarding in formsets and forms with prefix. Also note that several things have been made to help users: a new tutorial section showing placeholder and minimum-input-length select2 options has been added and a system check will raise an error if select2’s js is not present - typically for users who have git clone'd the repo without --recursive, resulting in a wc without select2. For devs, we’ve moved from django-sbo-selenium to pytest+splinter and it’s pretty cool ! Read More

django-autocomplete-light 3.1.3 release

| by jpic | python django django-autocomplete-light
This release provides commit e612748 which fixes a bug in the TaggitSelect2 to reproduce the bugfix in 15f27871 that was issued in 3.1.2.

django-dbdiff 0.6.0 release

| by jpic | python django best-practice django-dbdiff
django-dbdiff was released. It allows to exclude fields from tests with the new exclude parameter, ie:: Fixture( 'tweets/tests/after_create_retweet.json', models=[Tweet, Retweets], ).assertNoDiff( exclude={ 'tweets.tweet': ['datetime'], 'tweets.retweets': ['datetime'], }, } This was initially requested by Nicolas Joyard for the Political Memory project. Note that you shouldn’t use exclude for datetimes like in the above example, but instead use something like freezegun to force datetimes to an arbitrary fixture.

django-autocomplete-light 3.1.2 release

| by jpic | django python django-autocomplete-light
This posts announces the release of django-autocomplete-light 3.1.2: #634: Select2 Upgrade #628: Do not rely on ids to fix container text #631: Initializing GFKs with values from forms #623: Fix extras by @ticosax #610: Cancel out Django’s style on lists Enjoy B)

Porting ModelForm enhancements from django-autocomplete-light v2 to Django

| by jpic | python django django-autocomplete-light xmodelform
Currently, django-autocomplete-light v2 provides enhancement to default form field generation for model fields, depending on the registered autocompletes, as shown in the tutorial. For v3, we don’t want this feature inside DAL anymore because it has really nothing to do with autocomplete. Instead, I’m trying to contribute a generic way to do that. It would not benefit only django-autocomplete-light anymore, but all Django apps. You could get enhanced default form fields for model fields just by installing and configuring apps in your project. Read More

django-autocomplete-light v3: what’s going on

| by jpic | python django django-autocomplete-light
This post clarifies the status of django-autocomplete-light and strategy for v3. Version 2 No further effort will be made to support new versions of Django in v2. However, it supports the current LTS Django 1.8 and future-release Django 1.10, so we’ve got plenty of time to re-do v2’s best features in v3 (in a better way) and most importantly you’ve got plenty of time to upgrade (until 2018). Version 3 It’s a ground-up rewrite and it’s not backward compatible - hence the 2 years upgrade plan. Read More

django-responsediff 0.3.0

| by jpic | python django best-practice django-responsediff
django-responsediff 0.3.0 has been released ! It now also checks the status_code, and has a cute mixin: from responsediff.test import ResponseDiffTestMixin class MixinTest(ResponseDiffTestMixin, test.TestCase): def test_admin(self): self.assertResponseDiffEmpty(test.Client().get('/admin/')) The above will fail on the first time with FixtureCreated to indicate that it has written responsediff/tests/response_fixtures/MixinTest.test_admin/{content,status_code}. This file is meant to be added to version control. So next time this will run, it will check that response.status_code and response.content is the same, in future version, or in other configurations (ie. Read More

django-jet: modern admin template

| by jpic | django python
Check out this nice django admin theme: django-jets.

django-autocomplete-light 3.0.0 release

| by jpic | django-autocomplete-light django python
After 4 years of supporting django-autocomplete-light, I’m beginning to figure what users expect and the common mistakes, like registering the wrong model for autocomplete, or having troubbles figuring how to link suggestions with other form fields, or create choices on the fly, or with the magic modelform. So at first, I really tried to find other autocompletion apps for with DAL could be just an extension. It turned out that with they had too much security issues, known security vulnerabilities which aren’t going to be fixed (which I don’t dare to post here). Read More

Syntax highlighting for Django’s SQL query logging

| by jpic | python django
Markus Holtermann has published a tutorial for setting up syntax highlighting for Django’s SQL query logging. I didn’t try it but it looks pretty cool, maybe that’s something we could add to django-dbdiff somehow. Anyway, check it out !

django-autocomplete-light 2.3.3 release

| by jpic | python django django-autocomplete-light
This release fixes an important usability but on the manychoice fields, and introduces a minor backward compatibility break: #563 Don’t disable multiplechoicewidgets if select is [multiple], bd9ca0085 Don’t import anything in init anymore if on django 1.9 test_project fixes, for the above. Disabled field bug Thanks George Tantiras for reporting the bug ! Note that only paliative solutions have been taken for v2: repaired the demo website, should make it easier to spot bugs, bug fix in the JS. Read More

Automatic fixtures for HTTP Response assertions

| by jpic | python django test django-responsediff best-practice
As stated in the “Database state assertion” article: I’m pretty lazy when it comes to writing tests for existing code, however, I’m even lazier when it comes to repetitive manual testing action. When my user tests my website, they browse it and check that everything is rendered fine. In the same fashion, django-responsediff eases doing the high-level assertions of page HTML rendering. Consider this example: class TestYourView(TestCase): def test_your_page(self): result = test. Read More

django-autocomplete-light 2.3.0 release

| by jpic | python django django-autocomplete-light
#555 Django 1.4, 1.5 and 1.6 deprecation #497 Enable registration by model-name by @luzfcb #536 #551 Support proxy models b y @onrik #553 improved jQuery integration by @blueyed #516 Corrected french transation by @apinsard #541 Use error_messages on FieldBase to allow overrides by @dsanders11 #505 Ordering alias clash fix by @sandroden #515 Polish translation update by @mpasternak #543 ModelChoiceField requires the queryset argument #494 ModelChoiceField Watch changes to ‘queryset’ by @jonashaag #514 Fixed deprecation warning on Django 1. Read More

Django database testing

| by jpic | python django django-dbdiff
I’m pretty lazy when it comes to writing tests for existing code, however, I’m even lazier when it comes to repetitive manual testing action, we’ve got so much patches to review and test against so many versions of Python and Django, we need testing to be automated. This article presents a new Django app for testing the database. Java has DBunit and so does PHP, and django now has django-dbdiff. Read More

django-cities-light 3.2.0 release

| by jpic | python django django-cities-light
django-cities-light 3.2.0 was released, supporting Django 1.7 to 1.9 now, even though older versions should still work, they aren’t tested anymore. #105: Drop LazyProgressBar, patch was accepted upstream by Max Arnold, #104: Better feature code filtering by Max Arnold and Michael Gulev, #100, #96: The mystery about migrations appearing in some environments but not others has been solved: it was due to the presence of b'' in migration files. A new test was added to fail if django wants to create new migrations in any environment. Read More

django-session-security 2.3.x releases

| by jpic | django python django-session-security
Starting 2.3.0, django-session-security supports Django 1.7 to Django 1.10 with tox. In 2.3.1, Andrei Coman added redirectTo parameter and tests were stabilized using django-sbo-selenium and tox.

Django 1.9 support for Django-autocomplete-light

| by jpic | python django django-autocomplete-light
Since Django 1.9a1 was released, many users are going to upgrade their project and wonder why django-autocomplete-light won’t load anymore. Probably, some users are going to google ImportError or even django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet about autocomplete_light and Django 1.9. This post documents the situation and provides a solution. Do: find test/ -name foo -exec sed -i 's/import autocomplete_light/from autocomplete_light import shortcuts as autocomplete_light/' '{}' \; I don’t remember why exactly since we’ve baked Django 1. Read More

django-autocomplete-light 2.2.0 release

| by jpic | python django django-autocomplete-light
After 8 release candidates, we’ve got our new shining 2.2.0 release of django-autocomplete-light which literally drown the backlog, we’re down to less than one github page of issues now. Needless to say, we’ve closed an insane amount of issues with 2.2.0. Please read the release notes before upgrading.

django-autocomplete-light 2.2.0rc1 release notes

| by jpic | django-autocomplete-light django python
This article presents the changelog for django-autocomplete-light 2.2.0 release. To upgrade to 2.2.0rc1: pip install -U --pre django-autocomplete-light If you find any problem, please report it on github issues and downgrade to last stable (2.1.x series): pip install -U django-autocomplete-light Pending break warning, Django >= 1.9 The good old import autocomplete_light API support will be dropped with Django 1.9. All imports have moved to autocomplete_light.shortcuts and importing autocomplete_light will work until the project is used with Django 1. Read More

django-cities-light 3.1.0 release

| by jpic | django-cities-light django python
Pluggable models have come to django-cities-light thanks to Alexey Evseev. It’s completely backward compatible and allows you swap default models with your own as well as connecting to new signals the geonames import command. On the behalf of YourLabs, I’d like to welcome Alexey Evseev aboard ! I recommend hiring with Alexey Evseev if you have the chance and trust in with your mission. Upgrade instructions: pip install -U django-cities-light Don’t forget to read how to customize your models with django-cities-light it’s ultra simple. Read More

Speed up your travis-ci builds with container based infrastructure

| by jpic | travis-ci python django linux
Travis-ci just released container based infrastructure for open source repository (free users). We tried it with our apps, and you can see we had some performance increase, even on database-intensive jobs: django-autocomplete-light normal build takes around 1 hour and 35 minutes while it takes rather 1 hour and 22 minutes with container based build]( so that’s around a 10% build speed increase, pretty cool right ? read on ;) django-cities-light normal build takes around 5 hours and 45 minutes, on travis-container it takes around 3 hours and 30 minutes ! Read More

yawd-admin: brilliant django admin responsive theme

| by jpic | python django
Check out yawd-admin for Django, it’s responsive and beautiful !

Django 1.7 Release !

| by jpic | django python
Django 1.7 final has been released, and it’s awesome, check it out !

django-cities-light 2.3.1 released

| by jpic | django python django-cities-light
django-cities-light 2.3.1 was released: #42 added FAQ: Some data fail to import or don’t import like I want, how to skip them ? #45 django-rest-framework support update by @almalki. #49 Added country_items_pre_import and region_items_pre_import by @mauricioabreu. #51 Slug should be used in unique_together along with name. #51 Skip duplicate cities with no regions #52 Added FAQ on MySQL and UTF-8 #53 Country phone prefix support by @csarcom Forms update. It is backward compatible and has migrations: don’t forget to run: Read More

Django 1.7 new feature: AppConfig

| by jpic | django python
Check out the new applications documentation for Django 1.7 ! It’s still quite cryptic what will “holding app metadata” be really able to do. For starters it enables changing the name of an app in the admin without any hack. It will probably make installing and customizing apps easier, ie.: provides a default setting system, similar to django-appconf, automatically include app-specific stuff like middlewares, urls, etc, etc … ? replace an app’s model ? Read More

RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response.

| by jpic | selenium python django travis-ci
Another problem you might run into when testing Django apps with Selenium on Travis: ====================================================================== ERROR: tearDownClass (autocomplete_light.tests.widget.WidgetTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/build/yourlabs/django-autocomplete-light/autocomplete_light/tests/", line 29, in tearDownClass super(WidgetTestCase, cls).tearDownClass() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/", line 1148, in tearDownClass cls.server_thread.join() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/", line 1072, in join self.httpd.shutdown() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/", line 959, in shutdown "Failed to shutdown the live test server in 2 seconds. The " RuntimeError: Failed to shutdown the live test server in 2 seconds. Read More

Django 1.5.4 security release

| by jpic | django python
Django 1.5.4 security release is out. It limits password lengths so that people don’t upload 1Mb passwords (limit for nginx default config). Imagine 1000*1Mb to hash ? That could potentially cause a DoS. Update your django installs.

Using bootstrap and less css in django

| by jpic | python django git
Overview Compile less in debug mode in the browser for development. This enables your integrator to work faster and to view syntax errors reports in the browser and make development awesome. Use django-compressor for production to pre-compile all your less into css and make performance awesome. Be able to reuse in your less scripts: bootstrap classes, variables, etc, etc … else what is less good for ? The problem is that you must get your compiler to compile both bootstrap and your own less scripts in the same run. Read More

Automatic updates for commits made with GitHub code editor

| by jpic | python django github
For development, we host the project on some small server. It is running via ./ runserver just for our customer to be able to see what’s going on. Also, this enables our designer to hack the project via SFTP without having to deploy the website locally. Currently we are working with a new designer who found out that GitHub’s editor was pretty cool because it saves him from doing backups himself. Read More

New cool django-admin themes

| by jpic | python django
django-responsive-admin and django-suit are interesting new themes for Django admin.

Django 1.7 might have schema alteration super powers

| by jpic | python django
Andrew Godwin, Django core dev and author of django-south, submitted a pull request for django to include schema migration features.

Partition your data with django-parting

| by jpic | django python
Just stumbled on django-parting which provides a nice API to partition your data. For those not familiar with data partitioning, I recommend reading partitionning on mysql.

Django security releases: 1.5rc2, 1.4.4, 1.3.5

| by jpic | django
Please upgrade. source code is now open !

| by jpic | django python is a social network based on music made in Python/Django. The catalog is powered by and the videos come from youtube. Before its final death, we decided to release the source code under Apache 2.0 license.

Using to test Django applications with LiveServerTestCase

| by jpic | django python best-practice
I’m posting this because it took me quite a few hours to get to this point: seem to have a nicer API and to be faster than selenium so far.

django-smarter: the CRUD app I've been waiting for

| by jpic | django python
django-smarter looks way cool, check it out !

django-rules-light 0.0.6: now with template tag

| by jpic | django
Finally, django-rules-light supports running rules from templates. Check it out !

django-autocomplete-light: upcoming backward compatibility breaks

| by jpic | django
Django-autocomplete-light has planned backward compatibility breaks for version 1.2. This version will be released around May 2013. If using this app, you can check the BC breaks in question on github. You’ve been warned !

Bootstrap, lesscss and django

| by jpic | django
This article demonstrates how to have your own project-specific twitter-bootstrap fork, allowing you to change stuff in variables.less and other files. In development, lesscss is computed by the browser, with the less library in debug mode. In production, it relies on django-compressor. In site_base.html: {% if debug %} <link href="{{ STATIC_URL }}bootstrap/less/bootstrap.less" charset="utf-8" type="text/less" rel="stylesheet"> <link href="{{ STATIC_URL }}bootstrap/less/responsive.less" rel="stylesheet"> <script type="text/javascript">less = {}; less.env = 'development';</script> <script type="text/javascript" src="{{ STATIC_URL }}less. Read More

Django 1.5 RC (Release Candidate) is out !

| by jpic | django
Django core hackers announced 1.5 release candidate. This means that the 1.5 release notes are rather stable by now, the chances that they change is insignificant. Wait for the final 1.5.0 release before migrating projects in production thought… Read more about what release candidate are. Thanks to the Django core team and community for this awesome release !

Django admin probably going bootstrap, maybe completely rewritten ?

| by jpic | django
It seems that django admin revamp discussions started again. Last year, I sent a letter to santa asking for 12 transformers with super laser powers. I waited nicely and then received a little playmobil. So, here’s my letter to santa this year: admin css must be in lesscss too, ie. you could override variables.less, widgets that are usable outside the admin should not be in django.contrib.admin, ie. the bootstrap-calendar widget should be usable outside the admin too, ChangeList should be decoupled, and even refactored into 2 separate modules: one for table display like django-tables2 and one for queryset filtering, for models with lots of fields, tabs are a must in the form, views and urls should be “normal”, have a fixed name and arguments instead of name generation, detail view and “read” permission support, per object and per field CRUD permissions,

Django security release

| by jpic | django
Update to Django 1.3.5, 1.4.3 and 1.5 beta 2 security releases. Details

Django development: possible change of the .save() implementation

| by jpic | django-developers django
An interesting topic by Anssi Kääriäinen flew by django-developers mailing list about ticket #16649: “ refactoring: check updated rows to determine action”. The ticket mentions a 50% performance optimization. Here’s an explanation by akaariai (core developer): A bit more information about what the approach suggested is about. Assume you load a model from DB, change some fields and save it. We currently do: SELECT - load from DB [change fields]; save() In save: SELECT - assert that the PK exists in the DB if yes: UPDATE else: INSERT The second select above is usually redundant. Read More

Django & DBAs: "Performance problems due to incorrect many-many primary key on many tables"

| by jpic | django django-developers
Extract from a great thread on the django-developper mailing list started by Trey Raymond: I’m a DB engineer working for Yahoo, and we have a new product using django that I’m onboarding. We see a variety of easily fixed issues, but one major one - there are 21 many-many tables here, yet they have auto increment primary keys Looking forward to see how it goes ! Star the thread. Read More

Django & ajax: how to reverse urls in javascript (not)

| by jpic | ajax django http api

IMPORTANT UPDATE: the approach proposed in this article is bad. Read this one instead.

You can start building a user interface using Django’s awesome CRUD in a matter of seconds, for example with just this server side configuration:

Read More

Testing django signals properly

| by jpic | python django
Asserting that signals were sent properly can be a bit tricky: they must be sent in a particular order with specific arguments. Fortunately, mock-django provides plenty of cool features, including a nice signal receiver mock. The only problem with mock-django is that it’s not documented. So I had to reverse-engineer and here’s what I’ve found: the best way to test a signal is to use the call_args_list property of the receiver mock. Read More

Surviving django.contrib.staticfiles (or: how to manage static files with django)

| by jpic | django best-practice
This article describes how to use django.contrib.staticfiles as this is a FAQ StackOverflow and IRC. Structure The HTTP server is to serve static files directly from a public folder, without going through Django at all. Uploaded files If the HTTP server configuration serves /srv/project/media_root/ on url /media_url/, for example with this nginx configuration: location ^~ /media_url/ { alias /srv/project/media_root/; autoindex off; } Then: settings.MEDIA_ROOT should be /srv/project/media_root/ settings. Read More


| by jpic | django python
Django-autocomplete-light 1.0.17 released !

(unknown post type)

| by jpic | nginx django
missing body

Never hardcode absolute paths

| by jpic | python django best-practice
This is nonono: STATIC_ROOT = '/home/coat/www/site/app/static/' Never hardcode absolute paths, you’re just making your settings file less portable and probably killing kittens. Adapt this to your needs: import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..') STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') # fix STATICFILES_DIRS too # and TEMPLATE_DIRS

How to see exception stacktraces with django LiveServerTestCase

| by jpic | django python
After playing with selenium and LiveServerTestCase a little while, you might see this: Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/", line 85, in run self.result = application(self.environ, self.start_response) File "/home/jpic/env/local/lib/python2.7/site-packages/django/contrib/staticfiles/", line 68, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/", line 241, in __call__ response = self.get_response(request) File "/home/jpic/env/local/lib/python2.7/site-packages/django/contrib/staticfiles/", line 63, in get_response return super(StaticFilesHandler, self).get_response(request) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/", line 228, in handle_uncaught_exception return callback(request, **param_dict) File "/home/jpic/env/local/lib/python2. Read More

Django schema migrations: nashvegas vs. South vs. evolution

| by jpic | django migrations
Schema migration consists of altering a database structure. For example, adding a column, an index … When creating a Django model, running the syncdb command can create the tables. But syncdb doesn’t support schema migrations. So when modifying a Django model, reflecting the changes on to the database is left as an exercice for the sysadmin. Django-extensions If you don’t speak fluent SQL, use the sqldiff command from django-extensions. It compares the database structure with the actual models for an app, and output SQL migration code. Read More

Coding standards for Django apps: names

| by jpic | django best-practice
This post shows a coding standard which emerged from the Pinax community (formerly hot-club)[source needed] for predictive and consistent URL naming patterns. While this is still supported by Django, namespaced URL include() has been as well for some years now and urls should be translated when upgrading Django versions. Django Contributing Commons maintains a technical description which you can reuse in your project. Check it out and try to contribute, this could be a nice community driven git based coding standards for Django ! Read More

Django generic relations and performances: solutions

| by jpic | django contenttype
django-actream is a fresh and fantastic pluggable application for django. This article presents the solution to a simple performance issue: selecting followers and users who follow me through a generic foreign key … This article targets django users. The model At the time this article is written, this is what it looks like: class Follow(models.Model): """ Lets a user follow the activities of any specific actor """ user = models.ForeignKey(User) content_type = models. Read More

Howto: javascript popup form returning value for select like Django admin for foreign keys

| by jpic | php django javascript
This article presents a technique to get the return value of a form opened in a javascript popup, like Django admin for foreign keys. It can be used to improve the ergonomy relation select inputs. Introduction When a form allows to create or edit data, many to one (n:1) relations choices are often presented in a select input. For example, Django admin uses a select field by default for foreign keys. Read More

How to override a view from an external Django app

| by jpic | django python best-practice
This article describes how to override a view from an external Django app which is a FAQ on StackOverflow and IRC. You should understand that your is a really central and critical part of your django project. You don’t touch external app code You are not supposed to edit the code from an external app. Unless you fork it first on github. How to override without forking Overriding a template If you want to override templates/userena/activate_fail. Read More

Django, Pinax, virtualenv, setuptools, pip, easy_install and requirements.txt

| by jpic | django pinax python virtualenv best-practice
This article describes how to build project dependencies with virtualenv. It is appliable to Pinax. Pinax uses virtualenv by default. It lets the developer have a project-specific python directory, including binaries, packages etc … OpenSuse for example supplies very bad Pinax packages which allows the user to mess with his operating system. It is much better to isolate project dependencies from a project to another for more granular control of the maintenance cost; for example if a package upgrade breaks the user project. Read More
1 of 13 Next Page