#django

/

      • grafa joined the channel
      • tim_heap has quit
      • dhanush joined the channel
      • unknwn- joined the channel
      • holler_ has quit
      • snollux joined the channel
      • 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?
      • jtiai
        snollux: It's returned with an object from create call.
      • snollux: obj = ModelName.objects.create() and then obj contains your newly created object.
      • Alina-malina has quit
      • snollux
        wonderful!
      • thanks jtiai
      • jtiai
        I bet it was documented as well... :)
      • Knyght
        pfft, who reads that stuff
      • snollux
        haha fair enough
      • i've been justly rtfm'd
      • deb joined the channel
      • bassface joined the channel
      • gannetson joined the channel
      • BlindHunter joined the channel
      • targetron joined the channel
      • targetron
        Is it possible to use list_display on an Article object
      • and when you click on each object to edit in Admin, it display the editing fields of the child class?
      • mattmcc
        targetron: Well, when you click on an object in the list page it takes you to the edit page.
      • jreyno40 joined the channel
      • targetron
        is the edit page customize for each child class?
      • mattmcc
        Yes.
      • targetron
        :D
      • Thanks!
      • mattmcc
        You can edit both the form fields and the template for a given model's change page.
      • targetron
        phew that makes my life uch easier
      • I thought i had to write custom list displays
      • kevwilde joined the channel
      • mattmcc
        list_display is just for controlling which fields appear on the list page.
      • deb has quit
      • greg_f joined the channel
      • bkuberek joined the channel
      • AntiSpamMeta has quit
      • AntiSpamMeta joined the channel
      • hillaj has quit
      • AntiSpamMeta has quit
      • AntiSpamMeta joined the channel
      • kuter joined the channel
      • silverfix joined the channel
      • AntiSpamMeta has quit
      • liefer has quit
      • AntiSpamMeta joined the channel
      • hirokiky joined the channel
      • hirokiky joined the channel
      • kezabelle joined the channel
      • skylite joined the channel
      • hirokiky
        Hello guys. I have a question. makemigrations command with no argument won't create 0001_initial.py file when apps hasnt 'migrations' directory...?
      • Ill create directory and initial migration file when I specify the app name to migrate.
      • areski joined the channel
      • kuter
        hirokiky: have you got any output ?
      • AntiSpamMeta joined the channel
      • that nothing changed or sth ?
      • btw you should give app name argument
      • hirokiky
        kuter: It will say 'No changed detected'.
      • fmm.. I know. but theres a tons of app..
      • Actually I solved this problem by using 'apps.get_apps()' and little of one-liner.
      • someonespace joined the channel
      • msc joined the channel
      • mattmcc
        hirokiky: Not sure what your question is.
      • kuter
        honestly: so you must have migrations directory
      • fleetfox
        you need to register apps in installed apps to register them with migrations
      • targetron has quit
      • ajay2611
        skyrz: there are widgets in meta class but they don't support foreignkey/m2m conversoin
      • AntiSpamMeta has quit
      • msc_ has quit
      • AntiSpamMeta joined the channel
      • Itkovian has quit
      • 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.
      • Zeograd joined the channel
      • hirokiky
        mattmcc: yeah, sorry. just I want to know it's correct behavior or bug.
      • ajay2611
        Hi, I'm using intermediary models. So i need to customise my modelform from foreignkey to manytomany field.
      • Unifox joined the channel
      • any help
      • hirokiky
        fleetfox: Yes. I registered them. but it wont detect (if the app hasnt 'migrations' directory')
      • mattmcc
        hirokiky: Yeah, that's how migrations determines it should check your app.
      • AntiSpamMeta has quit
      • hirokiky
        mattmcc: you mean.. makemigrations command determines by checking 'migrations' directory is there or not.
      • AntiSpamMeta joined the channel
      • agemaniac joined the channel
      • mattmcc
        Not just the directory, it also needs to have the __init__.py in it to make it a Python module.
      • hirokiky
        fmm. thinking about it. ..my question doesnt make sence.
      • oh. you are right.
      • module.
      • ok guys. I got it. thanks for your answers.
      • nikhil_ joined the channel
      • benoitbb joined the channel
      • nikhil_ has quit
      • Ben0 joined the channel
      • mpessas joined the channel
      • matthiaswahl joined the channel
      • AntiSpamMeta has quit
      • nikhil_ joined the channel
      • timkofu joined the channel
      • nikhil_ has quit
      • AntiSpamMeta joined the channel
      • wgITos joined the channel
      • f3lp joined the channel
      • SpoutBE has quit
      • 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
      • matthiaswahl has quit
      • bkuberek joined the channel
      • AntiSpamMeta has quit
      • AntiSpamMeta joined the channel
      • jdo_dk joined the channel
      • phretor joined the channel
      • aha
      • AntiSpamMeta has quit
      • mattmcc
        Yeah, that doesn't work.
      • steve_seagulls joined the channel
      • The template engine doesn't know how to conditionally define blocks. So instead, just move your conditions inside the blocks.
      • vranac joined the channel
      • timkofu
        turns out if i test on {% if user.is_authenticated %} it doesnt work, but if i test on {% if user.username %}, it works
      • MadHatter42 joined the channel
      • AntiSpamMeta joined the channel
      • phretor has quit
      • kezabelle
        yeah, I've always found it odd that that isn't supported, even though the admin does it.
      • mattmcc
        Does it?
      • kezabelle
        yeah, has done for as long as I can remember
      • timkofu
        mattmcc: yea
      • phretor joined the channel
      • mattmcc: I did move the condition inside the block though, didnt work but checking on the username did
      • AntiSpamMeta has quit
      • bmispelon joined the channel
      • AntiSpamMeta joined the channel
      • mattmcc
        Huh.
      • steve_seagulls has quit
      • timkofu
        yep
      • hillaj joined the channel
      • jas02 joined the channel
      • encod3 has quit
      • Ben0
        Hello, should I submit an issue: https://gist.github.com/benjaminrigaud/e646f51e... ?
      • jas02 has quit
      • klusias
        Hello. I want to add extra option to user object when user logs in. Can i do "request.user.something = 1" ?
      • tricoder joined the channel
      • LysergicDreams joined the channel
      • mattmcc
        klusias: You can add things to the user's session.
      • 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.
      • liefer joined the channel
      • Ben0: if you can create a test case that passes under 1.7 and fails under 1.8, all the better.
      • Itkovian joined the channel
      • Ben0
        I could try, I did a sandbox project to reproduce the issue.
      • kezabelle
        a small project with which to reproduce it would also be better than nothing, I suspect :)
      • Ben0
        ok :)