#django

/

      • amcorreia
        I'm having a weird problem with a form, before I have a field called "promptkey" then I rename to "prompt", but now using firebug I can see both fields inside form..
      • I have removed *.pyc and restarted django
      • royendgel has quit
      • dang`r`us
        well that sounds like you're caching something, somewhere. Hard to tell more from a distance.
      • bahoo
        I have a custom Auth model, which should not have access to the admin :D but, can get into the admin, and sees message “You don't have permission to edit anything.”
      • even though `is_staff()` just returns False, etc. etc.
      • How do I prevent this?
      • reisio joined the channel
      • nimomo joined the channel
      • eperzhand joined the channel
      • gannetson joined the channel
      • amcorreia
        no cache in dev, I changed browser too... and the weird is,,, promptkey have value and prompt no (this is a FK)
      • dang`r`us
      • amcorreia, dunno, what I would probably do is run a grep -Hr promptkey /your/project/root
      • it's gotta be somewhere.
      • felixx has quit
      • kenbolton has quit
      • bahoo
        Ahh I see — I had `is_staff` as a method
      • which, even if it is just `return False`, exists and somewhere returns truthy :D
      • dang`r`us
        kk cool
      • bahoo
        a very subtle pitfall there. huh
      • royendgel joined the channel
      • royendgel has quit
      • I guess that’s a documentation bug; I don’t see any hints in the code that `is_staff` is ever a method https://docs.djangoproject.com/en/1.10/topics/a...
      • daniel2
        In django standards, could I have something like an app called website, and have a separate folder in the app called admin with its own urls.py and views.py, etc?
      • Dafonz
        say I do a pip install app package..and I want to copy the package locally into my django project folder
      • hutch34 joined the channel
      • dang`r`us
        Dafonz, why?
      • Dafonz
        is there a way to do it with pip or is it as easy and copying the folder locally into my project folder?
      • I want to modify the app
      • dang`r`us
        Dafonz, hmm, lemme think what a good option would be in that case. You could probably pin the exact version number and then just edit it
      • morenoh149 has quit
      • Dafonz, it seems to be cleaner to fork on e.g. github and install from there though
      • scutulatium joined the channel
      • Dafonz
        hum I could fork it
      • moldy
        Dafonz: why do you want to copy the package into your project folder?
      • Dafonz
        but I'm not going to include any of the updates from that app
      • I just want it to be part of my overall project
      • jessamynsmith
        I always do what dang`r`us does
      • moldy
        Dafonz: there is editable mode, and i think (not sure) there is an option to tell pip where to put the source for the editable packages
      • neilus joined the channel
      • jessamynsmith
        daniel2: it might be kind of confusing to call something admin
      • daniel2
        that was not the actual name. I was making an example
      • Dafonz
        actually.. maybe I'm asking the wrong question
      • moldy
        Dafonz: but i also do what dang`r`us and jessamynsmith do. i wonder what your usecase here is.
      • Dafonz
        what I'm looking to do is integrate a front-end for user authentication into my app
      • daniel2
        I'd rather do something like to organize it better
      • Dafonz
      • uczekalla has quit
      • dang`r`us
        Dafonz, if you fork you don't have to follow the app's updates
      • you're frozen in time unless you re-pull/merge from the app repo
      • kenbolton joined the channel
      • Dafonz
        no i understand the forking.. but why keep it in a diff repo when I can just keep in my project repo?
      • I'm not seeing the advantages of keeping it seperate?
      • moldy
        Dafonz: it's easier
      • Dafonz: so you should turn the question around: why not :)
      • dang`r`us
        Dafonz, depends on the install process, if it's just some py files you're fine but if e.g. you need to compile a C extension then it becomes a burden, especially when deploying to a remote machine. You can just as well have a $app_root/lib directory and put stuff there, have to add that to PYTHONPATH then
      • moldy
        Dafonz: also, it makes some other things easier, for example running linters over your code or measuring test coverage
      • dang`r`us
        with a fork you have a separate history for your patches to the app/lib
      • Dafonz
        yeah it's not compiled C or anything
      • it's just some .py files
      • moldy
        it's better to have a clean separation between code that is part of your project and libs that your project uses
      • however, if you are sure that you prefer the other way, feel free to do it. it works.
      • Dafonz
        I'm not sure which is why I'm asking :)
      • nimomo has quit
      • just trying to understand
      • moldy
        Dafonz: if i put stuff in my repo, i have to exclude it from various commands
      • there are several tools than run recursively through my project dir and do something with all the files they find.
      • Dafonz
        what I'm actually trying to do is create an app that will allow front-end users to upload photos
      • and display like a photo gallery
      • I couldn't find a convenient django package
      • but what I did find was an django accounts.. so at least I can bookstrap that process
      • bochecha has quit
      • moldy
        often, you don't even have to change the code of an app to extend it
      • you can subclass / wrap / override things. but it depends on the specific situation.
      • mmxx_th joined the channel
      • Dafonz
        hum.. ok
      • dang`r`us
        what moldy said
      • r3g0r989 joined the channel
      • empedokles78 joined the channel
      • r3g0r989 has quit
      • Dafonz
        what's the best practice for something like this case scenario...
      • I instsall a package with pip install ____
      • find out the package doesn't work
      • and come up with a fix
      • moldy
        Dafonz: extend the package by subclassing or such if possible. if it's not possible, fork it and pip install your fork.
      • jessamynsmith
        daniel2: I make lots of apps in their own directories
      • I personally don't like putting them in the project module
      • Dafonz
        I now have a pip install with my fixes...
      • jessamynsmith
        I experimented with putting them in an apps module
      • daniel2: mostly these days I do this: https://github.com/jessamynsmith/eggtimer-server
      • Dafonz
        but it's not cloned from a git repot at all
      • jessamynsmith
        eggtimer is the project module and periods is an app
      • empedokles78
        I installed virtualenvwrapper on my laptop and created a development dir. What are the next steps? (I have my code with a requirments file on git.)
      • ubuntu_aze has quit
      • moldy
        empedokles78: next step is to activate the virtualenv, then proceed as usual: pip install -r requirements.txt
      • daniel2
        So you're just creating non-app directories in the root project directory?
      • empedokles78
        moldy, to make sure: I activate my env, cd into development and clone and then install my requirments, right?
      • veebull_ joined the channel
      • SpeakerToMeat has quit
      • moldy
        empedokles78: sounds right
      • SpeakerToMeat joined the channel
      • gannetson has quit
      • gannetson joined the channel
      • daniel2
        I was talking about putting directories in the app folders.
      • I could probably just organize the views in apps views.py then
      • moldy
        you can create a views/ package inside your app if you want to, that is fine
      • gannetson has quit
      • gannetson joined the channel
      • jessamynsmith
        daniel2: yeah, if I need one for libs or something
      • oh, you can have as many directories as you want in an app
      • that might be a sign it should be multiple apps ,though, if it's so big
      • royendgel joined the channel
      • gannetson has quit
      • daniel2
        The project is an entire website, the apps are for each section of the website. So the "sub apps" I was considering would be for smaller portions of a section.
      • jessamynsmith
        ah
      • yeah, if it works well, make submodules in the apps dir
      • catman22 joined the channel
      • catman22
        Hey, am i new! I can't find any good resources for django. How did you learn Django?
      • jessamynsmith
        catman22: people speak very highly of the django girls tutorial
      • and then after that, do the official django tutorial
      • catman22: if it helps, here is a walkthrough I did for someone to make a basic django project
      • scutulatium has quit
      • sekhmet
        catman22: If you're familiar with Python already, personally I found Django's official tutorial to be a great start
      • moldy
        daniel2: don't nest apps, it's not really supported
      • m8 has quit
      • sekhmet
        catman22: And then using the little polls app you created as a reference point for whatever project you *do* want to work on
      • meisth0th joined the channel
      • meisth0th
        hai o/
      • moldy
        daniel2: multiple python packages (directories) within one app is fine, but don't put an app inside another app
      • catman22
        Alright, is the official tutorial all i need to get started?
      • sekhmet
        catman22: Different things work for different folks, of course. It's a place to start, anyway!
      • jessamynsmith
        catman22: generally, though if you are very new, the django girls tutorial explains more
      • moldy
        catman22: if you know some programming and basic python, yes
      • sekhmet
        catman22: As jessamynsmith mentioned, there's also the django girls tutorial as well.
      • daniel2
        moldy: so do like views/section.py?
      • moldy
        daniel2: yes, if you want to. that is fine.
      • jas02_ joined the channel
      • sekhmet
        catman22: (I haven't personally gone through that one so I can't comment on it, but given its frequency of recommendation in here, I assume it's good. :)
      • daniel2
        thanks
      • meisth0th
        is it possible to filter model objects dynamically like this? Comment.objects.filter(post__created_at__lte=<a property of the comment object itself>)
      • sekhmet
        catman22: Also, my general advice is to have a project you want to implement in mind before you even start. It's much easier to dig down and learn something if you've got a specific goal in mind. "I want to do X, and I will implement it in Django/whatever."
      • catman22
        Thanks guys!
      • Dafonz
        I have an error that i know is in a package I'm using
      • it's telling me this: Exception Value:
      • 'dict' object is not callable
      • but i can't trace the file
      • empedokles78
        modly, now I'm a bit confused the "git clone" worked from the development directory, but If I push to git I always do this from inside the project directory of my djangoproject.
      • Dafonz
        it's telling me its coming from lib/python3.5/site-packages/django/core/handlers/exception.py in inner