#django

/

      • briian
        hi
      • ive got this login form with action-"{% url 'accounts:login_p' %}" but when i submit the form i get a 302 response for login_p
      • in urls.py i have path('login_p', views.login_p, name='login_p') and in views.py i have a def login_p block
      • what else can i look for?
      • jtiai
        Err.. isn't 302 expected? (moved temporarily)
      • chasonchaffin joined the channel
      • Since your browser should redirect you to Location-field
      • found in headers.
      • briian
        ahh i was thinknig of it differently
      • that makes sense
      • chasonchaffin has quit
      • crCr62U0 has quit
      • crCr62U0 joined the channel
      • drvid
        hey so my custom widget using my own template is coming along nicely... but i'm going through django/forms/widgets/*.html ... and I can't for the life of me find where the label tag is coming from... any ideas?
      • newdimension
        What's the determinig factor in making a Django folder an app? And how is the project foler (the one that includes wsgi.py) different?
      • jakogut joined the channel
      • jtiai
        newdimension: app is any python package that defines AppConfig and is added to INSTALLED_APPS
      • project folder is one that contains stuff that makes up your whole web project, settings and serving stuff. (like wsgi.py)
      • jaykay joined the channel
      • newdimension
        Is it project folder's path hard coded somewhere?
      • *Is the
      • jtiai
        Nope.
      • Though, manage.py has reference to initial settings.
      • newdimension
        How does Django know to load project_folder/admin.py for example?
      • If it's not INSTALLED_APPS
      • jtiai
        It can't.
      • drodger has quit
      • Kangermu joined the channel
      • fellipe joined the channel
      • drodger joined the channel
      • newdimension
        I have project_folder/amdin.py and in that I have admin.site.register(sites.models.Site, SiteAdmin). It works, but I'm trying to figure out why
      • jtiai
        Wonder if admin does something magic with project folder...
      • fellipe
        hi everyone, I'm trying to use it: https://pypi.org/project/django-instagram/ but this poor documentation don't explain WHERE to put the instagram autentication token code. Please help?
      • jtiai
        fellipe: Read the source code?
      • sumitcn has quit
      • xliiv joined the channel
      • newdimension: That shouldn't happen.
      • briian
        i have a line in views.login_p that just prints "Loggin in", that never gets hit though
      • eribol joined the channel
      • uhh
      • fellipe
        jtiai: well, wouldn't be more reasonable if this information were in the documentation?
      • jtiai
        fellipe: You can ask that from that module developers. It's not Django's fault.
      • Wooble
        they're asking a question, not blaming django's core developers :P
      • fellipe
        jtiai: sure, that's right. So, at least, do you have any suggestion of where to put the token?
      • jtiai
        fellipe: Nope. But most probably that can be found from the source code...
      • fellipe
        jtiai: right.. I am trying to find it
      • briian
        i think that is an instagram thing
      • not a django thing
      • the token is for authenticating with instagram's api
      • newdimension
        jtiai: right, not sure why it's working. I double checked my settings, I don't have any referring to project_folder/admin.py
      • *anything
      • jtiai
        fellipe: I've feeling that package is not complete...
      • fellipe
        briian: sure, but it must be where to put the token
      • cmgurba joined the channel
      • briian
        fellipe: there isn't even anything about the token in the github
      • fellipe
        jtiai: hummm. I tried to use as is, and it loads data from specific instagram
      • jtiai
        "A Django application that allows to use some template tags for displaying content from an Instagram public profile.
      • Requirements
      • "
      • So I guess is scrapes just public info by username.
      • briian
        yeah, there is a script for it in the repo, i would look for python specific ones, not django specific ones
      • if you just want a wrapper for the instagram api that is
      • or lib, whatever its called
      • jtiai
        fellipe: Check usage. It actually just reads public crap from any user (amd in example) adn can republish it on your site.
      • Wooble
        fellipe: oddly, the README on github doesn't even mention the access token, which is weird because the last commit is "release 0.3" which is the pypi version with that note.
      • fellipe
        Wooble: yeah, too weird
      • Wooble
        oh, there's a README.md and a README.rst that don't match.
      • laerus has quit
      • fellipe
        anyway, do anyone know a good django-instagram alternative project?
      • jtiai
        Wooble: Isn't it fun?
      • fellipe: That depends what you're looking for.
      • Wooble
        if 1 readme is better than 0, clearly 2 is even better than that.
      • jtiai
        fellipe: https://djangopackages.org/grids/g/instagram/ that can give some pointers to you.
      • fellipe
        jtiai: I just want to get latest images from a public instagram feed
      • jtiai
        fellipe: Well that django-instagram package can do that.
      • You just need to give it username in one tag.
      • (it's completely template tag based solution)
      • Meraki joined the channel
      • fellipe
        jtiai: I tried to put the username but no success
      • Wooble
        FWIW, they do seem to have had an admin page that handled tokens in v0.1, but removed it in 0.2
      • briian
        im so confused
      • Wooble
        I submitted a bug report.
      • fellipe
        I tried with a different instagram username and it worked. The bug happens when use special characters like dots
      • Wooble
        fun.
      • mvanorder has quit
      • briian
        hey guys can someone help me go through this. i followed a tutorial for creating middleware to login, it somehow worked yesterday (i was authenticated, and had to log out to test, no idea how) but is not giving me any kinda errors or feedback or printing where i said to in my code today. this is a paste of everything relevant https://dpaste.de/RvAZ
      • mvanorder joined the channel
      • also to note in urls.py i have path('login_p/') that fails because of trailing slash and POST data, gona switch back to login_p i guess
      • so i followed a tutorial for the middleware and the authentication uses django_auth_ldap.backend.LDAPBackend, but like i said im not even gettin prints from the view functions or anything so im not sure where its going wrong
      • dev console shows that login_p is being accessed and i have the route for it defined
      • drvid
        briian: on line 67 usually reverse takes a view name string so shouldnt it be reverse('login_screen') ?
      • also i usually name my urls with hyphens instead of underscores to differentiate from function names.. but thats just me
      • briian
        drvid: probably, i tried copying a legacy app's configurtaion from my company
      • configuration
      • had to change some stuff since that was 1.10 though but i didnt look too far into it... ill put that change in, but i dont tihnk its the cause here
      • yeah you were right though it was meant to be login_screen, i didnt like the naming they used personally lol
      • drvid
        you can also from django.shortcuts import redirect then return redirect('login-screen') with the url name
      • briian
        cool
      • will do that
      • drvid
        also with regards to the middleware... might just be easier to use @login_required decorator on your views ?
      • finster
        hello! using django 2.1.1. how do I copy model intances from a model in app src to another model in app dst? the overall goal is to move complete models from app src to app dst
      • knbk
        briian: process_view() doesn't get called in new-style middleware. You either have to do the check in __call__ or call process_view() yourself
      • finster
        ideally, auto_now datetime fields would not be updated during the copy process
      • briian
        knbk: isnt that what im doing in response = self.get_response(request)
      • on line 23 in middleware, print(path) gets printed
      • that function is being called
      • newdimension
        Who sets the widget for ModelChoiceField? I don't see where it's being configured https://github.com/django/django/blob/master/dj...
      • msh3iny joined the channel
      • knbk
        self.get_reponse() doesn't call process_view()
      • are you 100% sure the printed path is coming from that line?
      • chasonchaffin joined the channel
      • newdimension: ChoiceField has widget = Select as a class attribute
      • czart has quit
      • briian
        knbk: yes because line 29 gets called
      • which i dont know why.. i think i might be confusing exempt_urls
      • i shoulve included that in the paste, one sec
      • knbk: here are my exempt urls https://dpaste.de/ECpB
      • knbk
        ehm nevermind, it's process_request/response that's no longer called
      • briian
        gotcha, i did see that somewhere on SO as well
      • sorry i dont fully understand whats going on, trying to get this all as i go
      • jessamynsmith has quit
      • i wish i knew how i managed to get authenticated yesterday though
      • RCStef joined the channel
      • newdimension
        knbk: "# This class is a subclass of ChoiceField for purity, but it doesn't actually use any of ChoiceField's implementation." this through me off, so I didn't check ChoiceField when I should have. Thank you
      • *threw
      • chasonchaffin has quit
      • knbk
        briian: so what's LOGIN_URL? EXEMPT_URLS? path?
      • foodSurprise joined the channel
      • foodSurprise
        hi
      • fellipe has quit
      • knbk
        hi
      • krawchyk joined the channel
      • foodSurprise
        so my boss asked me to research django + knockout to work on an existing web application
      • but he said i'll only be doing frontend, and no python stuff. that means i can assume i won't actually need to learn python/get deep into django right
      • kiloreux has quit
      • Meraki has quit
      • RCStef has quit
      • RCStef joined the channel
      • Kangermu
        foodSurprise: really depends on what frontend you're using, but django templates is pretty hefty in and of itself
      • theo_moore has quit
      • foodSurprise
        we're using knockout, and i'm assuming the models are already complete and aren't subject to change
      • i'm just wondering how much time i shuold invest in learning python and innerworkings of django
      • if he said we're only messing with javascript
      • drvid
        foodSurprise: what sort of answer do you want? Look at django templates and maybe views as that is the "front end" side of it
      • Kangermu
        it'd be good to understand the basics at the very least, especially if you ever want to get off the front end
      • foodSurprise
        drvid, thats all i was wondering
      • aossama has quit
      • Kangermu, well i'm still learning sql so he put me on the front end
      • kiloreux joined the channel
      • lomex joined the channel