6:32 AM
grafa joined the channel
6:34 AM
tim_heap has quit
6:35 AM
dhanush joined the channel
6:38 AM
unknwn- joined the channel
6:39 AM
holler_ has quit
6:39 AM
snollux joined the channel
6:40 AM
snollux
Hello! When I want to make a new record in the DB by doing ModelName.objects.create(), is there a way I can immediately get the primary key of the new record?
6:41 AM
jtiai
snollux: It's returned with an object from create call.
6:41 AM
snollux: obj = ModelName.objects.create() and then obj contains your newly created object.
6:41 AM
Alina-malina has quit
6:43 AM
snollux
wonderful!
6:43 AM
thanks jtiai
6:43 AM
jtiai
I bet it was documented as well... :)
6:43 AM
Knyght
pfft, who reads that stuff
6:44 AM
snollux
haha fair enough
6:44 AM
i've been justly rtfm'd
6:46 AM
deb joined the channel
6:48 AM
bassface joined the channel
6:48 AM
gannetson joined the channel
6:49 AM
BlindHunter joined the channel
6:52 AM
targetron joined the channel
6:52 AM
targetron
Is it possible to use list_display on an Article object
6:53 AM
and when you click on each object to edit in Admin, it display the editing fields of the child class?
6:53 AM
mattmcc
targetron: Well, when you click on an object in the list page it takes you to the edit page.
6:55 AM
jreyno40 joined the channel
6:56 AM
targetron
is the edit page customize for each child class?
6:56 AM
mattmcc
Yes.
6:56 AM
targetron
:D
6:56 AM
Thanks!
6:57 AM
mattmcc
You can edit both the form fields and the template for a given model's change page.
6:57 AM
targetron
phew that makes my life uch easier
6:57 AM
I thought i had to write custom list displays
6:57 AM
kevwilde joined the channel
6:58 AM
mattmcc
list_display is just for controlling which fields appear on the list page.
6:58 AM
7:00 AM
deb has quit
7:01 AM
greg_f joined the channel
7:01 AM
bkuberek joined the channel
7:03 AM
AntiSpamMeta has quit
7:03 AM
AntiSpamMeta joined the channel
7:05 AM
hillaj has quit
7:07 AM
AntiSpamMeta has quit
7:07 AM
AntiSpamMeta joined the channel
7:08 AM
kuter joined the channel
7:08 AM
silverfix joined the channel
7:11 AM
AntiSpamMeta has quit
7:11 AM
liefer has quit
7:12 AM
AntiSpamMeta joined the channel
7:13 AM
hirokiky joined the channel
7:14 AM
hirokiky joined the channel
7:15 AM
kezabelle joined the channel
7:15 AM
skylite joined the channel
7:16 AM
hirokiky
Hello guys. I have a question. makemigrations command with no argument won't create 0001_initial.py file when apps hasnt 'migrations' directory...?
7:16 AM
Ill create directory and initial migration file when I specify the app name to migrate.
7:17 AM
areski joined the channel
7:17 AM
kuter
hirokiky: have you got any output ?
7:17 AM
AntiSpamMeta joined the channel
7:17 AM
that nothing changed or sth ?
7:18 AM
btw you should give app name argument
7:18 AM
hirokiky
kuter: It will say 'No changed detected'.
7:18 AM
fmm.. I know. but theres a tons of app..
7:19 AM
Actually I solved this problem by using 'apps.get_apps()' and little of one-liner.
7:19 AM
someonespace joined the channel
7:19 AM
msc joined the channel
7:19 AM
mattmcc
hirokiky: Not sure what your question is.
7:19 AM
kuter
honestly: so you must have migrations directory
7:19 AM
fleetfox
you need to register apps in installed apps to register them with migrations
7:19 AM
targetron has quit
7:20 AM
ajay2611
skyrz: there are widgets in meta class but they don't support foreignkey/m2m conversoin
7:20 AM
AntiSpamMeta has quit
7:20 AM
msc_ has quit
7:20 AM
AntiSpamMeta joined the channel
7:20 AM
Itkovian has quit
7:21 AM
mattmcc
Well, it needs to be a Python module, not just a directory. So you need app/migrations/__init__.py for makemigrations to pay attention to your app.
7:21 AM
Zeograd joined the channel
7:22 AM
hirokiky
mattmcc: yeah, sorry. just I want to know it's correct behavior or bug.
7:22 AM
ajay2611
Hi, I'm using intermediary models. So i need to customise my modelform from foreignkey to manytomany field.
7:22 AM
Unifox joined the channel
7:22 AM
any help
7:22 AM
hirokiky
fleetfox: Yes. I registered them. but it wont detect (if the app hasnt 'migrations' directory')
7:23 AM
mattmcc
hirokiky: Yeah, that's how migrations determines it should check your app.
7:23 AM
AntiSpamMeta has quit
7:24 AM
hirokiky
mattmcc: you mean.. makemigrations command determines by checking 'migrations' directory is there or not.
7:24 AM
AntiSpamMeta joined the channel
7:24 AM
agemaniac joined the channel
7:24 AM
mattmcc
Not just the directory, it also needs to have the __init__.py in it to make it a Python module.
7:24 AM
hirokiky
fmm. thinking about it. ..my question doesnt make sence.
7:24 AM
oh. you are right.
7:24 AM
module.
7:25 AM
ok guys. I got it. thanks for your answers.
7:25 AM
nikhil_ joined the channel
7:25 AM
benoitbb joined the channel
7:26 AM
nikhil_ has quit
7:26 AM
Ben0 joined the channel
7:27 AM
mpessas joined the channel
7:27 AM
matthiaswahl joined the channel
7:27 AM
AntiSpamMeta has quit
7:27 AM
nikhil_ joined the channel
7:27 AM
timkofu joined the channel
7:28 AM
nikhil_ has quit
7:28 AM
AntiSpamMeta joined the channel
7:28 AM
wgITos joined the channel
7:31 AM
f3lp joined the channel
7:31 AM
SpoutBE has quit
7:31 AM
timkofu
i have a {% block %} inside an {% if %}; this block is only supposed to be overidden if the if evaluates to true, but it gets overridden regardless
7:32 AM
matthiaswahl has quit
7:32 AM
bkuberek joined the channel
7:32 AM
AntiSpamMeta has quit
7:33 AM
AntiSpamMeta joined the channel
7:34 AM
jdo_dk joined the channel
7:34 AM
phretor joined the channel
7:36 AM
aha
7:36 AM
AntiSpamMeta has quit
7:36 AM
mattmcc
Yeah, that doesn't work.
7:36 AM
steve_seagulls joined the channel
7:36 AM
The template engine doesn't know how to conditionally define blocks. So instead, just move your conditions inside the blocks.
7:37 AM
vranac joined the channel
7:37 AM
timkofu
turns out if i test on {% if user.is_authenticated %} it doesnt work, but if i test on {% if user.username %}, it works
7:37 AM
MadHatter42 joined the channel
7:37 AM
AntiSpamMeta joined the channel
7:37 AM
phretor has quit
7:38 AM
kezabelle
yeah, I've always found it odd that that isn't supported, even though the admin does it.
7:38 AM
mattmcc
Does it?
7:38 AM
kezabelle
yeah, has done for as long as I can remember
7:38 AM
7:38 AM
timkofu
mattmcc: yea
7:39 AM
phretor joined the channel
7:39 AM
mattmcc: I did move the condition inside the block though, didnt work but checking on the username did
7:39 AM
AntiSpamMeta has quit
7:40 AM
bmispelon joined the channel
7:40 AM
AntiSpamMeta joined the channel
7:41 AM
mattmcc
Huh.
7:41 AM
steve_seagulls has quit
7:42 AM
timkofu
yep
7:43 AM
hillaj joined the channel
7:43 AM
jas02 joined the channel
7:43 AM
encod3 has quit
7:44 AM
Ben0
7:44 AM
jas02 has quit
7:44 AM
klusias
Hello. I want to add extra option to user object when user logs in. Can i do "request.user.something = 1" ?
7:45 AM
tricoder joined the channel
7:45 AM
LysergicDreams joined the channel
7:46 AM
mattmcc
klusias: You can add things to the user's session.
7:47 AM
kezabelle
Ben0: if that's a fair representation of your code, I'd be inclined to say it could be a regression and should be filed.
7:47 AM
liefer joined the channel
7:47 AM
Ben0: if you can create a test case that passes under 1.7 and fails under 1.8, all the better.
7:48 AM
Itkovian joined the channel
7:48 AM
Ben0
I could try, I did a sandbox project to reproduce the issue.
7:48 AM
kezabelle
a small project with which to reproduce it would also be better than nothing, I suspect :)
7:49 AM
Ben0
ok :)