#django

/

      • stickperson joined the channel
      • daschel
        you can do that in either, but i was specifically thinking about the templates
      • eagle2990
        daschel: this are the models http://pastebin.com/bGZBpNvc
      • meridiandev
        eagle2990: put briefly, views define what you make available. templates define how you use / show it.
      • aarose joined the channel
      • https://github.com/django/django/tree/master/dj... these are the generic CBVs you're using, if it helps.
      • eagle2990
        meridiandev: i mean...i understand what i do...a little bit, but for this joining things...i'm kind of lost
      • meridiandev
        think of it less as joining and more as presentation.
      • warrenjin has quit
      • wrong paradigm. or something.
      • honestemu has quit
      • warrenjin joined the channel
      • eagle2990
        i just saw that and i'm like O.o
      • meridiandev
        daschel: any handy references on here's context/tags/etc. for beginners?
      • warrenjin has quit
      • there has to be a better way for eagle than my awesome approach of caffeine and print statements when i was sorting this stuff out.
      • sgambino has quit
      • keimlink joined the channel
      • daschel
        eagle2990, https://dpaste.de/TWqF see if that makes any sense
      • aarose has quit
      • Sweetman has quit
      • klusias
        how can i properly append decorator to admin.ModelAdmin function (custom view function)...decorator takes first parameter (self, not request, as it is normal in view functions)?
      • daschel
        meridiandev, nothing that I can think of specifically on those topics other than stackover flow and google :)
      • meridiandev
        would you agree the best way might be to start with a TemplateView and make it do List/Detail first to learn the basics?
      • eagle2990
        meridiandev: oh...now i get it...i mean...i thought that i had to do that for the 2 or more objects join
      • sPiN- joined the channel
      • meridiandev
        don't overthink things : )
      • Sweetman joined the channel
      • (that's how i wound up accidentally making half a CMS.)
      • iggy joined the channel
      • daschel
        meridiandev, your last comment seems reasonable, but im bouncing between a couple conversations, watching a movie, and am a bit less-than-sober, so it's hard to know for sure
      • eagle2990
        daschel: i understoodthat so the commented lines will be in the views.py and obviously the rest in the template
      • softinio_ joined the channel
      • frege
        I wrote this permission class but it doesn't address my problem https://gist.github.com/pazooki/103bc659e488121...
      • can someone help me please?
      • eagle2990
        don't think that i'm not reaserching....i have like 20 tabs reading at the same time xD
      • daschel
        eagle2990, well if you're using generic views, passing the context variables will be slightly different
      • eagle2990, we've all been there. we're here to help
      • frege
        it let everyone see all the user objects , I want only the owner of that object to be able to see its obj
      • kushal has quit
      • daschel
        no need to worry :0
      • :)
      • frege, i'll try to help you as soon as i can
      • meridiandev has quit
      • softinio has quit
      • eagle2990, to clarify, ProjectNoteList(generic.ListView) is the view we're working with right
      • ?
      • matason has quit
      • nedbat joined the channel
      • eagle2990
        daschel: yeah, but i'm willing to change it...i just chose it for a quick dev
      • daschel
        ok
      • so what is the focus point of this page
      • is it a single project or a list of projects?
      • lvella joined the channel
      • kushal joined the channel
      • frege
      • eagle2990
        daschel: the idea is that in that page you can see the details of the project (like name, description...) and also the notes, probably later i will join another model, but the idea is to join everything is just one thing...like some sort of dashboard
      • lvella
        I am trying to migrate do Django 1.7, but the my initial fixtures for auth_group table no longer works.. it seems that my app models and fixtures are loaded before django auth models are created
      • daschel
        ok, so on the dashboard you want a series of objects that will remain more or less constant?
      • stickperson has quit
      • constant between pages i mena
      • mean
      • scott_w joined the channel
      • eagle2990
        yes
      • daschel
        ok
      • well, what we want to do is use a context processor to pass these "standard" context objects to the view, then simplify your generic view. the point of generic views is to not have to write a bunch of code.
      • context processors aren't as scary as they sound
      • it's just a helper function that returns a context variable
      • scott_w has quit
      • generic views automatically receive all context data defined in your context processor list
      • so
      • in your app folder, create a file...let's be creative...call it....context_processors.py
      • eagle2990
        done
      • honestemu joined the channel
      • honestemu
        daschel: When I tried the solution you suggested, I get the error: blog is not a namespace. I think that has to do with how I am referring to the view in my template. Right now, I want the index view to show links to all of the blog posts I've ever created. They should link to the detail view of each blog post. I am identifying them based on the slug. So, I create the links using the following url function: <li><a href="{% url '
      • eraldo has quit
      • daschel
        eagle2990, ok, now define a function (it doesn't matter the name, but pick something that makes sense) and just put "pass" as the first line so we can get things working.
      • eagle2990, now in settings.py, you need to modify TEMPLATE_CONTEXT_PROCESSORS. add your new context processor here, like "<app_name>.context_processors.<function_name>"
      • scott_w joined the channel
      • honestemu, you can just delete where it says name="blog" in the urls.py
      • nethop joined the channel
      • wait, im confusing myself. i dont know who im talking to anymore
      • eagle2990
        daschel: ok i'm done
      • honestemu has quit
      • burhan joined the channel
      • daschel
        ok, wel honestemu left, so that'll make things easier
      • ok, now what do you want to display in each view? or in other words, what do you want to pass to your dashboard?
      • heihei has quit
      • timtim joined the channel
      • burhan
        its been a while since I visited the front end part of django, is there an application that can handle multiple user profiles + social authentication? I am finding one or the other, but not one that does both.
      • maybe I am missing something.
      • honestemu joined the channel
      • naro joined the channel
      • eagle2990
        right now a project detail and that it loads all the notes related to it
      • daschel
        burhan, allauth
      • timtim
        is there any limitations to naming attributes in your model when it comes to using get_FOO_display() ?
      • daschel
        eagle2990, wait, so the dashboard doesn't remain constant between projects?
      • burhan
        I saw that, it will take care of the authentication; but not custom user profiles, I still have to handle that myself.
      • wenzhixue joined the channel
      • timtim: what's the problem you are facing?
      • mmcardle joined the channel
      • eagle2990
        yeah...it's the same, as in if you pick project 1, it will show notes related to project 1
      • if you pick 2, you pick notes related to project 2
      • timtim
        i have attributes with underscores which return nothing when i do {{ partner.get_my_attribute_display }} but {{ partner.get_status_display }} works
      • honestemu has quit
      • maryokhin joined the channel
      • if i do {{ partner.my_attribute }} it prints out the raw answer but in my model i'm following the examples of using tuples to do CharField
      • maryokhin has left the channel
      • wait, i'm pretty sure i'm an idiot
      • yeah my_attribute isn't doing the tuple thing for multiple choices so there is nothing to return
      • ekke85 joined the channel
      • stickperson joined the channel
      • thanks burhan ! if only i had asked earlier and thought about it i could have saved some time
      • sedeki has quit
      • neruson is now known as zz_neruson
      • meisth0th has quit
      • Debnet has quit
      • hardwire has quit
      • zz_neruson is now known as neruson
      • elyezer has quit
      • nedbat has quit
      • NBhosting has quit
      • aagaard has quit
      • bhitov has quit
      • ehmatthes has quit
      • hardwire joined the channel
      • nethop has quit
      • subbero has quit
      • ticketbot has quit
      • ekke85 has quit
      • untitaker_ joined the channel
      • nethop joined the channel
      • Sweetman has quit
      • kushal has quit
      • wenzhixue has quit
      • EcoGiko has quit
      • grafa has quit
      • untitaker has quit
      • TodPunk has quit
      • amittbhardwj has quit
      • zlalanne joined the channel
      • benregn has quit
      • subbero joined the channel
      • nedbat joined the channel
      • subbero has quit
      • subbero joined the channel
      • EcoGiko joined the channel
      • EvilDMP joined the channel
      • nedbat has quit
      • TodPunk joined the channel