#django

/

      • kqr
        zanderle, I've never really poked at the admin before (this stuff was mostly created by other people) but I'm starting to realise its potential
      • TeeTime has quit
      • cssko joined the channel
      • TrioTorus has quit
      • jsaq007
        FunkyBob: sorry to hassle you, I'm still learning django any chance you could show me a snippet of what the view for the domain redirect might look like?
      • keimlink joined the channel
      • xBBTx joined the channel
      • zanderle
        jsaq007, you can use a generic view for that
      • tobias47n9e joined the channel
      • jsaq007, sorry
      • keimlink has quit
      • jsaq007, misread :)
      • nevermind
      • jsaq007
        no problem
      • keimlink joined the channel
      • shangxiao has quit
      • timkofu joined the channel
      • FunkyBob
        jsaq007: just a tick
      • jsaq007
        FunkyBob: thanks
      • mikenovikov has quit
      • FunkyBob
      • graingert has quit
      • j1fig joined the channel
      • jsaq007
        FunkyBob: Thanks appreciate that. checking it out
      • shangxiao joined the channel
      • brat197 joined the channel
      • Paradisee joined the channel
      • Paradisee
        why do i get: Exception Value: Invalid block tag: 'show_menu'
      • shangxiao
        Paradisee: Welcome to #django! Please dpaste any relevant code and __full__ tracebacks to allow us to help.
      • Paradisee
      • shangxiao
        nvm
      • :)
      • v0r0nwe
        Paradisee: did you load your templatetags correctly in your template?
      • zanderle has quit
      • Paradisee
      • v0r0nwe: define "correctly"
      • v0r0nwe
        ok, in your template you are not loading your show_menu tag
      • if this tag located in yourapp/templatetags/my_tags.py
      • you can load it via {% load my_tags %}
      • and then use {% show_menu %}
      • Paradisee
        i got this tag in a view
      • i mean, in the view.py module.
      • mikenovikov joined the channel
      • v0r0nwe
        have a look at the required code layout of custom tags: https://docs.djangoproject.com/en/1.8/howto/cus...
      • citizen-stig joined the channel
      • Paradisee
        ok thanks
      • v0r0nwe
        custom tags cannot live 'anywhere'
      • rtpg has quit
      • (of course they could if you override the logic how django finds & loads registered tags :) )
      • Paradisee
        maximum recursion depth exceeded while calling a Python object
      • lovely
      • fgallina joined the channel
      • mkoistinen joined the channel
      • crter has quit
      • v0r0nwe
        don't name it just 'tags' :)
      • Paradisee
        aww
      • mitaka has quit
      • autrilla joined the channel
      • j1fig has quit
      • farn
        you're calling show_menu from nav_bar.html and show_menu includes nav_bar.html. you're building an infinite nested nav bar
      • Paradisee
        v0r0nwe: same error.
      • farn: so i should remove the include, and use show_menu instead?
      • that's what you mean?
      • mkoistinen has quit
      • {% include "main/nav_bar.html" %}
      • i got this inside layout.html
      • BeerLover joined the channel
      • v0r0nwe
        ups
      • sry
      • Paradisee
        \o/
      • Herehere has quit
      • BeerLover
        i am inputting a date and want the epoch time range of that day
      • how to go about it?
      • Paradisee
        if i include show_menu in the layout.html, it is global to all the content, is there a way to only use it inside nav_bar ?
      • shangxiao
        what is an "epoch time range"
      • do you mean seconds?
      • BeerLover
        see if i enter 21/8/2015
      • shangxiao
        epoch means point of origin
      • BeerLover
        i should get the timestamp from 0000 hrs to 2359
      • unix time
      • of that day
      • doismellburning
        FunkyBob: you know what feels like rST's biggest mistake? Not having explicit header level syntax
      • shangxiao
        BeerLover: you're still not making sense :P timestamps and ranges are not the same thing :)
      • BeerLover: it sounds like what your describing is exactly the steps you need to code up anyway
      • BeerLover
        how to initialize a datetime object manually?
      • xterm has quit
      • shangxiao
        datetime.date(2015, 8, 21) ?
      • or datetime.datetime(y, m, d, h, m, s)
      • etc
      • v0r0nwe
        Paradisee: don't include a template if you render the same in a templatetag you include
      • Paradisee: so if you're including the menu template in layout.html, remove {% include.. %} and just use your {% show_menu %}
      • Paradisee: an alternate approach would be to let {% show_menu %} just be an assignement tag, use it like {% show_menu as links %} and after that you can include your nav_bar.html like {% include 'nav_bar.html' with links=links %}
      • which i find more cleaner in most cases (if an inclusion tag includes a big, complex template e.g.) but it just depends on taste, i think
      • Paradisee
        too many information
      • im getting crazy already
      • xterm joined the channel
      • galuszkak joined the channel
      • jiang42 joined the channel
      • jeadre joined the channel
      • galuszkak
        Does anyone use django rest framework? I have a problem, I have field which is PrimaryRelatedKeyField(many=True) and when I send request in JS as FormData() I got error on that field which states "u'Incorrect type. Expected pk value, received unicode.'
      • david89 joined the channel
      • metastableB_ is now known as metastableb
      • shangxiao
        galuszkak: your pk is an int, not a string
      • metastableb is now known as metastableB_
      • jiang42 has quit
      • cestlavie has quit
      • galuszkak
        shangxiao: that's not a problem
      • shangxiao: I tried to request.data['that_field'] = ['4','5'] and I still get this error I tried int also
      • hopthrisC
        is there an official statement about whether you can use or should not use the same name for two different named url patterns?
      • YuanModu has quit
      • galuszkak
        and still when I run serializer.is_valid() it fails. Doesn't matter what will be in QueryDict in request.data
      • shangxiao
        hopthrisC: official statement? not sure. but it means you can't reverse lookup urls then.
      • hopthrisC
        shangxiao: sure you can
      • it works at the moment
      • the docs just don't say 'you have to use unique names'
      • shangxiao
        if you feel there's discrepancies in the docs, submit a ticket
      • hopthrisC
        well, it's not a discrepancy, per se
      • doismellburning
        you don't have to use unique names
      • al-damiri joined the channel
      • in fact, some people like to repeat a name
      • shangxiao
        i've deliberately used the same name as an allauth url
      • doismellburning
        for pseudo-polymorphism
      • shangxiao
        so that i can override it
      • hopthrisC
        doismellburning: but is it documented?
      • shangxiao
        if you have to ask the question, the documentation is buggy, right doismellburning ? :)
      • either that or you didn't read it properly ;)
      • hopthrisC
        shangxiao: either that, or i'm too stupid to read the docs
      • nirakara joined the channel
      • which was my whole reason for asking
      • shangxiao
        i'm curious to know what you mean by "it works at the moment" so you can reverse lookup both urls?
      • doismellburning
        shangxiao: ;)
      • hopthrisC: good question
      • hopthrisC
        shangxiao: yes.
      • shangxiao: ('^foo/$', name='foo'), ('^foo/(?P<id>\d+)/$', name='foo') => both {% url 'foo' %} and {% url 'foo' 123 %} work
      • bukai joined the channel
      • shangxiao
        ah well that's different
      • hopthrisC
        different to what?
      • shangxiao
        i'm guessing this is the pseudo-polymorphism that doismellburning was talking about?
      • hopthrisC
        shangxiao: as i understand it
      • shangxiao
        this seems reasonable
      • doismellburning
        exactly
      • sorry, multitasking
      • shangxiao
        i thought you meant ('^foo/$', name='foo'), ('^bar/$', name='foo')
      • i've used that to override allauth urls before
      • hopthrisC
        shangxiao: right, that would be silly
      • shangxiao
        well, like i said, it has its uses even if it is hacky
      • freakboy_ joined the channel