hi,
i am implementing a VERY simple usermanagement screen for the admin
view. functionality:
create new user, change existing user, delete user.
for an user, the following data is "available":
username, password, groups.
so when they create/change an user, they can change the username, the
password and the assigned groups.
the view of this is a normal view with a textfield for the username, 2
textfields for the password, and a selectbox for the groups.
my validation needs are quite simple:
1. username: to contain only some valid characters, that no other user
with such username exists (when creating a new user) , and it's not empty.
2. password: that only valid characters are there (or a special-string
to detect "password unchanged"), and that both password-fields contain
identical data
3. no restrictions on the groups selectbox.
i did not want to do the validation by myself, so i hoped there is
something in django for this.
i found:
1. generic views (the crud oriented ones). they're nice, but they only
works with forms that display (only?) (the whole?) model data. so in my
case, the 2 password textfields are problematic.
2. forms/manipulators: again, there are auto-created manipulators for
database-models, but for my needs there is need for a custom one. yes, i
can create a custom validator, but is that simpler than to simply do all
the validating by myself?
yesterday i decided that i will simply do all the validation by myself,
but today when writing the 3rd-level of an if-tree, i started to wonder
if maybe a custom validator would be simpler :)
how do you usually approach such problems?
what's the better/best way?
thanks for the help,
gabor