I just started my first Django project. I’m basically re-implementing this for a school project.

Some things I immediately wished WordPress had:

Sane Request Handling

In Django, you have full control over what happens when a request is made. It starts with a rewrite rule:

url(r'^film/(\d+)/$', 'program.views.film_detail')

Once a certain URL is matched, the next thing that happens is that a specific function is called (in this case, the film_detail() function). Once there, you’re free to do whatever you want: run a query, load a template or just throw a 404.

Compare to WordPress, where all rewrite rules are routed through WP_Query in a big mess of ifs and elses, then through another layer of template loading.

Even before trying out Django, I’ve attempted putting all code related to a view in a single place, through the APP_View class, but it’s just not the same.

Nested rewrite rules

url(r'^admin/', include(admin.site.urls))

What that line of code does is basically this: “If the url begins with admin/, match whatever comes after it using the rewrite rules found at admin.site.urls.

Automated admin UI

class Film(models.Model):
    title    = models.CharField(max_length=200)
    poster   = models.ImageField(upload_to='posters')
    desc     = models.TextField()
    released = models.DateField()

With that single class, I get the database schema and a CRUD API.

class FilmAdmin(admin.ModelAdmin):
    list_display  = ('title', 'poster', 'released')
    search_fields = ('title', 'desc')
    
admin.site.register(Film, FilmAdmin)

With the FilmAdmin class, I can easily control various aspects of the admin UI, such as which columns to display and which fields to search on.

Sure, there are many WordPress plugins that generate UIs for custom fields. Pods probably comes closest, but at this point it’s basically a different CMS.

Oh, did I mention I can replace any part of the admin UI as it if were a WordPress parent theme? Imagine that…

Conclusion

I would like a beautiful WordPress admin UI inside an elegant Django architecture, with a cherry on top, please.