Question

I recently started using Django 1.5.4 for a web app with MySQL backend. Just at the outset, I encountered certain limitations that makes me wonder is Django the right way to go ahead.

Some glaring shortcomings are:

  1. Lack of composite primary keys. The bug has been open for 8 years. Isn't this bad for an app that relies on a lot of many-to-many tables to have a unnecessary auto primary key and work around with unique_together attribute.

    Reference:
    - http://comments.gmane.org/gmane.comp.python.django.devel/37301
    - How to remove redundant ID field in auto-generated ManyToMany table in Django?
    - https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys#Multi-ColumnPrimaryKeysupport
    - https://code.djangoproject.com/ticket/373

  2. Something simple like having a default value being expressed in SQL schema. I know the reason why they won't fix it but it makes life harder.

    Reference:
    - https://code.djangoproject.com/ticket/470

  3. Not having the ability to declare fixed char fields

    Reference:
    - https://code.djangoproject.com/ticket/9349

    Downside (quoted from the above bug report) : In my particular application, changing from Django-autogenerated varchar fields to char fields dropped the size of the database from 550GB to 300GB. There are many cases when there really is fixed-length character data that needs stored.

  4. Primary Key can't be unsigned (bug report has been going back & forth for a long time)
    . This isn't hard to implement. It doubles the available IDs.

    Reference:
    - https://code.djangoproject.com/ticket/56

As I said, this is just a start. I've encountered some shortcomings that gives me a feel that if Django has ignored such basic stuff, is it the right framework to go ahead with? I would like to ask the community that is Django full of problems that require hacks for otherwise straightforward stuff or are these just a few exceptions?

I'm thinking of trying out Pyramid/Pylons Framework. Any help/advice would be appreciated.

Update : Added 2 more

Was it helpful?

Solution

Honestly, if those things are blockers for you, don't use Django. I am a very strong proponent of Django, but if you feel it doesn't meet your needs, you should go with something else.

I must say though that those are odd things to fixate on. I can't imagine why an extra primary key field on an intermediate M2M table would be a problem at all. (Note, however, that composite fields - including PKs - has been the subject of a Summer of Code project this year, and looks ready to merge - see https://groups.google.com/forum/#!topic/django-developers/CD7OrkJ63zc)

And again, why the lack of defaults at an SQL level "makes life harder" is hard to understand: if you're doing everything through Django's ORM, where the default is applied makes no difference; plus, as Adrian said on that ticket, doing it in SQL would actually reduce the current functionality by making things like callable defaults impossible.

Also you should reflect on why you're letting these relatively trivial details overshadow the great benefits that Django gives you: expressive ORM, template language, thriving community, huge numbers of third-party apps... But, even that said, once again you're free to choose something else if it really doesn't work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top