Derek Stegelman

Django

Multiple Forms in Django Views

in technology django

Handle multiple forms within multiple Django Views

Django By Example

in technology django

Glad to announce a new book that I've reviewed is now available.

Django Feedme 2.0

in technology django opensource

Today I am announcing the immediate availability of django-feedme 2.0. This release contains many bug fixes and feature improvements.

Keeping it DRY with Mock and Python

in technology django

This week while writing a new feature in the core of one our apps, I had to mock something that would be used in almost every single test in the test suite. I'm a huge fan of keeping things DRY so you can imagine that when I started to type things like this:

New Software Releases

in django technology

I've released new version of django-site-notifications and django-downtime. Both these releases bring support for Python 3.x as well as bringing them up to date with at least Django 1.7.

PyCon

in django technology

Heads up that I'll be at PyCon this year in Montreal, Canada. If you are around and want to meetup, let me know!

Wrapping Your API Calls for Fun and Profit

in django technology

The last few months I've been working on fixing up our applications at K-State and how they interact with other custom built and off the shelf software. One of our common practices on the web team is to create applications that consume data from other organizations on campus, manipulate it, display it, etc. One of the things I noticed early on was that we would use the same boilerplate code to generate and get responses from various systems. None of the calls were tied together, and we often used the same or similar data in multiple apps. Something had to be done.

Django MPTT Custom Managers

in django

The latest version of django-mptt automatically sets your default model manager objects to the built in TreeManager() model manager in django-mptt.

Async Processing with Django and Celery

in work technology django talks

Come join in my discussion on Async processing with Django and Celery this Monday August 11 in Fort Collins CO. I'll be going over the basics of using async processing and tips for utilizing this type of architecture.

Django Test runner hang on create

in django

I recently had the Django test runner completely fail on me and refuse to create and destroy the test database, effectivly stopping all new development until I got it resovled. It turns out a small model change, of adding unique=True to a slug field caused this.

Announcing Django Feedme 1.0

in django

Django Feedme 1.0 has been released. Among other things Django 1.5. Over the last few months I haven't had a whole lot of time to update it, but it has gotten some support from other users and as such has made some decent progress. The package is available on Pypi.

Announcing Django Mail Queue 2.0

in django

Today I'm officially releasing Django Mail Queue 2.0.

Snippet Sunday: Access the Request Object Inside a Django Form

in django

#Form class MyForm(forms.Form):

Snippet Sunday: Busting Suds Cache

in django

This week's snippet sunday is breaking a suds cache. When working with suds and WSDLs occasionally, suds will cache the WSDL content which will break your code when a WSDL changes. Adding this little snippet in a debug mode right before you make API calls wil clear your cache. It can also be thrown inside of a Django Management Command to be even more useful. import os import shutil from tempfile import gettempdir as tmp shutil.rmtree(os.path.join(tmp(), 'suds'), True)

Follow Up, Django and Gunicorn

in django technology

This is a (short) update to my post about moving to Gunicorn from mod_wsgi.

Django Deployment Talk

in django technology talks

Yesterday, I had the pleasure of giving a talk at Boulder Django on Django Deployment and Hosting options. We had a good turnout and I think overall most of the attendees learned something about Django, Python, and Deployments. I've included the slides on speakerdeck below.

Moving From Mod_Wsgi to Gunicorn with Webfaction

in django technology

This week (tonight) I moved my major sites (this site, my wife's site and my brothers site) over to Gunicorn from Mod_wsgi. I initially thought it was going to be an incredibly different process, but I'm here to show that it can be done in one night and it isn't nearly as hard as I thought. I wanted to document and outline the process in case anyone else wanted to make the transition.

Django Mail Queue gets Attachment Support

in django

Yesterday I released Django Mail Queue 1.6 which features support for attachments, as well as few other house keeping issues. You can checkout the code on Github or download the latest from Pypi.

Django Mail Queue 1.5

in django

Today I am announcing the release of Django Mail Queue 1.5. The release includes two relatively minor, but neat changes to the app. Github user @rspeed contributed a change that allows queued emails to be sent from the command line via a Django management command. The second change is the addition of another test, and hosting CI on Travis. Both of these change are helping to mature the small but effective project. Download the latest from Pypi!

Django Infuse: Save and Continue Wizard

in django

This month I released an update to django-infuse to include alpha support for save and continue form wizards. I have used Django's built in Form Wizard for quite some time in different applications and it works really well. One thing it does not include out of the box is support for saving each form incrementally. When you have longer form processes, such as a scholarship form, it is often helpful to allow users to save their progress and continue later. I created the Save and Continue mixin for just this process. I have this in alpha status because I had to extract and commonize a lot of the custom development I had to done to allow this to be used easily by other developers.

On the News

in django

On the recent horrific massacre in Conneticut, my feelings can be summed up fairly nicely with this single tweet.

2012: In Reflection

in django

As 2012 comes to a close, I wanted to reflect on what has happened this year and what I want to improve on going into 2013. This year in particular has been rewarding and challenging and one of the most exciting years of my whole 26 years of life.

Proxies and Django CAS: Friends Working Together

in django

Django CAS and Proxies have never over well in my experience. This week after another application deployed using the Proxy/CAS I got fed up with how we were handling it. "There must be a better solution." I thought. This does not have to suck this much. The before code is some snippets from inside the K-State django CAS library that we have modified and released to handle for situations when get_host() may be incorrect, ie, proxies.

Django Dev Email

in django

A few days ago I open sourced Django Dev Email, which is a simple replacement email backend for use in development environments. At K-State, when we deploy applications to a staging environment, we like to give clients access to the email account that all emails generated by the site will go to. We do this to avoid having emails sent to real email addresses during testing and development. For a while there were several nasty if statements throughout the code base that pointed emails at a different specified address. This technique sucks both for re-usabilty of code, and it messes with how email would be sent to the backend.

Deploying Django Applications at K-State

in django

Github

Django Site Notifications

in django

Site Notifications is a small app designed to allow you to alert your users to a message on every page load. It's common for messages regarding expected downtime, or other alerts to be used on some web apps I build. I have released this app on Github as well as PyPi.

Django Downtime

in django

Recently I've had a need to display a down page, or simply redirect users to a different site while I did maintenance. I couldn't quite find what I was looking for so built my own downtime app. While its not perfect it allows me to put up a down page, or just redirect users to another site while I do database maintenance. I've published the code on Github and the package is available on PyPi as well. pip install django-downtime add to installed apps downtime Add downtime middleware to the top your list of installed middlewares 'downtime.middleware.DowntimeMiddleware', Settings ``` DOWNTIMEEXEMPTPATHS = ( '/admin', '/otherlocationnot_down', )

GCC Compiler issues in Mountain Lion

in django

After a recent upgrade to Mountain Lion I ran into a few small problems with gcc and some python modules. I ended up having to reinstall pip and virtualenv, but I couldn't get PIL to compile correctly. After some searching..

Snippet Sunday - Werkzeug Deuggber and django-extentions

in django

Sunday snippets are bits of code that I've found useful in past projects. I post them here in hopes that someone else will find them useful. Most of these are Github Gists and you can follow them there too if you want.

Snippet Sunday: Check Group Affiliation in Templates

in django

Sunday snippets are bits of code that I've found useful in past projects. I post them here in hopes that someone else will find them useful. Most of these are Github Gists and you can follow them there too if you want.

Snippet Sunday: Decorating a Class Based View

in django

Sunday snippets are bits of code that I've found useful in past projects. I post them here in hopes that someone else will find them useful. Most of these are Github Gists and you can follow them there too if you want.

Snippet Sunday - Chainable Model Managers for Django

in django

Sunday snippets are bits of code that I've found useful in past projects. I post them here in hopes that someone else will find them useful. Most of these are Github Gists and you can follow them there too if you want.

Hadrian 1.1.4

in django

Tonight I released Hadrian 1.1.4 with a few small changes and features. The breakdown is below.

Django-Piston RSS Emitter

in django

I recently had the need to push data to Django-Piston in RSS format. A little background: I had been developing an API with django piston emitting json and xml objects which was great, our project owner requested that these also be emitted in RSS format. This could be completed right out of the box with django's syndication framework and ignoring piston all together. The challenge with this, is my API currently supports passing in loads of parameters to query exactly the information desired. Implementing a solution with the syndication framework means I would need to replicate all my logic and duplicate it accross numerous classes and methods. To avoid this issue I created a custom emitter that expells RSS formatted data. I have open sourced the code on github. I would love any and all feedback to make this thing better.

Django Mail Queue

in django

Earlier last week, I had an email die in the middle of sending from one of my applications. This hardly every happens, but when it does it fails hard. People just expect emails to go through, no matter what. In order to hedge my bets against emails failing, I've developed a small Django app to control the sending of emails. Using Django Mail Queue you can add a new email to the queue, it will attempt to send it, and if it fails it will be added to the DB and can be attempted again via cron job.

Interactive API Documentation

in django

This is a repost from an article that I wrote on the K-State Blog

Snippet Sunday - Require Login Middleware

in django

Sunday snippets are bits of code that I've found useful in past projects. I post them here in hopes that someone else will find them useful. Most of these are Github Gists and you can follow them there too if you want.

Django Boilerplate

in django

Lately, I've been needing a starting place for my django projects, and I've noticed a common pattern.

Who's in my Data?

in django

As a part of our projects at OME we like to develop APIs and keep access to our public data as easy as possible. Recently we've wanted to open up some of our APIs to allow others to add and modify that data. From the start we picked up django-piston to roll our APIs and have had great success. As we desire to open up that data and allow create/update/delete access, we needed an authentication solution.