Services Blog Français

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

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

How I failed at documentation driven design

| by jpic | best-practice

A small anecdote about one of my most recent failures ! Now it’s up to me to be a better coder next time ;)

When I rewrote django-dynamic-fields into facond, I still had Form/Rule/Action/Conditions from ddf.

When the code got to the point where i was satisfied with it i wrote the tutorial.

This is how I figured this lib had just no need for the “Rule” component.

Hopefuly, both python and js had serious unit test coverage, so I just removed the Rule stuff from Python and JS, changed all function signatures, and kept on fixing stuff until tests passed again. This strikes me: if i had started by writing the tutorial, I would not have wasted my time TDDing a component that I actually didn’t need.

Read More

JS TDD in your Django apps

| by jpic | javascript best-practice

Yesterday, I confessed my guilt of writing shitty DOM manipulating JS code live in the browser, and said no, never again.

Due to positive feedback in the django-users mailing list, I’m writing how I actually plan to change how I do JS in Django apps. Believe me, it’s preventively fixing issues i’ve had with JS in Django apps during the last ten years. Nuff said, let’s hack !

Let’s create an index.test.js file:

Read More
Previous Page 14 of 32 Next Page

They trust us

Contact

logo