Pages

Friday, October 30, 2009

Tweaking ModelForms in django

I try to use a lot of ModelForms in django, it makes things simple and keeps information in once place. However, sometimes I need to change one property of a field. The docs just suggest you define the field again in the form but this means you have to redefine all aspects of the field. Here is an easier way:


class ProfileForm(forms.ModelForm):

def __init__(self, *args, **kwargs):
super(ProfileForm, self).__init__(*args, **kwargs)

self.fields['details'].widget.attrs['cols'] = 100;
self.fields['details'].widget.attrs['rows'] = 12;

Saturday, August 22, 2009

MP Team meeting in Majorca

So a few weeks back my company had our first company meeting in beautiful Majorca Spain. Even though this is a resort location we worked hard planning the future of MariaDB. One great thing about working for an open company is almost everything we do can be put on our public wiki. You might especially be interested in our MariaDB's release plan.

Since I am not a MariaDB dev, my responsibility is to get our website ready for the GA as well as work for the Open Database Alliance. I decided to use django for the new ODBA site which has given me a chance to learn python and use framework instead of re-inventing the wheel. Once I finish the project I will writeup my thoughts on django as I decide if I want to use it for other projects.

Thursday, August 13, 2009

django and AUTH_PROFILE_MODULE

This has been mentioned all over but for some reason I still made the same mistake everyone else did.

When setting up a user profile in django, the value for AUTH_PROFILE_MODULE should just be the application name then the name of the model. For example, my project's name is "foo", the application is "bar" and the model is UserProfile. It made sense for me to put:
AUTH_PROFILE_MODULE = 'foo.bar.models.UserProfile'

That gave me a "too many values to unpack error". The proper value is
AUTH_PROFILE_MODULE = 'bar.UserProfile'

Hopefully this helps someone out, maybe just me in a few months when I forget what I did.

Wednesday, August 5, 2009

OH HAI

I have been meaning to start blogging for a while but never made the time for it while working at MySQL / Sun. Now that I am at Monty Program AB I am making time to share my random thoughts about technology, especially web applications and MySQL / MariaDB.

I was at MySQL (then Sun) for 5 years, during that time my primary responsibility was providing tools for the excellent support team, primarily Eventum but also other internal items. My team also developed the MySQL Network portal (since rebranded to MySQL Enterprise. My co-workers were great and I liked what I did but after the Sun acquisition I saw things changing and based on the number of colleagues who left ahead of me I wasn't the only one.

In May of 2009 I left Sun and returned to startup culture, working with Monty at his new company Monty Program AB as Lead Web Developer. In such a small company there are a ton of different things to do and so far I have not been bored, always a new project to tackle and best of all I feel I make a difference.

I probably will not be a prolific blogger (I actually want to get real work done) but when I start rambling it will generally be on my work here at MPAB or web development in general.