#django

/

      • jefcabatingan joined the channel
      • zaze joined the channel
      • jefcabatingan has left the channel
      • bvlaar has quit
      • Ariel_Calzada has quit
      • lulzplzkthx
        Is there any conceivable way to get the widget of a field in the Django admin to change depending on the content?
      • e.g. A checkbox if the content is either "True" or "False", and a textarea otherwise?
      • AmineZyad joined the channel
      • hackeron
        FunkyBob: heh, ok, good luck with your timezone situation :)
      • lulzplzkthx
        For a specific column of a specific table, of course.
      • bvlaar joined the channel
      • rasca has quit
      • FunkyBob
        lulzplzkthx: there's callbacks in admin to choose the field
      • bvlaar has quit
      • TeeTime has quit
      • chris_99 joined the channel
      • bvlaar joined the channel
      • chris_99
        is django able to do things like running tasks in the background
      • FunkyBob
        chris_99: it's all just Python
      • so, sure...
      • lulzplzkthx
        FunkyBob: So perhaps formfield_for_dbfield, check the db_file.name, then check the value and change the widget that way?
      • FunkyBob
        but you're probably best using a purpose built tool for the job, like ztask or celery
      • lulzplzkthx: sounds like a plan
      • lulzplzkthx
        I wonder why formfield_for_dbfield isn't listed in the docs anyway.
      • chris_99
        cheers FunkyBob :)
      • zaze has quit
      • BertrandBordage joined the channel
      • FunkyBob
        lulzplzkthx: because too many people use Admin instead of writing their own management app
      • zaze joined the channel
      • bvlaar has left the channel
      • bvlaar joined the channel
      • lulzplzkthx
        FunkyBob: it's a part of Admin :S
      • and what's wrong with using Admin?
      • FunkyBob
        Admin is very inflexible... and doesn't implement your business rules
      • lulzplzkthx
        It does look like it may end up not working for me based on how much customization I'd have to do.
      • Yeah.
      • I guess I should just treat it as a nice scaffolding agent.
      • embs joined the channel
      • FunkyBob
        eventually the limitations of Admin start influencing your app/schema design... which is BAD
      • lulzplzkthx
        The limitations are mostly a pain in the ass.
      • As in, I'm basically going to end up rewriting Admin.
      • FunkyBob
        exactly
      • lulzplzkthx
        It would probably be easier to go my own route.
      • FunkyBob
        I have, amongst 1e6+1 other backlogged tasks, a plan to build a more finely layered Admin/Management Console framework
      • bvlaar has quit
      • Tacults has quit
      • basically, a framework upon which yu could easily rebuild admin... but also more flexible custom management console
      • bvlaar joined the channel
      • lulzplzkthx
        The unfortunate part is it makes the Sites management a little big uglier to go to my own route.
      • BertrandBordage
        Hello everyone!
      • lulzplzkthx
        As you won't be able to manage multiple sites at once that way.
      • Err, I guess you could.
      • FunkyBob
        morning, BertrandBordage
      • lulzplzkthx
        Alright, well I'm AFK for a bit.
      • zaze has quit
      • zaze joined the channel
      • Tacults joined the channel
      • BertrandBordage
        is this normal if we can't include two patterns using the same namespace?
      • FunkyBob
        BertrandBordage: you mean url patterns?
      • BertrandBordage
        yes
      • FunkyBob
        BertrandBordage: what makes you say that?
      • BertrandBordage
        if I do this : url('', include(something, namespace='myapp')),
      • and the line after :
      • url('', include(something_else, namespace='myapp')),
      • what's in something_else is ignored
      • chris_99 has quit
      • this may be a design decision
      • kit has quit
      • FunkyBob
        can't say without seeing the patterns it should be hitting
      • BertrandBordage
        let's say you have 3 urls.py, 1 for your project, and 2 for a single application
      • in the project urls.py, doing:
      • mgrouchy joined the channel
      • danfairs has quit
      • patterns('', url('path1', include(myapp.urls1, namespace='myapp'), url('path2', include(myapp.urls2, namespace='myapp')
      • bchhun has quit
      • leads to myapp.urls2 being ignored…
      • whizmob has quit
      • willer_ has quit
      • FunkyBob
        having never used the namespace keyword, I feel I'm unable to help
      • siebo has quit
      • BertrandBordage
        ok
      • FunkyBob
        bradleyayers would possibly be a better person to ask
      • schinckel
        I think using the same namespace is probably not a good idea.
      • FunkyBob
        but as he lives in a state that's currently flooded... he may not have net access
      • BertrandBordage: perhaps create a wrapper patterns list, and namespace that?
      • BertrandBordage
        FunkyBob: ok, thanks
      • FunkyBob: of course, but it would be ugly
      • zaze has quit
      • FunkyBob
        only as ugly as two includes having the same namespace is illogical
      • marsam has quit
      • BertrandBordage
        the idea is that urls are automatically builded to avoid having to define the same kind of urls and views every time
      • cebor joined the channel
      • schinckel
        (I was about to say "there was something about this on django-dev", but I think that was you)
      • BertrandBordage
        I wanted to build the namespace from the model app_label
      • yes, that was me :o)
      • so what I said wasn't quite accurate
      • Ariel_Calzada joined the channel
      • Ariel_Calzada has quit
      • milind joined the channel
      • zaze joined the channel
      • Ariel_Calzada joined the channel
      • in fact, the application urls.py is like this:
      • urlpatterns = patterns(b'',
      • url(br'', include(ExampleViewSet().urls)),
      • url(br'', include(TweetViewSet().urls)),
      • )
      • schinckel
        Maybe using a callable or object for the patterns might work. A bit like how the admin works.
      • Ariel_Calzada has quit
      • bvlaar has quit
      • BertrandBordage
        Yes, but I guess the admin is building all its patterns at the same time
      • tbaxter joined the channel
      • mattmcc
        Yeah, if you construct pattern names like <app_label>_<model_name>_add/list/detail then you don't need to worry about namespaces.
      • bvlaar joined the channel
      • Spark23 has quit
      • Spark23 joined the channel
      • BertrandBordage
        so, I guess I have to drop the idea of automatically specifying a namespace
      • (if I want to keep this architecture)
      • cebor has quit
      • mattmcc: yes, but it's better for understanding to keep the same syntax as the admin (admin:model_create)
      • mattmcc
        Eh, I disagree.
      • The purpose of URL namespaces is to allow multiple instances of one app to coexist.
      • BertrandBordage
        I may have misunderstood how namespace should be used :\
      • mattmcc
        And that's not the problem you're addressing here.
      • BertrandBordage
        yes
      • I understand now
      • md4d joined the channel
      • thanks FunkyBob, schinckel and mattmcc − I'm getting back to work :)
      • md4d has quit
      • hyperair joined the channel
      • Raisins has quit
      • bvlaar has quit
      • F1skr has quit
      • bvlaar joined the channel
      • theslow1 has quit
      • CRF_H0M3R
        Someone can help me with this traceback? http://dpaste.org/i1qHc/ I'm trying to do tests and I'm getting AttributeError: type object 'Create' has no attribute 'objects'
      • Raisins joined the channel
      • FunkyBob
        CRF_H0M3R: and which line of the paste is line 45 of test_vciews_create ? because what's there doesn't match the test_save in your paste
      • cramm has quit
      • smill has quit
      • BertrandBordage
        the line is written below: it's line 11 in this snippet
      • CRF_H0M3R
        FunkyBob: line 11
      • BertrandBordage
        oh, I noticed the difference ;)
      • CreateForm != Create
      • FunkyBob
        exactly
      • CRF_H0M3R: the code in the error doesn't match the code in your paste
      • so either you pasted the wrong file/lines... or your error is using old code?
      • dirn joined the channel
      • Ariel_Calzada joined the channel
      • theslow1 joined the channel