2008-3-9

23:14 Yuji_
so django.contrib.auth.models user object says it only takes alphanumeric/underscores and whatnot. If i want people to be registered by email address should I just write registration view that automatically makes a random "username" on account creation (they only supply email address/password) and when they login with an email address the view is User.objects.get(email='email')?
23:14 SmileyChris
__machine: jquery hides content for me without any flicker
23:14 __machine
i'll check that out. thanks.
23:15 mamato_
how can i run some useful python startup code when 'manage.py shell' is run? (using ipython)
23:15 sterna
PYTHONSTARTUP=~/.pyrc
23:15 sterna
and then put stuff into .pyrc
23:15 SmileyChris
Yuji_: yep, random username on creation - you could also write an auth backend to get the right user for you
23:15 sterna
i think
23:15 __machine
have you also used YUI SmileyChris ? find jquery less bloated?
23:16 robhudson
23:16 mamato_
sterna: well i use python for non django stuff... i'd like to add common debugging variables ex. 'fs=Foo.objects.all()'
23:16 SmileyChris
__machine: looked at but haven't used. Jquery fits my mindset and needs
23:16 Magus-
mamato_: there is /nothing/ that runs only on manage.py shell
23:16 sterna
aha
23:16 Magus-
so you cannot do it for just that
23:16 sterna
i suppose you can patch your own manage.py
23:17 illustir
__machine or set the hidden part display: none in CSS initially and then toggle it later with js
23:17 EyePulp_
I have a Model meant to log activity across my project (various things being submitted or updated with datestamps and user.id's and such) would it be appropriate to have a method of the logging model act as the function to do the .save() of new records related to that model? It seemed like a logical place to store the generic functionality like that, but maybe that's a decision I'll regret...?
23:17 mamato_
manage.py is magic :(
23:17 __machine
illustir: that means people without JS will never see it
23:17 illustir
oh sorry
23:17 Magus-
EyePulp_: we have managers for a reason :)
23:17 EyePulp_
managers... that name rings a bell.
23:17 EyePulp_
one sec
23:18 SmileyChris
mamato_: perhaps you should just have a test script you run?
23:18 sterna
btw, does anyone know why model validation fails with http://dpaste.com/38682/ ?
23:18 mamato_
i think i'll have ipython run whatever startup.py script is in current dir
23:18 sterna
apparently, you can't use order_with_respect_to on a self-referencing foreign key?
23:19 Magus-
sterna: not surprising
23:19 sterna
how would you go about creating a tree of categories?
23:19 SmileyChris
sterna: you need null=True on that FK too
23:19 sterna
of which top-level ones don't have a parent, but others do
23:19 sterna
i used to have that, but i fiddled with it
23:20 sterna
now i'm looking at the code and it seems it's not really trivial to support that kind of usage
23:20 SmileyChris
sterna: check out mptt
23:20 EyePulp_
so it wouldn't be a def within the model class, it would be class Foo(models.Manager) outside of it.
23:21 sterna
what's mptt? :)
23:21 sterna
aha, found it
23:21 kalimera
hey everybody
23:21 kalimera
has somebody used mptt yet ?
23:22 sterna
SmileyChris: but i suppose this won't work with admin interface?
23:27 robhudson
Yuji_: satchmo uses email as username and it seems to be well integrated. take a look at the source.
23:27 sterna
another q
23:27 sterna
onetoonefield seems to be deprecated according to svn docs
23:28 sterna
are there any clues yet about how it's going to be used in the future?
23:28 Magus-
no
23:28 SmileyChris
sterna: yea, there are some
23:28 SmileyChris
sterna: check the mail archives - malcolm explained it
23:28 sterna
thanks again
23:29 SmileyChris
it's not going to be deprecated from the sounds of it, just simplified and therefore potentially not backwards compat
23:29 Yuji_
robhudson: thanks. Its funny that the reason i'm doing this is because i'm new to django/programming and could not understand exactly what satchmo is doing
23:30 urugan
if i have a datetime in model e.g. DateOfArchive, and want to filter it by year should i write e.g.: invoices.filter(DateOfArchive.year=2007) ?
23:30 urugan
or something, somehow else
23:30 Magus-
of course not
23:30 Magus-
23:30 Magus-
the docs clearly explain the various filter options like that
23:31 urugan
Magus-: thank you, you rule!
23:49 clamothe
I'm having a really weird problem.. I just syncdb'd into a clean database. Now when I try to go to a model in my admin, I get the error 'no such column: products_grouping.id'
23:50 clamothe
so um, django isn't creating the column maybe?
23:50 Magus-
more likely you broke something ;)
23:50 clamothe
yeah hmm
23:50 clamothe
well all the other models are working fine
23:50 clamothe
haven't touched the django source
23:50 Magus-
pastebin more info
23:52 jeffwheeler
Is it possible to make Typogrify not parse stuff in pre/code elements? My code samples are getting smart quotes. :P
23:52 sontek
I get this: http://rafb.net/p/kWp0Ct72.html when I'm doing: current_fights = all_fights.filter(end_date__gte=datetime.date.today())
23:54 clamothe
Magus-: I found the problem. had to do with ordering
23:55 clamothe
couldn't order by a foreign key
23:55 Magus-
sure you can, you just have to do it right
23:55 clamothe
Well I just did order by the field name of the foreign key
23:56 clamothe
and it came up with saying that the id column doesn't exist
23:56 Magus-
because it won't be included in queries
23:56 Magus-
you need to do fkeyname_id
23:56 clamothe
aw okay
23:58 aficionado
One of my models is missing the 'id' primary key, why might that be? I have verified that it is inheriting from models.Model
23:59 clamothe
Magus-: It's actually a m2m, any way to do that? I know I can't call methods in ordering so that wouldn't work
23:59 aficionado
None of the other fields have the primary_key parameter either
23:59 jeffwheeler
Ignore my earlier comments; found this: http://www.djangosnippets.org/snippets/381/
23:59 ubernostrum
aficionado: does it have a OneToOneField on it?
Page 11 of 11   ← Previous  (1,079 total)