22:47 PM
nkuttler
tbaxter: just curious, but have you worked on multilang sites?
22:48 PM
giarc
not sure what is right, but i can see its not nesc obvious and an easy call...
22:48 PM
tbaxter
I haven't. So I'm really just giving my opinion.
22:48 PM
giarc: agreed
22:48 PM
petisnnake has quit
22:48 PM
mkoistinen
boom... {{ language.0|language_name_local }} <--- works!
22:48 PM
Thanks all
22:48 PM
giarc
submit that as a patch...
22:48 PM
IMO
22:49 PM
mkoistinen
Its already in the code base, just a bit undocumented...
22:49 PM
MicahCarrick has quit
22:49 PM
22:49 PM
aeikenberry
hi. can i assign choices for a model's char field inside the __init__ of a ModelForm?
22:49 PM
mkoistinen
22:49 PM
*facepalm*
22:50 PM
tbaxter
aeikenberry: yes
22:51 PM
aeikenberry
22:51 PM
malibu has quit
22:51 PM
doesn't seem to do the trick
22:53 PM
tbaxter
22:53 PM
aeikenberry
oh, has to be a list?
22:53 PM
tbaxter
Oh, one could probably build out a tuple, maybe. List is easier. Mine could be cleaner with a list comprehension
22:54 PM
foo` joined the channel
22:54 PM
Milossh has quit
22:54 PM
polishnorbi joined the channel
22:54 PM
garnertb has quit
22:54 PM
jjmalina has quit
22:54 PM
foo` has quit
22:55 PM
jjmalina joined the channel
22:55 PM
foo` joined the channel
22:56 PM
Milossh joined the channel
22:57 PM
the_rat has quit
22:57 PM
ojh joined the channel
22:58 PM
the_rat joined the channel
22:58 PM
aeikenberry
yeah, still not working for me though. :/
22:59 PM
tbaxter
gimme a paste
22:59 PM
aeikenberry
when i break, that fields choices is the list, and the list is a list of tuples sized two
23:00 PM
23:00 PM
foo` has quit
23:01 PM
tbaxter
aeikenberry: I'm wondering about sans_us_possessions
23:01 PM
epicowl has quit
23:01 PM
aeikenberry
the list looks ok. it's just a filter
23:02 PM
the_rat has quit
23:02 PM
samuel has quit
23:02 PM
it just still renders as a text field rather than select
23:02 PM
tbaxter
23:04 PM
minim has quit
23:05 PM
pydanny joined the channel
23:05 PM
dshap joined the channel
23:05 PM
hhatch has quit
23:05 PM
dshap has quit
23:05 PM
weird. You could override the widget
23:07 PM
natea joined the channel
23:09 PM
emadicius
Hello. I need to display the group name of every user in Django Admin user list page in a new column using list_display. How I can do this? I can get the name of every group using somethink like "User.groups.all()[0].name" and also I modified the django admin to only allow 1 group per user. Thanks
23:11 PM
aeikenberry
23:11 PM
tbaxter
emadicius: I think you're making a big mistake limiting to one group per user. But aside from that are you subclassing auth.user?
23:11 PM
aeikenberry
tbaxter: this works
23:11 PM
tbaxter
nice
23:12 PM
emadicius
tbaxter: No, I am not subclassing auth.user
23:12 PM
chrismed has quit
23:13 PM
tbaxter
OK. But you are unregistering and re-registering the user admin?
23:13 PM
emadicius
yes
23:13 PM
tbaxter
Ok, one minute....
23:13 PM
emadicius
I want to add a calculated field but I think it is only possible in a Model
23:13 PM
tbaxter
thinking
23:13 PM
emadicius
not in Admin
23:13 PM
stephenmcd joined the channel
23:13 PM
pydanny has quit
23:14 PM
so I tried to subclass User and add this calculated field but then things get complicated because then I get an error telling me that the table <subclassedUser> does not exists
23:14 PM
tbaxter
well, if you subclassed AbstractUser to add a method, that would be pretty straightforward
23:14 PM
garrypol_ has quit
23:15 PM
before subclassing, be sure to read the 1.5 custom user docs (particularly the bit about AbstractUser and extending the default user)
23:15 PM
bulkan joined the channel
23:15 PM
emadicius
is this available in 1.4?
23:16 PM
nullcode joined the channel
23:16 PM
clime
what is the easiest way to find out if a member belongs to group.members.all(). Just interested if there is a builtin way.
23:16 PM
mattmcc
emadicius: No, subclassing User shouldn't be done prior to 1.5.
23:16 PM
emadicius
tbaxter: is not possible to use list_view to show fields from other related model?
23:17 PM
djm- joined the channel
23:17 PM
tbaxter
23:17 PM
djm- has quit
23:17 PM
emadicius
sorry I mean list_display
23:17 PM
right now I have this in UserAdmin -> list_display = ('agencia_name','username','email','first_name','last_name','is_active')
23:17 PM
clime
eh group.members.fllter(members=member).exists()
23:18 PM
ashadocat has quit
23:18 PM
emadicius
oh so it is possible to use a funtion inside list_display!
23:18 PM
mattmcc
emadicius: You can put a method in list_display which returns whatever you want.
23:18 PM
abe_music has quit
23:18 PM
tbaxter
clime if member in group.members.all()?
23:18 PM
clime
ye
23:18 PM
emadicius
perfect! I will try that!
23:19 PM
gremmie joined the channel
23:19 PM
atula has quit
23:21 PM
tbaxter
emadicius: if you wanted, you could also replace first name and last name with get_fullname()
23:22 PM
emadicius
tbaxter: perfect! It worked!
23:22 PM
thanks a lot!
23:22 PM
tbaxter
and I didn't even have a typo in there. woohoo
23:23 PM
emadicius
just 1 more thing.. it is possible to have a verbose name in this function? Or the only option is to rename the function??
23:24 PM
tbaxter
emadicius: are you talking about what shows up in the column header?
23:24 PM
__love__
tbaxter: isn't it get_full_name()?
23:24 PM
tbaxter
__love__: maybe probably
23:24 PM
mattmcc
emadicius: Give your function a short_description attribute.
23:24 PM
__love__
tbaxter: so much for no typos ;)
23:24 PM
mattmcc
23:24 PM
tbaxter
__love__: hey, I didn't mention get_fullname in the paste
23:24 PM
LysergicDreams has quit
23:25 PM
emadicius: see line 15 in the paste for an example of short_description
23:25 PM
ah, shit…. there's my typo
23:25 PM
emadicius
oh sorry I see it now
23:25 PM
tbaxter
knew there had to be at least one
23:26 PM
emadicius
tbaxter: It does not matter 1 typo... now is working.. thanks!
23:26 PM
__love__
tbaxter: line 4 (i know it's from the docs), don't use %format. use .format()
23:26 PM
rmaceissoft joined the channel
23:27 PM
sgambino has quit
23:27 PM
tbaxter
not mine. Not claiming it.
23:27 PM
I have to claim line 15 though
23:28 PM
EyePulp has quit
23:29 PM
EyePulp joined the channel
23:30 PM
__love__
lol
23:30 PM
tbaxter
as a side note, I liked %s better than format(). Ah well.
23:31 PM
lurkerA has quit
23:31 PM
chuckharmston has quit
23:33 PM
vishen joined the channel
23:34 PM
phildini joined the channel
23:34 PM
bwreilly joined the channel
23:35 PM
mattmcc
tbaxter: For the simple case, I do too, but format can certainly do cooler things (attribute access)
23:35 PM
tbaxter
yes, it can
23:35 PM
it's better, I know.
23:36 PM
lduros has quit
23:37 PM
jjmalina has quit
23:38 PM
honi joined the channel
23:38 PM
__love__
stick, meet mud
23:38 PM
ksikka joined the channel
23:38 PM
MicahCarrick joined the channel
23:39 PM
tbaxter
yup
23:39 PM
mihow has quit
23:40 PM
jfenix has quit
23:40 PM
G1eb has quit
23:41 PM
xorobabel joined the channel
23:41 PM
zzing joined the channel
23:41 PM
dray3 has quit
23:43 PM
nullcode has quit
23:43 PM
jeffisabelle has quit
23:45 PM
MicahCarrick has left the channel
23:48 PM
kenbolton has quit
23:48 PM
clime has quit
23:48 PM
thesheff17 joined the channel
23:49 PM
honi has quit
23:50 PM
garrypolley joined the channel
23:53 PM
kenbolton joined the channel