#django

/

      • foist
        Is it a matter of preference?
      • gratimax is now known as gratimax|away
      • FunkyBob
        to a degree
      • on the model itself at least gives you access to the instsnce you want to set as a value
      • tkimmel has quit
      • foist
        Right, without having to provide it as a param.
      • What's the advantage of putting it in the manager?
      • I guess one would be that I wouldn't have to instantiate the Foo model to create it, I could just use a PK.
      • FunkyBob
        it's available to everything using that manager
      • nimomo has quit
      • foist
        is it possible to do something like foo.bars.create_blue_bar(), where the foo value is known in the method without having to pass it in?
      • aarose joined the channel
      • FunkyBob
        I don't think so
      • ljosberinn has quit
      • dray3 has quit
      • aarose has quit
      • bwreilly joined the channel
      • rizumu has quit
      • stickperson
        i’m going to execute some raw sql to do some calculations, and i’d like to put the output into a django model. can someone check to see if my logic sounds right?
      • realnot has quit
      • realnot joined the channel
      • FunkyBob
        stickperson: where's the raw sql?
      • stickperson
        FunkyBob: not there yet. still working on it. well, a friend is working on it.
      • FunkyBob
        and why not use Weeklystats.objects.raw() ?
      • stickperson
        i was unaware of that
      • consultationist joined the channel
      • FunkyBob
        mostly I wanted to make sure you weren't doing something stupid, like substituting the arguments into the SQL yourself
      • stickperson
        the sql is going to do something along the lines of calculate the change in followers for each social media account and then generate an overall rank based off that
      • i think the only argument i would pass in would be the date
      • if i were to go with WeeklyStats.objects.raw(), i’m assuming that wouldn’t be inside the model, would it?
      • FunkyBob
        even so.. remember to just leave a placeholder in the SQL, and pass the arguments separately
      • consultationist
        Hey everyone - In the admin, I'm trying to save a model and its inline children at the same time. I need to use custom save to populate current running user, date, etc. I need to populate these on both the children and the parent. would I use save_model() or save_formset() or both?
      • FunkyBob
        what do you mean by "inside" the model?
      • stickperson
        FunkyBob: inside the class. for instance, i currently have objects = WeeklyStatsManager() inside the model definition
      • moonkid joined the channel
      • FunkyBob
        so you have a custom manager....
      • well, raw() is a manager method
      • jarshwah joined the channel
      • telex has quit
      • stickperson
        ok, that makes sense
      • drapetomaniac joined the channel
      • timfernando has quit
      • now i’m just trying to think how i can write the sql to get back a WeeklyStats object
      • johnnydiabetic has quit
      • telex joined the channel
      • backthatzachup has quit
      • Esya has quit
      • flax has quit
      • jbitcm- joined the channel
      • flax joined the channel
      • crazydiamond has quit
      • eVRiAL has quit
      • d3c0 joined the channel
      • mstrcnvs has quit
      • yoyoohrho joined the channel
      • scipy53 has quit
      • faldridge has quit
      • gumble has quit
      • jbitcm- has quit
      • mribeirodantas joined the channel
      • autochthon has quit
      • jbitcm- joined the channel
      • FunkyBob
        stickperson: sounds like you want to count grouped by week-of-year
      • stickperson
        FunkyBob: well, right now i’m just thinking how do i get an object out of rawsql?
      • FunkyBob
        select all the fields, raw will take care of it
      • have you not read the docs on raw() ?
      • stickperson
        briefly. i should do that...
      • Debnet has quit
      • timfernando joined the channel
      • how would i save a new instance from raw(). would it be “for person in WeeklyStats.objects.raw(swl): person.save() ?
      • shurik joined the channel
      • bwreilly has quit
      • bwreilly joined the channel
      • gratimax|away is now known as gratimax
      • bearish joined the channel
      • mribeirodantas has quit
      • bearish has quit
      • nimomo joined the channel
      • gratimax is now known as gratimax|away
      • nimomo has quit
      • eka has quit
      • aarose joined the channel
      • dray3 joined the channel
      • backthatzachup joined the channel
      • dirn joined the channel
      • aarose has quit
      • gratimax|away is now known as gratimax
      • mijicd has quit
      • dray3 has quit
      • eka joined the channel
      • johnnydiabetic joined the channel
      • kushal joined the channel
      • timfernando has quit
      • jbitcm- has quit
      • Swambo joined the channel
      • bdmc
        having a problem with my css files. I have them in both projectroot/static/app and projectroot/app/static/app, and I just get 404 errors on all of them. Any suggestions?
      • bogeyd6 joined the channel
      • k_sze[work] joined the channel
      • kushal has quit
      • charettes joined the channel
      • johnnydiabetic has quit
      • dray3 joined the channel
      • FunkyBob
        bogeyd6: is projectroot/static in settings.STATICFILES_DIRS ?
      • is 'app' in settings.INSTALLED_APPS ?
      • bogeyd6
        FunkyBob, no
      • bdmc has quit
      • FunkyBob
        if projectroot/static isn't in STATICFILES_DIRS ... Django won't know to look there
      • if app isn't in installed apps, django wo't know to look there
      • nlh has quit
      • were you expecting Django to just guess?
      • d3c0 has quit
      • gabrielo has quit
      • dray3 has quit
      • bogeyd6 has quit
      • faldridge joined the channel
      • sivy joined the channel
      • bogeyd6 joined the channel
      • gabrielo joined the channel
      • young001 joined the channel
      • faldridge has quit
      • cybered2 has quit
      • jMyles joined the channel
      • gustaf_offline is now known as supergustaf
      • xchu joined the channel
      • yoyoohrho has quit
      • stickperson has quit
      • limbera joined the channel
      • bdmc joined the channel
      • timfernando joined the channel
      • jMyles has quit
      • nlh joined the channel
      • jMyles joined the channel
      • supergustaf is now known as gustaf_offline
      • marcelchastain joined the channel
      • bdmc
        I'm sorry. If anybody answered my question about CSS files, I missed it. I seem to have been disconnected for a while.
      • mabus44_ joined the channel
      • bogeyd6 has quit
      • mabus44 has quit
      • mabus44_ is now known as mabus44
      • FunkyBob
        bdmc: if you never added that path to STATICFILES_DIRS , Django won't know to look there
      • and if your app isn't in INSTALLED_APPS , again, Django won't know to look there
      • HowardwLo
        how do i override the error message from django auth “Please enter a correct username and password. Note that both fields are case-sensitive.”
      • bogeyd6 joined the channel
      • bearish joined the channel
      • JayFK has quit
      • FunkyBob
        HowardwLo: you mean in Forms?
      • juliaelman has left the channel
      • HowardwLo
        FunkyBob: yes, forms
      • msc joined the channel