#django

/

      • iliv
        aha
      • okay, let me try that..
      • it says "Requirement already up-to-date" for both
      • moldy
        your setuptools version looks up-to-date, so maybe it's pip, not sure. i can install aldryn-common==1.0.4 fine here with python 3.5
      • morenoh149
        I want to do .filter(ends_at__gt=datetime.date.today()) but I get a warning "DateTimeField DeliveryWindow.ends_at received a naive datetime (2016-11-30 00:00:00) while time zone support is active." how do I avoid this?
      • BakaKuna has quit
      • Popzi has quit
      • ThisIsJack has quit
      • Popzi1 joined the channel
      • moldy
        iliv: https://dpaste.de/c8V2 i think your pkg_resources is broken. clear pip cache and reinstall=?
      • FinalAngel has quit
      • iliv
        moldy, again, just installed it.. why would it be broken?
      • moldy
        iliv: dunno, interrupted download maybe?
      • hard disk corruption?
      • iliv
        didn't happen :)
      • nope :)
      • Coldblackice joined the channel
      • The-Kid joined the channel
      • BakaKuna joined the channel
      • moldy
        well, it certainly looks very different than on my system... what platform are you on?
      • iliv
        but yeah, let's try that. i don't have any other ideas anyway tbh
      • this is ubuntu xenial lts
      • moldy
        i'm on debian stable, shouldn't be that different. i think.
      • iliv
        16.04.1
      • jas02 has quit
      • moldy
        clear the cache, create a fresh virtualenv and try again
      • encod3 has quit
      • oh btw, is there any chance you installed anything via pip (or easy_install or such) as root, globally?
      • iliv
        no
      • definitely not
      • Popzi1 has quit
      • on this system nothing has been done manually about python
      • it's as good as a freshly installed one
      • Mesaj has quit
      • cybo_ is now known as cybojenix
      • arifin4web has quit
      • waterCreature has quit
      • moldy
        iliv: according to your `tree` output, not everything is in place
      • ah sorry, didn't realized i had scrolled up
      • erratic_P has quit
      • iliv
        no problem
      • _Cyclone_ has quit
      • so to clear pip's cache do I need to simply run: rm -rf $HOME/.cache/pip ?
      • moldy
        yup. the output later will tell you if it worked.
      • _Cyclone_ joined the channel
      • markus-k has quit
      • jas02 joined the channel
      • markus-k joined the channel
      • iliv
        pip (9.0.1)
      • pkg-resources (0.0.0)
      • this is what I see right after I create a new virtualenv
      • Ryanar joined the channel
      • realnot joined the channel
      • jfisk87 joined the channel
      • Ryanar
        hello all, question about __unicode__(self): methods on models, do I need to return a unicode string? e.g. u"something..." or can I just return "something"
      • zathraz has quit
      • hamub joined the channel
      • iliv
        moldy, this is interesting.. I just noticed pkg_resource gets actually uninstalled before aldryn-common is installed: https://dpaste.de/PK3J/raw
      • koniiiik
        Ryanar: Yes, __unicode__ is supposed to return a text string, not a byte string.
      • Ryanar: Even better, put a from __future__ import unicode_literals at the beginning of your module, and only define __str__; if you need Python 2 compatibility, wrap your model classes with the python_2_unicode_compatible decorator.
      • moldy
        iliv: ah, you're using pip-tools? latest version of that one, too? can you show us the .in and .txt files?
      • iliv
        yes, pip-tools and pip-sync (see here, please for more info about this setup https://github.com/djangocon/2017.djangocon.eu)
      • dashdanw joined the channel
      • dashdanw
        hey guys
      • can anyone tell me why I might be getting 405 method not allowed on a modelviewset endpoint?
      • jfisk87 has quit
      • morenoh149 has quit
      • iliv
      • koniiiik
        iliv: One possible difference, if you are using the built-in venv, maybe give virtualenv a try.
      • Arlefreak joined the channel
      • nikivi joined the channel
      • moldy
        iliv: works for me: https://dpaste.de/Ja94
      • iliv
        koniiiik, I use virtualenv:amd64 (15.0.1+ds-3) (Ubuntu Xenial package)
      • moldy
        iliv: no mention of pkg_resources anywhere in my shell output
      • iliv
        moldy, you did it differently
      • moldy
        iliv: interesting, what did you do?
      • Ryanar
        koniiiik so define only __str__(self): methods that return normal strings not unicode objects, put the from __future__ and add the decorator (I am on py 2.7) and it should not cause errors?
      • koniiiik
        Ryanar: If you use from __future__ import unicode_literals, then regular string literals will be text strings (or unicode, in old python terms). The python_2_unicode_compatible decorator will make your classes work on old python 2.
      • iliv
        moldy, hang on, let me read your paste carefully first. it's just that I can see immediately that $ mkvirtualenv djangocon2017 -p $(which python3.5) is something I did not run (nor is it in the projects documentation)
      • koniiiik
        iliv: Maybe you could paste a full session transcript, including how exactly you create the virtualenv.
      • space-wizard joined the channel
      • moldy is a bad body and didn't read the documentation
      • moldy
        *bad boy
      • iliv
        :D
      • kingarmadillo has quit
      • yes moldy, koniiiik that was done differently. I followed projects docs to the letter
      • koniiiik, so to answer your question, what you see here under Run locally section https://github.com/djangocon/2017.djangocon.eu is what I did
      • moldy
        iliv: doesn't hurt to file an issue
      • iliv
        except one step, which seems like an error to me.. cd djangocon-europe and edit djangocon_europe/.env. I bet they simply meant "edit djangocon_europe/.env"
      • Lauxley has quit
      • kingarmadillo joined the channel
      • because if that sequence of steps is executed as they suggest it should be one will end up with virtualenv under djangocon_europe directory
      • and it seems the least likely root directory for virtualenv to me
      • okay, moldy, let me try what you did..
      • u0083 joined the channel
      • Ryanar
        I ma getting a weird error, ValueError: @python_2_unicode_compatible cannot be applied to Registration because it doesn't define __str__(). yet my model does define it
      • FeersumEndjinn has quit
      • FeersumEndjinn joined the channel
      • moldy
        iliv: https://dpaste.de/Y8Jp works (almost) as in the readme for me
      • iliv
        moldy, on line 7 of your paste it says: (djangocon2017)rene@rene ~ $ git clone https://github.com/djangocon/2017.djangocon.eu. Do I read your prompt correctly, you're already in virtual env here (activated)?
      • moldy
        iliv: yes, because of mkvirtualenv
      • liothe joined the channel
      • rixx
        iliv, moldy: the setup steps work for me after upgrading pip to a version supporting pip-sync fwiw
      • moldy
        iliv: however, in the latest paste https://dpaste.de/Y8Jp i did it as in the README and only adjusted what i had to for my system
      • Rialynn has quit
      • so maybe an ubuntu 16.04 issue, i don't have such a system handy to test on
      • u0083 has quit
      • ubuntu_aze joined the channel
      • pachinsv joined the channel
      • Ryanar
        koniiiik so every model class has from __future__ import unicode_literals
      • aossama has quit
      • koniiiik
        Rundll: Not class, module.
      • jfisk87 joined the channel
      • Eh, sorry, Ryanar ^
      • Ryanar
        er that is what I meant
      • every models.py*
      • and every model has an __str__() method and no __unicode__() method
      • koniiiik
        Actually, you might want to put that into every module, not just models, but *shrug*
      • Ryanar
        and every model has @python_2_unicode_compatible on it
      • koniiiik
        Yep, that would be the future-proof way to do things.
      • Ryanar
        but I still am getting a unicode decoding error
      • ajacmac joined the channel
      • ellmetha joined the channel
      • namely my meeting model as part of it's str() lists it's foreign key as part of it 'Meeting in relation to <event>'
      • FeersumEndjinn has quit
      • koniiiik
        Ryanar: Sure, but that error seems to be happening in a completely different place.
      • ajacmac
        the 1.10 tutorial says there should be a urls.py file inside the app folder
      • I don't see one. Why is that?
      • hylje
        there's not by default
      • Ryanar
        hm..
      • its happening on the call redirect(success_url, context={'event': event})
      • ajacmac
        ok, it says create and I just missed it, one of those "I think I know more than I do so I skimmed" problems
      • Ryanar
        and in that views.py file the from __future__ is at the top
      • jccn joined the channel
      • iliv
        moldy, I followed your paste where you followed project's installation instructions and this is the difference between your and my setup: pkg_resources and wheel are installed upon creating of a new virtualenv (https://dpaste.de/p89D)
      • after that I get the error about pkg_resources I mentioned initially
      • ImportError: No module named 'pkg_resources.extern'
      • garrypolley joined the channel
      • ellmetha has quit
      • ellmetha joined the channel
      • koniiiik
        Ryanar: Are you certain that you're passing in the right arguments? For instance, maybe you meant to use redirect(success_url, event=event.id), or something?
      • Ryanar
        ok so my question is, with all the unicode decorators and import futures, if I want to call an objects __str__ method
      • how do I do that?
      • koniiiik
        Ryanar: django.utils.text.force_text
      • renlo joined the channel
      • Ryanar
        with __str__ implemented and the decorator on the model, do I do obj.__str__
      • c17r_ has quit
      • so I do force_text(obj)