#django

/

      • nownot
        but shouldnt I do a sync all then fake migrate?
      • FunkyBob
        no
      • nownot
        oh ...
      • FunkyBob
        you should do a "syncdb --migrate"
      • however, doesn't eplain the missing table... UNLESS
      • did you switch to a custom user model part-way through the project?
      • nownot
        no
      • so an existing project put on a new server you dont do python manage.py syncdb?
      • FunkyBob
        sure you do... to create all the tables not managed by South
      • dustinfa_ has quit
      • nownot
        yep, thats where it’s failing
      • “FunkyBob: it’s a new server, pulled code from git, version 1.6.5” ….. im setting up a new server with exisitng project. and running syncb I’m getting the error I originally pasted
      • FunkyBob
        and when you tried "manage.py syncdb --migrate" ?
      • limbera
        any ideas why this is giving me a syntax error
      • (python not django)
      • player_id = request.user.player.id if player_id is None
      • nownot
        FunkyBob: Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.
      • FunkyBob
        limbera: no else clause?
      • limbera: this isn't Perl, you know :)
      • limbera
        ahh can you not use that shorthand for plain if
      • has to be else if
      • :P i actually learned perl as my 2nd programming language
      • old habits die hard
      • FunkyBob
        "foo = a if b else c" is valid
      • I do agree it's a convenient syntax...
      • limbera
        so i just have an aempty else clause
      • FunkyBob
        limbera: just do it as two lines... "if player_id is None: player_id = request.user.player_id"
      • limbera
        yeah
      • that's what i had and i tried to refactor it to be more pyhtonic :P
      • all the code examples i see online of django love the old one-liner
      • FunkyBob
        nah
      • clearer is better
      • the one-liner is ok if you have an else clause
      • limbera
        cool cool
      • inerkick joined the channel
      • inerkick has quit
      • could anyone "code review" this snippet, more for style and what not
      • nownot
        FunkyBob: any other thoughts?
      • limbera
        getting the django way slowly i hope! initially i ahd like 6 dictionaries in their to achieve the same thing :P
      • FunkyBob
        nownot: did you try what I suggested?
      • limbera: that's quite a few queries for one value
      • limbera
        isn't it 2 queries?
      • ping Player and ping Performance table?
      • FunkyBob
      • aarose joined the channel
      • why 2 when you can do 1?
      • kaakku joined the channel
      • nownot_ joined the channel
      • limbera
        i seee! thank you
      • nownot_
        sorry about that, my computer likes to disconnect from the router from time to time
      • limbera
        ahh actually
      • i think i remember trying that, and it cant roder by date
      • scratch that, it worked thanks again!
      • nownot has quit
      • nownot_ is now known as nownot
      • leomark joined the channel
      • leomark has quit
      • leomark joined the channel
      • aarose has quit
      • timfernando joined the channel
      • stickperson has quit
      • django_lover joined the channel
      • stickperson joined the channel
      • nownot
        FunkyBob: alright boss, any other thoughts? i have no clue what to look for, I’ve never had syncdb fail on a fresh server
      • Kronuz joined the channel
      • mrafiee joined the channel
      • FunkyBob
        nownot: am still waiting to hear if you tried anything I suggested
      • aribao has quit
      • SmileyChris has quit
      • timfernando has quit
      • pferg has quit
      • limbera
        FunkyBob i remember a while back when you were talking about your django restful package that you said "i should probably imelement CBVs in there"
      • FunkyBob
        nownot: did you try "manage.py syncdb --migrate" ?
      • limbera
        does that mean you don't use the CBVs yourself?
      • FunkyBob
        limbera: not anything based on the CBV that ship with Django, no
      • nownot
        yes, and I posted the response. Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.
      • marcelchastain has quit
      • FunkyBob
        so... it should be good to go, then?
      • nownot
        no, if I try syncb I get error tables dont exist, which is what syncb is supposed to do
      • schinckel
        nownot: What is the error you see?
      • django_lover
        hello all, i have a question. Lets imagine i want to build a view of my store products based on ListView. I want to make the urls as pretty as possible so i want a few query get parameters to appear as part of the url path. There are a few combinations of them. category, category/page, category/sortmethod/order/page, category/subcategory, category/subcategory/page/, category/subcategory/sort_method/order/page. anyone thinks of a way i can do it in a
      • clean way in urls.py?
      • FunkyBob
        django_lover: firstly, stop writing such long lines in IRC...
      • nownot
      • FunkyBob
        django_lover: move page and sort to querystrings
      • fero joined the channel
      • schinckel
        nownot: That's because you are doing a for user in User.objects.all() in your models.py
      • nownot: Don't have code like that at the module level.
      • FunkyBob
        django_lover: so it's /category/subcategory/?page=N&order=M
      • nownot
        holy shitballs …
      • FunkyBob: thanks
      • schinckel
        nownot: dpaste your api/models.py
      • nownot
        i focused on the last line, and didnt see that
      • I know where the error is
      • thanks
      • FunkyBob
        schinckel: oh, sure, it's easy when they do the right thing and paste the traceback! :P
      • backthatzachup has quit
      • schinckel
        Yep.
      • inerkick joined the channel
      • nownot
        FunkyBob: if you want to help me a bit more, https://gist.github.com/anonymous/f7cc00aa7d4ef..., how would I put that in a if table && users exist
      • prabampm joined the channel
      • django_lover
        FunkyBob, I guess a so long message looks like spam. Didn't notice :).
      • FunkyBob
        django_lover: more that it looks like "wall of text"... and is harder to read
      • also, a lot of irc clients will jsut truncate long lines
      • django_lover
        FunkyBob, I guess I need to learn a bit more about IRC usage
      • elbaschid joined the channel
      • FunkyBob
        morning, elbaschid
      • rough weekend?
      • elbaschid
        morning FunkyBob
      • haha, no not a rough weekend
      • ojh has quit
      • just distracted by work for the first half of the day
      • FunkyBob
        poor excuse for neglecting your friends :P
      • leomark has quit
      • elbaschid
        FunkyBob: absolutely true
      • I should stop doing that
      • aribao joined the channel
      • ddssc joined the channel
      • pahko joined the channel
      • nownot has quit
      • pahko has quit
      • django_lover
        FunkyBob, I thought i could look for the sort/order template context variables and call the correct url tag from a custom template tag. do you think it is possible and how good is this design?
      • FunkyBob
        django_lover: huh?
      • why are you putting that work in the template? why not in the view?
      • limbera
        another question of style
      • i have quite a few (about 20-30) aggregate functions defined in my model
      • i have a page that makes use of all 20 of these values
      • in my view i currently have a function that is called those model functions and storing each of the values in context {} and sending that to the template
      • would it be better to have the model create a single summary value that does all the ahrd work, and then the view just calls "get_summary()" or something like that
      • FunkyBob
        probably... can those aggregate functions be called in the same query?
      • limbera
        here is a subset of them
      • i don't understand what that means FunkyBob
      • FunkyBob
        so "yes"
      • stickperson has quit
      • also, stop using tabs in your source
      • limbera
        ok!
      • FunkyBob
      • bearish joined the channel
      • limbera
        ahhhh thank you!
      • i'll group them now into smaller groups
      • maybe 5 or so aggregates in a dictionary
      • ojh joined the channel
      • schinckel
        It may be best just to do all the aggregates in the one query: I think postgres is pretty good about only iterating over rows once. You would want to check that though.
      • Qowface has left the channel
      • opnchaudhary has quit
      • If it's only 10% worse to do all 20 aggregates in one query than just 5, it's still a win whenever you need to do aggregates from multiple groups.
      • limbera
        ah yep makes sense, thanks schnikel
      • gazumps joined the channel