Posted by Ian Holsman
Sun, 20 Nov 2005 13:20:00 GMT
So while I was investigating django’s built in comment templates, and trying to get them working (the documentation is on Adrian’s VERY long todo) I checked out LJWorld and how they use them.
The first thing I noticed was their cool idea for User registration. Instead of making me fill in all the details and then having to wait for a some key-code (and creating a record in their database which for a big percentage would be just crap as people put in fake emails, or forget to register).
They ask for the email address first.
This is a great idea as no database activity is required. you can just encrypt the email address and mail that back to them. If they click on it you then create the record.
and BTW.. the comment stuff is pretty cool as well, it basically is a self-contained review/comment application just waiting for a product to hang off.. you just need to add some templates and it works.
Posted in Development | Tags development, django, marketing | 4 comments | no trackbacks
Posted by Ian Holsman
Fri, 18 Nov 2005 02:16:00 GMT
There has been some discussion on whether django should choose a ajax toolkit to work out of the box with the framework. the basic gist of the discussion is should we select one, or let the developer decide.
This sample is more of a sidestep to this. It allows you to output your model as json so you can start working with ajax stuff now until the decision is made.
snippet is django+json interoperability.
you can see a working example here
Posted in Ajax, Development | Tags ajax, django, json | no comments | no trackbacks
Posted by Ian Holsman
Thu, 17 Nov 2005 14:18:00 GMT
Django has released their 0.90 version. Their first offical release.
They are still debating what other features will be in the 1.0 release, but i’ve been using it for a while (a while == 1 month) and it works quite well.
Go check it out.
Posted in Development | Tags django | 3 comments | no trackbacks
Posted by Ian Holsman
Thu, 10 Nov 2005 17:41:00 GMT
from The Farm
Here are the tag lines of 3 frameworks
Rails: Sustainable Productivity …
Django: … for perfectionists with deadlines
Symfony: … for lazy folks
I think the tag lines speak a whole lot about the general ideals about the framework.
what do you think?
Posted in Development | Tags django, funny, marketing, rails, symfony | 7 comments | no trackbacks
Posted by Ian Holsman
Mon, 07 Nov 2005 17:45:00 GMT
This allows you to use regular apache authentication methods to set the user-id in a django application.
This allows for easier integration with the existing security architecture in your enterprise.
Currently it creates a ‘user’ record inside of the auth table. This is done so that regular apps which expect a user record wont fall over. Hopefully it will get integrated into the core.
Posted in Development | Tags apache, django | no comments | no trackbacks
Posted by Ian Holsman
Mon, 24 Oct 2005 18:06:00 GMT
so I was messing around with my tags in my little django app, and was not content with using custom manipulators especially when I wanted the tag field to show up in ‘row’ of a slave table. so I thought there must be a better way of doing it.
This method uses a custom Field type and hides all the ugliness of making the tags appear the way I want them to.
(which is as space seperated words in a normal input box, with a list of tags underneath it with the ability of letting people add them in the text box), and not as a multiple-select list box, which is the default implementation.
By doing this my ‘tags’ appear as i want them to on ANY view of the data, AND they also function as lists inside of the code as well.
the hardest part of all this.. figuring out how to convert the incoming post data into a list of ID’s. I had no clue on which method to override. After a hour or two of hair-pulling I stumbled on convertpostdata. which does the job nicely.
2 caveats on the code.
- The ‘Tags’ class is hard coded which is not a good thing
- it requires the new-admin branch.
Thanks to rjwittams for the hint.
Posted in Development | Tags django | no comments | no trackbacks
Posted by Ian Holsman
Tue, 18 Oct 2005 23:49:00 GMT
Why is it that the most mundane things end up taking the longest amount of time.
For my tagging project that I’m using to learn the django framework I’m working on I wanted a plain text field that users can just enter a bunch of tags and store them in a many to many table. similiar to what you see on del.ici.ous. My first (feeble) attempt was to use the post save hook, but because I didn’t show the ‘real’ tag form field it would remove the tags after I just added them in the hook.. ugh..
After about a day I took a deep breath and wrote a custom manipulator (basically cut and pasted the one in the docs about custom manipulators and modified it slightly to make it work.
After about 30 minutes of tweaking I got it to work.
some of the ‘features’ this manipulator is that it adds a ‘calculated’ field which looks and acts like a regular one in the form template.
It also auto-inserts new tags if the user types them in. (It probably should remove tags which are no longer used as well)
def edit_keyword(request, keyword_id):
# Get the place in question from the database and create a
# ChangeManipulator at the same time.
try:
manipulator = keywords.ChangeManipulator(keyword_id)
except keywords.PlaceDoesNotExist:
raise Http404
manipulator.fields.append(
formfields.TextField(field_name="tagField", length=30, maxlength=200, is_required=True),
)
# Grab the Place object is question for future use.
keyword = manipulator.original_object
if request.POST:
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:
manipulator.do_html2python(new_data)
tagnames = new_data["tagField"].split()
taglist=[]
for tagname in tagnames:
try:
tag_ref = tags.get_object(name__exact = tagname.lower())
except tags.TagDoesNotExist,msg:
tag_ref = Tag(name=tagname.lower())
tag_ref.save()
taglist.append(tag_ref.id)
new_data.setlist( 'tags', taglist )
manipulator.save(new_data)
# Do a post-after-redirect so that reload works, etc.
return HttpResponseRedirect( keyword.get_absolute_url())
else:
errors = {}
# This makes sure the form accurate represents the fields of the place.
new_data = keyword.__dict__
tagFieldValue = ""
for tag in keyword.get_tag_list():
tagFieldValue = tagFieldValue + " "+ tag.name
new_data.__setitem__( 'tagField', tagFieldValue)
form = formfields.FormWrapper(manipulator, new_data, errors)
return render_to_response('conf/keywords_form', {'form': form, 'object': keyword})
ok.. django/python experts.. how should I have done this?
Posted in Development | Tags django | 1 comment | no trackbacks
Posted by Ian Holsman
Mon, 10 Oct 2005 02:59:00 GMT
Django has got a lot of good things going for it, but I find the lack of a standard template a limiting factor. (the templates they provide are for the admin-screens only and should not be copied).
So my first submission is to help rectify this problem by providing a OK-looking default template which people can use as a starting point for their own apps, or use as-is.
Hopefully the Django team will take my submission.
Posted in Development | Tags django | no comments | no trackbacks
Posted by Ian Holsman
Thu, 29 Sep 2005 01:54:00 GMT
Sam over at the magpie brain asks the question about what is keeping me (or anyone) from using rails.
here are three:
- Learning Curve: I’m productive in X, while it might not be as fast as if i was productive in Rails/django, that productivity will only happen after a couple of months of coding with it
- Inertia: I have 4-5 other products currently using X. In order to use Rails/django I will need to rewrite those in Rails/django. Thats a big hit, and not one I can justify easily to my PHB.
- Busy: I don’t have enough time to learn rails/django as I’m too busy fighting the fires caused by not using Rails/django.
What I am doing to try and ‘push’ me into this is deploying and running ‘rails’ applications at home and introducing self contained applications like Weed at work as a small workable proofs of concepts which I can demonstrate to my PHB how good they are, and slowly build my experience up so that when i start a new project i can hit the ground running.
Oh and what can you (the rails development community) do to make my life easier?
write documentation about your application on how to install the silly thing. A simple do this, then do that..
come up with a ‘common’ method of installing it and creating the databases. I have seen 2/3 different ways with typo, weed, rforums, tracks, and Muraveyweb. all seem to do it in slightly different ways.
make it easier to install on Apache2.. the rewrite hoo hah is daunting.
(rails) figure out a neat way of letting me running multiple rails app in one URL space like django does.
Posted in Development | Tags django, rails | no comments | no trackbacks