#django

/

      • delgiudices
        anth0ny: there’s a group by in sql
      • joshlegs is now known as horsehead
      • horsehead is now known as joshlegs
      • anth0ny
        delgiudices: have you googled it? this looks close: http://stackoverflow.com/questions/12731897/gro...
      • Guddu has quit
      • delgiudices
        anth0ny: thanks yeah i just googled it
      • laceywill joined the channel
      • Nimos joined the channel
      • tbaxter
        Katharsis: well, if it’s auto, it’s not editable. Nor is it nullable.
      • You’re telling it two different things. Or three.
      • grindmodeon joined the channel
      • sargas joined the channel
      • Boogymanx
        Can I use an actual url in urls.py?
      • Nimos
        hi, if do something like a = Model.objects.all() and then a lot of a.filter(), will there be a seperate query for every filter, or will django do that from memory?
      • tbaxter
        Boogymanx: what are you really trying to do?
      • Nimos: querysets are evaluated lazily
      • Boogymanx
        I'm trying to change my user management from what I wrote (which was pretty shitty) to the user management in a third-party app
      • zfjohnny has quit
      • tbaxter
        ok, so do that. how does that relate to your question, though?
      • Boogymanx
        When I'm using my login, which currently is this: url(r'^login/', '/forum/user/login/', name='Login'), I get the error 'str' object is not callable
      • aldnav joined the channel
      • Genitrust has quit
      • ben_vulpes has left the channel
      • err, when I'm trying to log in* not using my login
      • jpadilla has quit
      • tbaxter
        show me the urls
      • MarkusH
        Boogymanx: that can never have worked
      • jdo_dk joined the channel
      • the second argument to url() is invalid
      • Boogymanx
        Well, it doesn't
      • That's why i'm here :p
      • tbaxter: https://dpaste.de/auYi urls.py
      • mossplix has quit
      • MarkusH
        either use 'myapp.view.login_view' as a fully dotted python path to your view (discouraged) or use the actual callable (i.e. from myapp.views import login_view and url(..., login_view, ..)
      • Genitrust joined the channel
      • mikeybisbo has quit
      • mossplix_ joined the channel
      • Audioburn joined the channel
      • Boogymanx
        MarkusH: why is it discouraged? I remember when I first did the tutorial that's how urls were created, although that was still 1.6 or maybe 1.5
      • kanja joined the channel
      • grindmodeon has quit
      • MarkusH
        Boogymanx: we changed the recommendation to use strings in iirc 1.6
      • because you get better error messages when something fails
      • somervillePython joined the channel
      • Boogymanx
        All right, thanks :)
      • b10n1k joined the channel
      • MarkusH
        i.e. the import error is thrown in the urls.py not somewhere in django.utils.importlib or wherever that was
      • rmwdeveloper joined the channel
      • encod3 joined the channel
      • encod3 has quit
      • ForSpareParts has quit
      • Goopyo has quit
      • elit3x_ joined the channel
      • Joffily has quit
      • daniel3 has quit
      • kilae joined the channel
      • hvyk joined the channel
      • hvyk has quit
      • Goopyo joined the channel
      • elit3x_
        Need help filtering a list of products using reverse foreign key field!? What am i doing wrong -> https://dpaste.de/0uoy
      • wicope has quit
      • wicope_ joined the channel
      • daz joined the channel
      • aldnav has quit
      • searchingfortao has quit
      • mossplix_ has quit
      • ForSpareParts joined the channel
      • dting joined the channel
      • Walkman joined the channel
      • cribbage8 joined the channel
      • cribbage8 has quit
      • somervillePython has quit
      • Walkman joined the channel
      • hydraidm801
        when I send a dictionary to render with a form object how do I call it from the template?
      • BigWillie joined the channel
      • tbaxter
        same as any context
      • anth0ny
        This will sound weird: Is it possible to save a model to the DB without calling .save()? I am doing a bit data migration and need to insert models from one DB into another DB. A lot of models have special things that occur on save (such as emailing a user) and I don't want those to run
      • tbaxter
        but paste some code
      • carljm
        anth0ny: use sql instead of the ORM.
      • tbaxter
        carljm: you’re a genius
      • gregmuellegger joined the channel
      • anth0ny
        carljm: yeah, the hard part is following all of the foreign keys, iterating the the django sets would be easier for me
      • hydraidm801
        tbaxter: I tried {{ careerform }} and {% careerform %} neither worked
      • anth0ny
        my lack of sql-fu is holding me back from going raw dog sql
      • Walkman
        anth0ny: you probably don't need Django for this?
      • anth0ny
        Walkman: yeah, I think you're probably correct.
      • carljm
        anth0ny: well, it's ugly as sin, but if you really want to stay in Django-land you can probably do a nasty hack with super()
      • anth_x
        hydraidm801: i'm new at this, but i did something earlier today that sounded like what you want:
      • {% for type, count in sum.items %}
      • <th>{{ type }}</th><td>{{ count }}</td>
      • {% endfor %}
      • anth0ny
        carljm: yeah, okay, sql it is
      • carljm
        anth0ny: SQL isn't all that scary, just takes a bit of study if you're rusty :-)
      • hydraidm801
        oh nevermind I have my url as TemplateView.as_view derp
      • cyphase joined the channel
      • anth0ny
        carljm: yeah, i was having fun with it when i was just duplicating DBs (which was totally doable in the beginning). Now I have sort these models and move them (and all the models referencing them) into a new DB and that's when i start getting dizzy
      • ckpoint
        can a model have two fields that reference the same foreign key in another model? ie. createUser and modifyUser both relate to entries in the usergroup model?
      • anth0ny
        ckpoint: sure, why not?
      • carljm
        well, the good news is, becoming good friends with SQL (and your db server's capabilities generally) allows you to solve a whole range of problems in better ways than if you treat your SQL db as a dumb ORM data store
      • anth0ny
        ckpoint: they're different columns in the DB
      • ckpoint
        anth0ny: thats what I figured, just didn’t want to break anything :) thanks
      • carljm
        ckpoint: Django will ask you to give them different related_name, though
      • anth0ny
        carljm: while this isn't #postgresql, do you have any sql pro-tips to bestow re: following FK relations?
      • joshlegs has quit
      • carljm
        anth0ny: "following FK relations" is pretty vague - might be more helpful if you phrase your problem in SQL terms (i.e. what tables do you have, how are they related, and what data-copying logic do you need to implement)
      • ckpoint
        carljm: where do I specify the related names at?
      • carljm
        ckpoint: in the ForeignKey definition
      • jdo_dk has left the channel
      • cad joined the channel
      • create_user = ForeignKey(User, related_name='created_by')
      • ckpoint
        carljm: found the docs thanks
      • carljm
        or some such
      • actually that naming is all wrong, but whatever, you get the idea
      • ckpoint
        haha
      • by default does FK allow null
      • carljm
        no
      • ckpoint
        k I’ll overide
      • kushal joined the channel
      • pretzeling joined the channel
      • jcerise joined the channel
      • anth0ny
        carljm: okay, so I have a db that has a bunch of instances of a Camera model. I have a lookup table that stores CameraID and ClientID, telling you which camera belongs to which client. Images and Videos have a FK to the camera that took them. Cameras also have a FK to a Location. This goes on and on.
      • carljm: The goal is to iterate through all the Cameras, put every Camera, Image, Video, and Locaton into the proper Client DB. So, I need to follow those relations and insert them in an order that doesn't break dependencies. So, any help tips regarding that?
      • ForSpareParts has quit
      • desophos_ joined the channel
      • Goopyo has quit
      • note: Camera Location doesn't change, if you're wondering why that relationship exists
      • desophos has quit
      • Nizumzen joined the channel
      • joshlegs joined the channel
      • ciurkut joined the channel
      • jaykay joined the channel
      • zfjohnny joined the channel
      • ForSpareParts joined the channel
      • cconnection joined the channel
      • __sjh has quit
      • BigWillie joined the channel
      • radez_g0n3 is now known as radez
      • kenbolton joined the channel
      • cconnection has left the channel
      • cconnection joined the channel
      • cconnection has left the channel
      • DLSteve joined the channel
      • jcerise has quit
      • kenbolton has quit
      • Lobosque joined the channel
      • pretzeling
        I'm getting a "matching query does not exist" and (strangely) can prevent it by printing the instance in question. See http://pastebin.com/J1WJyZpt. Thoughts appreciated...
      • knbk joined the channel
      • Lobosque
        how do I eagerly load all fields of a given Model instance?
      • bepolite has quit