#django

/

      • jeffheard has quit
      • stephenmcd joined the channel
      • amaier
        I'm writing a custom command in my django app. I intend to have the application either take text files as commandline arguments -or- as stdin. Is there a clean way to do this?
      • hydraidm801
        yeah ...this is exactly what I need. God I love django
      • so nice to not write php anymore
      • tenmilestereo joined the channel
      • manicouman has quit
      • schinckel
        hydraidm801: Well, the birthday stuff I wrote up may be useful then.
      • v00rh33s joined the channel
      • NomadJim has quit
      • kklimonda
        there is also __range for dates
      • amaier
        Or if I pipe, say, the output of `cat file` to my django custom command, will it end up as an argument automatically?
      • manicouman joined the channel
      • step3profit has quit
      • schinckel
        kklimonda: Yes, but for anniversary calculations that's not quite so useful. :)
      • fisa has quit
      • hydraidm801
        wow thanks a bunch schinckel
      • TaiSHi
        FunkyBob: perhaps it is, yet I still don't understand
      • schinckel
        amaier: You'll probably need to read stdin in that case.
      • FunkyBob
        amaier: basic unix says "no"
      • Brachamul joined the channel
      • NomadJim joined the channel
      • amaier
        Gotcha. Sounds good.
      • TaiSHi
        StackedInLine functionality inside ModelAdmin for same model is driving something like
      • kklimonda
        schinckel: true, depends on what you need
      • TaiSHi
        <class 'acb_lines.admin.ChoiceInLine'>: (admin.E202) 'acb_lines.Choice' has no ForeignKey to 'acb_lines.Choice'.
      • schinckel
        amaier: You could use an argument of '-' to specify 'read from stdin'
      • TaiSHi
        Because it can't reference to itself
      • amaier
        schinckel: good idea.
      • siqi joined the channel
      • samuel has quit
      • Brachamul
        hullo, is this the right place to ask for help ? i'm trying to go through the official tutorial a second time while building a user login app for practice, but i've hit a wall with the urls.py :(
      • the_rat joined the channel
      • jaycedars has quit
      • Guddu joined the channel
      • SmileyChris
        Brachamul: yep, this is the place :) Explain your problem
      • Ariel_Calzada joined the channel
      • dlogs has quit
      • dlogs joined the channel
      • pkimber joined the channel
      • trevortwining has quit
      • Brachamul
        Well, i created a model called "Account", instead of the "Polls" in the tutorial. My app is called "login". I'm trying to create a user profile page, at url "/u/Username". I don't know how to reference the Account username from the url pattern. I've tried : url(r'^(?P<login_name>\d+)/$',...), but that does not work :p
      • siqi has quit
      • radez_g0n3 is now known as radez
      • TaiSHi
        FunkyBob: I think I'll give up, it really drove me nuts and can't seem to find the tick to it
      • SmileyChris
        because \d denotes decimal characters only
      • Brachamul: try \w instead
      • pkimber has quit
      • pkimber joined the channel
      • the_rat has quit
      • Brachamul
        I was trying to find documentation on what all of those strange symbols meant :o
      • Thanks, will try
      • IVplay joined the channel
      • fllr joined the channel
      • Zifre joined the channel
      • HowardwLo
        I'm having trouble finding a python function to give me the 4 closest integers around a number x, with a maximum for x. So if my max for X is 10, then it would return 6,7,8,9. if max is >12, then it'll return 8,9,11,12. Anyone know what thats called?
      • ^ X = 10
      • SmileyChris
      • pkimber has quit
      • pkimber joined the channel
      • Brachamul
        thanks !
      • FunkyBob
        TaiSHi: there's no trick...
      • manicouman has quit
      • HowardwLo
        or maybe its something i have to write on my own
      • FunkyBob
        follow the documentatin... and if you want to dynamically add more forms, you need javascript to inject the new markup
      • leehinde has left the channel
      • SmileyChris
        FunkyBob: i think he expects his personal pet pony to be in admin already with some switch to turn it on
      • mattmcc
        HowardwLo: I wouldn't expect to find a single Python function to do that, no.
      • HowardwLo
        mattmcc: ah, so I'm looking for a unicorn
      • TaiSHi
        FunkyBob: just as InLine models do, I thought there would be a builtin functionality for it
      • munichlinux has quit
      • HowardwLo
        mattmcc: is there a simple way to write that?
      • georgeirwin joined the channel
      • SegFaultAX has quit
      • dray3 has quit
      • SegFaultAX joined the channel
      • a_little_birdie joined the channel
      • tenmilestereo has quit
      • a_little_birdie
        Quick question for you guys.. about Class Based Views.. specifically a ListView. The question is, when my view is being processes, is that an INSTANCE of my view class that is constructed by django (and therefore safe for me to put request-specific data into instance variables), or is it the CLASS object that I am working with? Thanks.
      • FunkyBob
        TaiSHi: there is for supporting repeated forms... there isn't for client-side javascript
      • __machine
        hmm... anyone know why i'd be getting an undefined field django_ct error in haystack when i do SearchQuerySet().all() ? haystack docs say django_ct is a reserved field name for internal use... im not defining an explicit django_ct field anywhere and i assume im not supposed to... ?
      • koirikivi
        a_little_birdie: instance variables are ok
      • FunkyBob
        a_little_birdie: yes, it's a new instance created by the view function each call
      • solidvance has quit
      • georgeirwin has quit
      • a_little_birdie
        Ok great, thanks! Makes things a lot easier
      • FunkyBob
        a_little_birdie: the view function is the one returned by the view factory "as_view"
      • solidvance joined the channel
      • elyezer has quit
      • opalepatrick has quit
      • elyezer joined the channel
      • a_little_birdie
        I have a ListView which also implements a form, and there's some queryset magic too.. and its all working beautifully, but I want to stash some things so I don't have to for example do the same query twice.
      • TaiSHi
        FunkyBob: since there will be no 'fixed' number of rows, I think I'd better avoid growing more nervous and screw it lol :P
      • FunkyBob
        a_little_birdie: stash them on self
      • TaiSHi: you know it's possible, because you've seen it in admin.
      • and I'm quite sure the formset docs treat it somewhat
      • pkimber has quit
      • aberrant joined the channel
      • cottons has quit
      • TaiSHi
        Going to read all formset doc now while I eat
      • jrm2k6 has quit
      • ironfroggy has quit
      • FunkyBob
        so you were all ready to give up.... before you'd even bothered to read the docs?
      • sometimes wonder why I bother helping people...
      • urth has quit
      • a_little_birdie
        LOL well you've saved me a bunch of grief several times now, so THANKS Bob.
      • koirikivi
        because of the smiles?
      • :)
      • urth joined the channel
      • TaiSHi
        FunkyBob: I was reading formsets, I have it open since you gave it to me
      • digicyc has quit
      • but reading the examples (and -trying- to apply them) drove me nuts
      • I am rather jumpy today
      • EyePulp joined the channel
      • Auv joined the channel
      • if there is something that sticked to me from you FunkyBob is reading docs, I tended to avoid them a bit :P
      • munichlinux joined the channel
      • Brachamul
        Continued from my last question, If I write [ url(r'^(?P<account_name>\w+)/$', ], how do I tell django what I mean by "account_name"? What i mean is the "name" column from my "Account" model. Right now i'm getting an AttributeError saying I need an object pk or a slug.
      • willingc has quit
      • FunkyBob
        Brachamul: well, that's in your view
      • Brachamul: oh, you're using a DetailView ?
      • faldridge joined the channel
      • Brachamul
        yes
      • should i not ?
      • prydie joined the channel
      • cybohelicopter is now known as cybodead
      • FunkyBob
        well, you should mention it
      • unbracketed joined the channel
      • Brachamul
        [ url(r'^(?P<account_name>\w+)/$', views.ProfileView.as_view(), name='profile'), ]
      • FunkyBob
        you can control where the DetailField looks for its lookup field and what field on the model it looks for
      • the defautls are just defaults
      • chrisjon_ is now known as jonesy
      • sgambino joined the channel
      • Brachamul
        hmmm, okay !
      • i'll have a look
      • thanks :)
      • Ariel_Calzada has quit
      • Left_Turn has quit
      • ironfroggy joined the channel
      • ChrisMorgan has quit
      • So i should say [ slug_field = name ] then ?
      • FunkyBob
        slug_field = 'name' and slug_url_kwarg='account_name'
      • SmileyChris
        HowardwLo: lambda x, m: range(min(x, m+1)-4, min(x, m+1))[min(-2, m-x-4):] + range(x+1, m+1)[:2]
      • adamduren joined the channel
      • FunkyBob
        SmileyChris: ouch!
      • SmileyChris
        :D
      • HowardwLo
        christ!
      • prydie has quit
      • jeffisabelle has quit