April 2, 2012
← next day
previous day →
- # 00:00 <atula> you have that filter ?
- # 00:00 <SmileyChris> atula: this looked like good code: http://stackoverflow.com/a/1414046
- # 00:00 <atula> cool.
- # 00:00 <atula> SmileyChris: do you see any issue of me approaching the problem this way
- # 00:00 <atula> ?
- # 00:00 <SmileyChris> atula: nope
- # 00:00 <atula> cool.
- # 00:00 <atula> thank you
- # 00:00 <atula> I got to run
- # 00:00 <atula> wife is getting mad of waiting :P
- # 00:00 <SmileyChris> understand :)
- # 00:00 <atula> THANK YOU again, SmileyChris
- # 00:00 <ionelmc> anyone seen an "order respecting" ModelMultipleChoiceField like field ?
- # 00:00 <SmileyChris> ionelmc: you're going to make FunkyBob cry :D
- # 00:00 <SmileyChris> he's got some ticket pushing for that
- # 00:00 <SmileyChris> you fix it, add tests and docs, then mark as read for checkin first :)
- # 00:00 <ionelmc> is there a patch ?
- # 00:00 <ionelmc> where the ticket
- # 00:00 <apollo13> you mean "read before checkin" right? *runs*
- # 00:00 <ionelmc> hahah
- # 00:00 <SmileyChris> ready
- # 00:00 <apollo13> ah who'd have imagined that ;)
- # 00:00 <SmileyChris> actually, his is specific to having intermediary sorting on the through table
- # 00:00 <SmileyChris> modelmultiplechoicefield should respect the order of the queryset it receives
- # 00:00 <ionelmc> SmileyChris: i can't find the ticket
- # 00:00 <ionelmc> looked here https://code.djangoproject.com/query?description=~ModelMultipleChoiceField&col=id&col=summary&col=owner&col=type&col=status&col=component&order=priority
- # 00:00 <ionelmc> does ModelMultipleChoiceField.clean really need to return a queryset?
- # 00:00 <ionelmc> can i get away with a list?
- # 00:00 <ionelmc> FunkyBob: you there? :P
- # 00:00 <SmileyChris> ionelmc: what do you actually mean by order respecting?
- # 00:00 <SmileyChris> i was assuming you meant for display
- # 00:00 <SmileyChris> but it sounds like you're after storing it in a specific order
- # 00:00 <SmileyChris> in which case, you can't just use a standard m2m
- # 00:00 <ionelmc> i mean i want the m2m entries to be saved in the order i have send them in the request
- # 00:00 <ionelmc> this looks like the problem:
- # 00:00 <ionelmc> qs = self.queryset.filter(**{'%s__in' % key: value})
- # 00:00 <ionelmc> pks = set([force_unicode(getattr(o, key)) for o in qs])
- # 00:00 <ionelmc> this will lose the order in value
- # 00:00 <SmileyChris> ionelmc: it doesn't make sense that it would save the order anyway
- # 00:00 <ionelmc> don't question my insane problem :P
- # 00:00 <ionelmc> they are saved in that order
- # 00:00 <ionelmc> so can i return a list?
- # 00:00 <ionelmc> instead of qs
- # 00:15 <SmileyChris> you've seen the source - not with that widget
- # 00:15 <yeshuah> Anyone experienced problems with "psycopg2.InterfaceError: connection already closed" after upgrading to Django 1.4? If I downgrade - the problem dissapears
- # 00:15 <ionelmc> SmileyChris: but seriously, what ticket did you talk about?
- # 00:15 <SmileyChris> ionelmc: it wasn't related to what you want anyway, and i don't have a reference off the top of my head
- # 00:15 <ionelmc> oh damn
- # 00:15 <buo> hello everyone, I managed to display in the admin's change list, for a model, the name of the superuser who has created each object. The problem is that this works fine in my test server, but in a production server always returns one superuser (and this is not the creator for each object, neither the last superuser who modified something)
- # 00:15 <ionelmc> looks like the list is converted to a set in ManyRelatedManager._add_items
- # 00:15 <ionelmc> and looses the order :(
- # 00:15 <ionelmc> buo: show the code
- # 00:15 <antihero> does this look ok to you? http://paste.pocoo.org/show/574739/ SmileyChris
- # 00:15 <buo> ionelmc, http://dpaste.org/iGXyq/ this goes inside the model
- # 00:30 <SmileyChris> antihero: looks a bit weird really
- # 00:30 <SmileyChris> antihero: you should use the storage to save the file rather than just writing it yourself
- # 00:30 <buo> ionelmc, with or without the action_list.reverse() line, works the same (in both servers)
- # 00:30 <buo> I mean, works fine in test server, bad in production server
- # 00:30 <ionelmc> is that a modeladmin method?
- # 00:30 <ionelmc> if yes then http://dpaste.org/swwOV/
- # 00:30 <ionelmc> http://dpaste.org/OW3DP/
- # 00:30 <antihero> SmileyChris: Yeah? Got a manual entry for that?
- # 00:30 <antihero> SmileyChris: The issue is that I'm uploading the files without assigning them to a model, but then will be assigning them to a model (which is then assigned to a product) once a product is created
- # 00:30 <buo> ionelmc, is a model method, the full model -> http://dpaste.org/rLgPu/
- # 00:30 <ionelmc> buo: so you're using it in list_display or ?
- # 00:30 <yeshuah> updating my wsgi.py files to the new standard format seemed to fix the issue
- # 00:30 <ionelmc> buo: what change_message do the logentry objects have on production?
- # 00:30 <buo> ionelmc, the code in both (models.py and admin.py) for the app: http://dpaste.org/RKvu2/
- # 00:30 <ionelmc> that might indicate why the user is worng (just show it via creado_por)
- # 00:45 <buo> ionelmc, change_message returns empty string
- # 00:45 <SmileyChris> antihero: https://docs.djangoproject.com/en/1.4/ref/files/storage/#django.core.files.storage.Storage.save
- # 00:45 <buo> ionelmc, for the record test server: django 1.3.1 & production server: django 1.2.5, both with python 2.7
- # 00:45 <raj> I wanna make a link to a picture download the picture instead of open it in the browser
- # 00:45 <raj> apparently I have to change the content-type header to attachment for the link?
- # 00:45 <mattmcc> raj: No, you're looking for Content-Disposition.
- # 00:45 <raj> oh
- # 00:45 <raj> what's the difference?
- # 00:45 <mattmcc> The content type isn't different just because you're suggesting to the client that the resource be downloaded instead of displayed.
- # 00:45 <sartan> i've been trying a few of these rich text editors under django but i can't get any of them installed anywhere. the common issue seems to be the django admin interface refusing to load redefined js from the model
- # 00:45 <sartan> class Admin: js = ('js/whatever'); - my webserver doesn't see any requests to it and inspecting the html doesn't show any discernable change
- # 00:45 <ionelmc> buo: wow, why do you have different django versions?!
- # 00:45 <raj> mattmcc, I'm sorry, I'm not sure what you mean
- # 00:45 <raj> you're saying it's not different?
- # 00:45 <django_noob> hello all
- # 00:45 <django_noob> i want to have multiple choice actions on form submit
- # 00:45 <django_noob> e.g save and finish
- # 00:45 <django_noob> and save and continue
- # 00:45 <ionelmc> django_noob: use multiple submit buttons with different value attributes and check them in the view
- # 00:45 <buo> ionelmc, because I'd got this work already started and had already running django 1.3.1 (but, I'm not using an svn or something)... I'm just making tiny updates
- # 00:45 <django_noob> how to check them
- # 01:00 <ionelmc> django_noob: ah, don't use values, use different names
- # 01:00 <django_noob> if request.POST.getlist('name') == 'finish' ?
- # 01:00 <django_noob> ?
- # 01:00 <ionelmc> and then do if 'save_action' in request.POST: bla
- # 01:00 <mattmcc> raj: Just google content-disposition, there are plenty of examples/explanations of it.
- # 01:00 <django_noob> okey
- # 01:00 <raj> mattmcc, i'm asking after googling
- # 01:00 <django_noob> ionelmc: so if my html has <input class="btn" style="margin-top: 20px;" type="submit" value="Save and Finish">
- # 01:00 <django_noob> and <input class="btn" style="margin-top: 20px;" type="submit" value="Save and Finish">
- # 01:00 <django_noob> i should have .. <input class="btn" style="margin-top: 20px;" type="submit" value="Save and Finish" name="finish">
- # 01:00 <django_noob> ?
- # 01:00 <django_noob> just a little hint ?
- # 01:00 <ionelmc> you shoudl have names on all the submits
- # 01:00 <antihero> is there a way to get django to put POST data that is like form[blah] into a multi dimensonal dict?
- # 01:00 <ionelmc> django_noob: basically what happens when you submit a form: submit_input_name=submit_input_value is added to the form data
- # 01:00 <antihero> or do we have to write that ourself
- # 01:00 <django_noob> okey
- # 01:00 <django_noob> let me try
- # 01:00 <ionelmc> antihero: it doesn't sound that hard to do
- # 01:00 <buo> ionelmc, http://dpaste.org/aGhE3/ now this works a bit better... but echoes the las superuser who has lastly modified the object... :(
- # 01:00 <ionelmc> buo: filter by change message
- # 01:00 <ionelmc> eg: LogEntry.objects.filter(change_message__istartswith="Created" .....
- # 01:00 <ionelmc> but that will break since the change messages are in locale
- # 01:00 <ionelmc> so if you have multiple locales it will get hairy
- # 01:00 <ionelmc> maybe audit using different app or manually?
- # 01:00 <dougwt> if I add something to INSTALLED_APPS do I still need to import it in urls.py?
- # 01:15 <ionelmc> dougwt: you mean include urls?
- # 01:15 <dougwt> ionelmc: I guess I'm still confused on what the purpose of INSTALLED_APPS is. If I add my apps to that list, do I still need to import them at the top of urls.py to be able to refer to the methods in their views?
- # 01:15 <ionelmc> dougwt: putting an app in INSTALLED_APPS will get it's template path accesible, the models loaded and depending on what other apps you're using other thing
- # 01:15 <ionelmc> i imagine you want that no?
- # 01:15 <mattmcc> dougwt: Several apps and parts of Django use INSTALLED_APPS to know which Python packages have particular components, models, template tags, static files, management commands, etc.
- # 01:15 <antihero> ionelmc: How so?
- # 01:15 <FunkyBob> it's true that many aspects [like views] don't need to com from installed apps
- # 01:30 <buo> ionelmc, all right... I'm now echoing user/change_message and this is a whole mess
- # 01:30 <raj> so how can I set the content-disposition for a link to a picture?
- # 01:30 <raj> is it downloads and doesn't open in the browser
- # 01:30 <antihero> frack this noise, I'm just going to parse json over the wire
- # 01:30 <raj> is it downloads = so it downloads
- # 01:30 <Guevara> hello! does anyone know why this error? http://postimage.org/image/bc08msw49/
- # 01:30 <FunkyBob> Guevara: well,
- # 01:30 <antihero> is there a django form field that represents a javascript array?
- # 01:30 <FunkyBob> it looks like you're trying to reverse an empty string
- # 01:30 <Guevara> my urls --> url(r'^display/get_setores/', views.get_setores, name="get_setores"),
- # 01:30 <Guevara> call this by name
- # 01:30 <Guevara> I was using version 1.3, when migrating to 1.4 this error appears
- # 01:30 <Guevara> no field with javascript in this
- # 01:30 <Guevara> no reverse url, is a json response
- # 01:30 <Guevara> return HttpResponse(setores, mimetype="application/json")
- # 01:30 <FunkyBob> Guevara: what you're passing to the url tag... the one in the template shown in the error message
- # 01:30 <FunkyBob> {% url get_stores %}
- # 01:30 <FunkyBob> try {% url "get_stores" %} instead
- # 01:45 <Guevara> FunkyBob: http://dpaste.com/725438/
- # 01:45 <Guevara> tried {% url "get_setores" %} and not work
- # 01:45 <raj> i could definitely use a talk on content headers
- # 01:45 <raj> any takers?
- # 01:45 <FunkyBob> Guevara: same error?
- # 01:45 <Guevara> same error FunkyBob
- # 01:45 <FunkyBob> raj: on what?
- # 01:45 <Guevara> FunkyBob: wait, works!
- # 01:45 <FunkyBob> Guevara: it's the difference between a string literal and a varname
- # 01:45 <Guevara> the url should be used {% url "name_url" %} for all calls
- # 01:45 <Guevara> i understood
- # 01:45 <Guevara> using named url need a ""
- # 01:45 <buo> ionelmc, finally!! thank you!!! I'd filtered by action_flag :-) thanks!!
- # 01:45 <raj> FunkyBob, about how to get a link to download the picture, instead of opening it in a browser window
- # 01:45 <raj> do I need to create a new view to do this?
- # 01:45 <Guevara> thank you FunkyBob
- # 01:45 <Guevara> :)
- # 01:45 <killianes> raj: it's possible
- # 01:45 <killianes> but it's bad
- # 01:45 <raj> oh ok
- # 01:45 <raj> what's the correct/preferred way?
- # 01:45 <killianes> i've seen a jquery plugin
- # 01:45 <FunkyBob> raj: ah.. set content-type to application/octet-stream
- # 01:45 <raj> FunkyBob, create a new view for that?
- # 01:45 <FunkyBob> raj: or ask your web server to do it
- # 02:00 <raj> k
- # 02:00 <FunkyBob> you could, for instance, map /download/ to /media/ but have it set that header also
- # 02:00 <raj> cool
- # 02:00 <raj> if I use a view for this, how will I continue with the file download? what would I have to return?
- # 02:00 <FunkyBob> take a look at the static handler
- # 02:00 <solluce> hi I'm looking for forum software that runs on django and is actively maintained
- # 02:00 <raj> FunkyBob, didn't find it with a google search
- # 02:00 <raj> gotta link perhaps?
- # 02:00 <FunkyBob> raj: ever considered reading the docs? instead of using gogle
- # 02:00 <FunkyBob> google
- # 02:00 <raj> i was hoping google would return the correct page in the django docs
- # 02:00 <schinckel> lol. gogle.com redirects to google.com
- # 02:00 <FunkyBob> schinckel: haha
- # 02:00 <FunkyBob> raj: look at the doc index for 'handling static content'
- # 02:30 <ionelmc> manager._add_items.im_func.func_code = add_items.func_code # hax
- # 02:30 <ionelmc> should i feel bad about this?
- # 02:30 <cactus86> has anyone had problems with south and django 1.4?
- # 02:30 <cactus86> I have 0.7.4 - but its still giving me issues
- # 02:30 <bradleyayers> cactus86: only related to the new timezone support
- # 02:30 <cactus86> Yeah. That's where its breaking for me
- # 02:30 <bradleyayers> well describe your problem
- # 02:30 <cactus86> Sure
- # 02:30 <cactus86> So im on windows (for shame) I've got south 0.7.4 installed in my application
- # 02:30 <cactus86> I've successfully created an initial schema migration
- # 02:30 <cactus86> Im just attempting to go from
- # 02:30 <bradleyayers> so this is a fresh project?
- # 02:30 <cactus86> ./manage.py schemamigration application --initial
- # 02:30 <cactus86> to ./manage.py migrate application
- # 02:30 <cactus86> yes.
- # 02:30 <cactus86> Fresh schema, no data, just trying to set up initial, and do a migration
- # 02:30 <bradleyayers> and what's the problem
- # 02:30 <cactus86> when i execute the last step
- # 02:30 <cactus86> ./manage.py migrate app
- # 02:30 <cactus86> I get an exception I can print the traceback for you
- # 02:30 <cactus86> one second
- # 02:30 <cactus86> http://dpaste.org/EKNzz/
- # 02:30 <ionelmc> dat eval!
- # 02:30 <bradleyayers> cactus86: show your model
- # 02:30 <ionelmc> bradleyayers: looks like a south problem to me
- # 02:30 <ionelmc> maybe development version of south fixes that?
- # 02:30 <cactus86> I found south 0.7.4 which apparently fixes it
- # 02:30 <bradleyayers> cactus86: you didn't include the exception
- # 02:30 <bradleyayers> all i see is a traceback
- # 02:30 <FunkyBob> where's the actual error?
- # 02:30 <ionelmc> bradleyayers: invalid syntax
- # 02:45 <cactus86> yea
- # 02:45 <ionelmc> look at the evaled code
- # 02:45 <cactus86> http://south.aeracode.org/ticket/1012
- # 02:45 <cactus86> more information here I think
- # 02:45 <cactus86> someone closed it.. but it doesnt seem resolved to me?
- # 02:45 <crazygir> hello! when you have a model, which inherits another, and in this base class you have something like guid, is there anything special you need to do to have these fields (in the base class) show up in the admin for the model?
- # 02:45 <crazygir> *for the models using the base class
- # 02:45 <FunkyBob> crazygir: no
- # 02:45 <FunkyBob> multi-table inheritance gives you all the fields from the parent class appearing as 'native' fields on the children
- # 02:45 <crazygir> hrm
- # 02:45 <crazygir> FunkyBob: my ModelAdmin defines a few inlines, and that's it
- # 03:00 <crazygir> but I'm not seeing those fields from the parent class
- # 03:00 <crazygir> I'm defining the child as: class Organization(CoreModel) and CoreModel as: class CoreModel(SoftDeleteObject)
- # 03:00 <crazygir> maybe I am missing something?
- # 03:30 <raj> has anyone ever used a rating calculation like this? http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
- # 03:30 <raj> (the wilson score, being the correct solution)
- # 03:45 <twistedpolygon> im still not able to get javascript running with django/satchmo iv put my js folder and files in static, what could be wrong?
- # 03:45 <vishen> have you checked that the url the files are trying to hit aren't 404ing?
- # 03:45 <twistedpolygon> yep
- # 04:00 <twistedpolygon> where do i put this?
- # 04:00 <twistedpolygon> STATIC_ROOT =
- # 04:00 <twistedpolygon> i think static root may not be defined yet
- # 04:00 <vishen> STATIC_ROOT is usually defined in your settings.py
- # 04:15 <SmileyChris> twistedpolygon: is this using the development server or a seperate web server
- # 04:15 <SmileyChris> jcp_: .aggregate(rate=Avg('product__rate'))
- # 04:15 <FunkyBob> oh, joy... time to dive into a strange caching issue
- # 04:15 <FunkyBob> as in... how could this data have been cached for 2 weeks
- # 04:30 <pjs> This is probably a #python question, but figured I'd ask here really quick. Can anyone tell me what the difference is for this dictionary update? http://dpaste.com/725475/
- # 04:30 <FunkyBob> {# todo - why the hell does this work #} <-- favourite code comment this month
- # 04:30 <SmileyChris> pjs: because the second one is creating a tuple which gets passed as the first argument
- # 04:30 <FunkyBob> pjs: because in the first case you're passing 2 arguemtns
- # 04:30 <FunkyBob> pjs: in the second, you're passing one, a list of two-tuples
- # 04:30 <SmileyChris> a tuple of two-tuples even
- # 04:30 <FunkyBob> indeed
- # 04:30 <pjs> god damn it.. of course.. thanks
- # 04:30 <pjs> I stared at that for 5 minutes and was like, wtf? lol
- # 04:30 <SmileyChris> pjs: assuming you've actually got an old_d, you realise you can d.update(old_d), right?
- # 04:30 <riley526> Is it generally better to keep Manager classes in their own file in an app, or is it just fine to define them in models.py? I know the Django codebase itself does the latter....
- # 04:30 <SmileyChris> riley526: i prefer separate module, but feel free to put it in monkey_flees.py if you feel like it
- # 04:30 <ptoal> I know this is off-topic, but can anyone recommend a cheap but reputable ssl cert authority?
- # 04:30 <pjs> SmileyChris Yea, of course.. this is actually a dynamic settings loader I'm writing for a client project..
- # 04:30 <SmileyChris> sounds like a bad idea :P
- # 04:30 <riley526> SmileyChris: Ohhh monkey_flees.py..... hadn't thought of that
- # 04:30 <pjs> so I'm actually doing vars(imported_module).iteritems() if k == k.upper() type thing
- # 04:30 <SmileyChris> ptoal: startcom? :P
- # 04:30 <SmileyChris> cheap as in free! heh
- # 04:30 <riley526> SmileyChris: In this particular case, if I put the manager in models.py, I can avoid a circular import problem.
- # 04:30 <ptoal> Well, there seems to be quite the range of prices out there, though the products all seem similar. What's startcom's angle?
- # 04:30 <SmileyChris> riley526: it's not often you need to import from a separate model into the manager, but if i need to, i just do a local import
- # 04:30 <SmileyChris> ptoal: they are all similar, welcome to the sham of ssl pricing
- # 04:30 <riley526> SmileyChris, yeah a local import does solve it. But for whatever reason, local imports tend to rub me the wrong way.
- # 04:30 <SmileyChris> riley526: in case you're just after the manager's model - you've got self.model available for thta
- # 04:30 <riley526> SmileyChris, It's a different model in models.py. I'll just do a local import.
- # 04:30 <riley526> SmileyChris, I mean I'm referencing a model other than the manager's model.
- # 04:30 <SmileyChris> right
- # 04:30 <riley526> SmileyChris, Thanks though.
- # 04:30 <ptoal> SmileyChris: Thanks for the pointer. One last question: Do you use startcom for your own sites?
- # 04:30 <SmileyChris> ptoal: some, others are with namecheap
- # 04:45 <ptoal> And your criteria for chosing between the two?
- # 04:45 <SmileyChris> ptoal: free startcom uses your real name as part of the cert - you don't get to pick it
- # 04:45 <ptoal> SmileyChris: So namecheap is cheaper for organization certs?
- # 04:45 <SmileyChris> ptoal: startcom org certs work out cheap if you will get multiple ones
- # 04:45 <ptoal> Thanks SmileyChris... Much appreciated.
- # 04:45 <SmileyChris> startcom's site does look like it was made in the late 90s however :P
- # 04:45 <atula> SmileyChris: what do you think of something like this? http://dpaste.com/725479/
- # 04:45 <atula> it seems simple with .format but not sure if it's reliable
- # 04:45 <SmileyChris> atula: you probably need to check for the duration info
- # 04:45 <atula> oh in case it's just a 1 frame gif which should be treated like any other images
- # 04:45 <SmileyChris> atula: also, it's best to try importing pil both ways. Thanks silly pil developers.
- # 04:45 <atula> I'll need to seek, right ?
- # 04:45 <atula> oh so I should try: import Image then catch to from PIL import Image, right ?
- # 04:45 <ptoal> I don't care what it looks like, as long as it does the job. :) Still looks better than the sites I built in the late 90s
- # 04:45 <SmileyChris> atula: no, shouldn't
- # 04:45 <SmileyChris> (re: seek)
- # 04:45 <SmileyChris> atula: yes, to import
- # 05:00 <atula> " also, it's best to try importing pil both ways" this is about the import, right ?
- # 05:00 <atula> import Image
- # 05:00 <SmileyChris> yes
- # 05:00 <SmileyChris> ptoal: a nice pluss for startcom certs: free ones work with both a subdomain (e.g. www) and the naked domain
- # 05:00 <atula> SmileyChris: revised version: http://dpaste.com/725481/
- # 05:00 <SmileyChris> atula: i can't see how that'll only pick up animated gifs
- # 05:00 <atula> it's checking if the format is GIF then go to frame 1 with seek... if it throws no error then we have an animated gif image, right ?
- # 05:00 <SmileyChris> ah right, seek jumps frames
- # 05:00 <magcius> Will Django actually make sure that things like the subject line don't go over one line?
- # 05:00 <SmileyChris> magcius: it does
- # 05:00 <magcius> I did a cursory look over the code and I didn't see anything that checks for that.
- # 05:00 <magcius> SmileyChris, ah, could you point me to the relevant file?
- # 05:00 <SmileyChris> if '\n' in val or '\r' in val:
- # 05:00 <SmileyChris> raise BadHeaderError("Header values can't contain newlines (got %r for header %r)" % (val, name))
- # 05:00 <SmileyChris> core.mail.message
- # 05:00 <magcius> Thanks!
- # 05:00 <magcius> Will it strip header values too?
- # 05:00 <SmileyChris> def forbid_multi_line_headers
- # 05:00 <SmileyChris> :P
- # 05:00 <magcius> SmileyChris, don't know how I missed that!
- # 05:00 <SmileyChris> reminds me, i have a patch somewhere to make it read two-tuples correctly (like found in ADMIN_EMAILS, etc)
- # 05:00 <SmileyChris> 'it', being the to / cc / from headers
- # 05:30 <cuttooth> is the root url folder defined as r'^$' or something else? I'm just learning django and can't figure it out quite exactly
- # 05:30 <FunkyBob> folder?
- # 05:30 <FunkyBob> root url is r'^$'
- # 05:45 <wuwoot> SmileyChris: you're so helpful. do you have a django project you're currently working on that you don't mind sharing?
- # 05:45 <SmileyChris> wuwoot: it's not public, sorry
- # 05:45 <wuwoot> SmileyChris: any previous projects?
- # 05:45 <SmileyChris> about half of http://lincolnloop.com/work/
- # 05:45 <atula> a filter can take a variable, right? {{ somevar|myfilter:anothervar }}
- # 05:45 <SmileyChris> correct
- # 05:45 <atula> heh. I'm trying to figure out a way to pass in the alias knowing the page_id
- # 05:45 <atula> thumbnail has different alias (size) on landing page, vs actual object page
- # 05:45 <atula> and so on
- # 05:45 <SmileyChris> atula: i'd suggest using an include template and pass the alias as part of the include tag
- # 05:45 <atula> {% tag_to_get_alias page_id as thumb_alias %} then {{ illustration|thumbnail_url:thumb_alias }} SmileyChris
- # 05:45 <atula> it seems simpler but perhaps my mind is warped
- # 06:00 <SmileyChris> atula: why not just have {% page_thumb page_id source %} return the url directly then
- # 06:00 <SmileyChris> i guess if there are lots of thumbs using the same alias on that page, yours works fine
- # 06:00 <atula> source would return the full size, right ?
- # 06:00 <atula> do you suggest that in page_thumb, I use the get_thumbmailer directly ?
- # 06:00 <FunkyBob> damn
- # 06:00 <FunkyBob> I had this code working... now it's stopped :/
- # 06:30 <bradleyayers> bit rote
- # 06:30 <bradleyayers> s/e//
- # 06:30 <FunkyBob> I've wrapped a queryset in a commit_manually, since an extra() has a cast which may raise an error
- # 07:00 <dross> ACTION yawns
- # 07:00 <dross> x.x so much work
- # 07:15 <raj> has anyone ever used a rating calculation like this? http://www.evanmiller.org/how-not-to-sort-by-average-rating.html (wilson score being the correct solution)
- # 07:15 <SmileyChris> raj: yes
- # 07:15 <raj> great :)
- # 07:15 <raj> something with 100 negatives votes has the same rating as something that's never been voted
- # 07:15 <raj> and the same as something with 10 negative votes
- # 07:15 <SmileyChris> raj: hrm, that project is an old one an not on this work computer -- i'll be able to check later -- pretty sure negative weighting works too
- # 07:15 <SmileyChris> off home, anyway
- # 07:15 <raj> k
- # 07:15 <raj> cool
- # 07:15 <eedeep> this seems like it should be obvious but if I have a many to many field with filter_horizontal I can see that when I save the admin change detail form, I can see that in the POST QueryDict the items for the many to many field are in the order in which I arranged them in the filter_horizontal multi select widget
- # 07:15 <eedeep> but when inside cleaned_data they are no longer in the same order
- # 07:30 <eedeep> is there a way to preserve the order in which they are arranged by the user in the multi select widget?
- # 07:30 <schinckel> A Many To Many field has no concept of ordering.
- # 07:30 <schinckel> (talking at a database level here, as well as the django ORM)
- # 07:30 <atrus6> Passing 'mylist': ['one', 'two'm, three'] is valid for {% for item in mylist %} correct?
- # 07:30 <eedeep> schinckel: yes but I can add a display_order column to the many to many intermediary table and record the order that way....but in order to do that correctly so that it reflects the way the user has organised things in the widget I would need that order from the widget to be preserved
- # 07:30 <eedeep> schinckel: in teh post, the order is indeed the same as watever you make it in the widget, but it gets lost at some point down the line
- # 07:45 <PhoenixPyDev> hey guys. when i have any get data in my url( home/?id=123 ) then csrf token does not generate... any idea why this happens and how i can fix it?
- # 07:45 <johnnny22> you didn't include the request's context :)
- # 07:45 <johnnny22> context_instance=RequestContext(request)
- # 07:45 <johnnny22> .. depends on how you're rendering your response i guess a bit ;)
- # 07:45 <PhoenixPyDev> no im sending the request's context everywhere...
- # 07:45 <PhoenixPyDev> the thing is, in my base.html i have a form. all other pages deriver from base.html.
- # 07:45 <PhoenixPyDev> all other pages generate the csrf token div, except for ones with some GET data in the url
- # 08:00 <johnnny22> can't really say much more :o/
- # 08:00 <johnnny22> you've got more info ? pastebin style ?
- # 08:00 <johnnny22> double-check the view that handles that page
- # 08:00 <IanWizard> I'm storing (I know, bad thing, but it's already setup), some XML, in a database, in a TextField. How can I do {{ object.xml_data }} in a template, and get it inserted as html, and not as a text node?
- # 08:00 <IanWizard> Let me simplify that. How can I insert HTML into a template, from a variable.. For example: <div>{{ html_code }}</div>
- # 08:00 <schinckel> You may want to mark_safe it.
- # 08:30 <eshlox> hm, someone try resize animated gif in sorl-thumbnail/easy-thumbnails?
- # 08:45 <johnnny22> i'm confused, i'm getting a No module named south error, i've installed south on my virtualenv that i'm active on.
- # 08:45 <johnnny22> i must be doing something wrong
- # 09:00 <Maior> johnnny22: added to INSTALLED_APPS?
- # 09:00 <Maior> oh, no module, hm
- # 09:00 <johnnny22> ya, added to installed apps.
- # 09:00 <johnnny22> that's while running manage.py
- # 09:00 <johnnny22> syncdb for example.
- # 09:00 <johnnny22> while, if I run: python and do import south and print out south, it prints out the module in the virtualenv.
- # 09:00 <johnnny22> I'm not explicitly including the site-packages from the virtualenv in my manage script thought.. is it necessary really ?
- # 09:00 <johnnny22> it would be like defying the purpose of a virtualenv
- # 09:00 <johnnny22> yeah, my virtualenv is screwed, going to bring that into another room ;)
- # 09:00 <jnylen> hi all, I've got an Account model, and a Transaction model that references the Account model
- # 09:00 <jnylen> it seems like whenever I do tx.account.name or similar, Django does an SQL query
- # 09:00 <jnylen> is there a way to fetch all the Account objects up-front and make django just use them instead?
- # 09:15 <johnnny22> here's a pastebin of my odd virtualenv situation: http://pastebin.com/dYHinQn8
- # 09:30 <johnnny22> here's a more full one: http://paste.pound-python.org/show/18410/ with it working directly in python.. ;o/
- # 09:45 <johnnny22> i hate windows :P
- # 09:45 <johnnny22> when it comes to setups..
- # 10:00 <johnnny22> for some reason, from my manage.py script, my virtualenv isn't considered :o/
- # 10:00 <johnnny22> it's as if it breaks loose
- # 10:00 <FunkyBob> johnnny22: type "which python"
- # 10:00 <johnnny22> ah, wait
- # 10:00 <johnnny22> from within my virtualenv: python manage.py gives the right paths, while if I do simply: manage.py (also from within my virtualenv) it seems to be runned with the system python env.
- # 10:00 <FunkyBob> runned, you say?
- # 10:00 <johnnny22> noticing #!/usr/bin/env python at the top of the manage.py, could this be changed to make it work better ? (but I don't want to hardcode the path to my virtualenv's python executable)
- # 10:00 <FunkyBob> johnnny22: are you running on debian?
- # 10:00 <johnnny22> no, windows
- # 10:00 <johnnny22> :P
- # 10:00 <FunkyBob> and your venv is activated?
- # 10:00 <johnnny22> i'm sure once i deploy on my linux server it'll work just fine :)
- # 10:00 <johnnny22> yep, activated
- # 10:00 <johnnny22> at least i know that I can prepend 'python' in front and it'll be fine, but i'm sure this can be fixed :)
- # 10:00 <johnnny22> maybe i should remove c:\Python2.7\ from my PATH :p
- # 10:00 <johnnny22> maybe windows doesn't like having multiple python.exe in it's path's and simply uses the first one ?
- # 10:00 <johnnny22> nah, that doesn't make sense.
- # 10:00 <johnnny22> by typing : python it would be using the system python too if that was the case.
- # 10:00 <FunkyBob> you should stop developing on a platform that is radically different to the one you plan to deploy on
- # 10:00 <johnnny22> lol
- # 10:00 <FunkyBob> [which is what I keep telling the Mac users at my work :P]
- # 10:00 <johnnny22> don't like that word "Mac" :p
- # 10:00 <johnnny22> anyways.
- # 10:00 <d1rkp1tt> get them to rdp from he mac onto a real computer
- # 10:00 <d1rkp1tt> :p
- # 10:00 <d1rkp1tt> Oooh wars.. sorry
- # 10:00 <johnnny22> <kennethreitz> johnnny22: yeah the windows python discovery is system-level unfortunately
- # 10:00 <johnnny22> ah HA!
- # 10:00 <johnnny22> johnnny22: when you call 'test.py' directly that is
- # 10:15 <johnnny22> solution supposed to be: http://docs.python-guide.org/en/latest/intro/community/#peps
- # 10:15 <johnnny22> ;)
- # 10:15 <johnnny22> Oh, not existant :P.. damn
- # 10:15 <johnnny22> Ooh well, I guess I'll have to simply prepend python in front.
- # 10:15 <FunkyBob> johnnny22: it's a habit I picked up from debian, too... always using "python manage.py"
- # 10:30 <johnnny22> will remember !:)
- # 10:30 <johnnny22> and i finally installed VC8 so my pip works better :)
- # 10:45 <Svedrin> now that 'from django.utils.translation import get_date_formats' has been removed, what is the correct way to format a date using i18n in python code?
- # 10:45 <Svedrin> I can't use a template for that because I'm building a shell command
- # 11:00 <gsin> hi, im sending a HttpResponse to a django view with status as 401, and the string 'Bad Credentials', in wireshark, i see the response as continuous-http or a malformed packet, not a final response
- # 11:00 <gsin> why is that?
- # 11:00 <lauxley> Svedrin: date.strftime(my_date, settings.DATE_FORMAT)
- # 11:00 <lauxley> gsin: what do you mean by 'sending a HttpResponse to a view ?', your view should be the one 'sending' a response
- # 11:00 <gsin> lauxley, yes, sorry thats what i meant
- # 11:00 <lauxley> gsin: then dpaste your view
- # 11:15 <gsin> lauxley, http://dpaste.com/725578/
- # 11:15 <gsin> lauxley, not just 401, any response that contains content='some string' is malformed in wireshark
- # 11:15 <lauxley> gsin: i can't spot the problem, responses with empty content are fine ?
- # 11:15 <gsin> yes
- # 11:15 <antihero> if an image is portrait and my thumbnail is landscape, how do I make sorl aggressively crop as opposed to squashing the image?
- # 11:15 <antihero> I thought cropping was the default, but it doesn't seem so
- # 11:15 <lauxley> antihero: crop="center"
- # 11:15 <johnnny22> what's the easiest way to make a whole site require a login ?
- # 11:15 <lauxley> i don't know gsin maybe try to set the status with the parameter of HttpResponse (HttpResponse(status=401))
- # 11:15 <liberum> I'm trying to pass some forms to formsets where one or more forms may have been removed. When forms are removed, their fields in the HTML is deleted, so if you have three forms in a formset and you delete the second one, you'll end up only with fields `form-0-*` and `form-2-*`, and of course the same old `form-TOTAL_FORMS` set to 3. I have the option of doing some messy changes to the JavaScript to ensure that form numbers are consecutive, bu
- # 11:15 <lauxley> johnnny22: @login_required everywhere is not an option ? (too many views ?)
- # 11:15 <lauxley> johnnny22: if its the case, a middleware
- # 11:15 <johnnny22> k
- # 11:15 <johnnny22> thanks
- # 11:15 <johnnny22> not yet sure if @login_required will be too much :)
- # 11:15 <johnnny22> was wondering about a middleware option more (built-in if any)
- # 11:15 <johnnny22> not to redo the work
- # 11:15 <lauxley> johnnny22: im sure it's already been done
- # 11:15 <gsin> lauxley, no difference
- # 11:15 <md4d> morning guys :) got a short question to caching - here: http://dpaste.org/cVnrf/
- # 11:30 <lauxley> gsin: sorry then, no idea what makes you think its malformed ?
- # 11:30 <gsin> lauxley, because it's not a final response as i see it in wireshark. It's continuous Http
- # 11:30 <FunkyBob> liberum: write shorter lines... your last one got cut off
- # 11:30 <liberum> FunkyBob: thanks, I'll give it another try.
- # 11:30 <liberum> I'm trying to form POST data to formsets where one or more forms may have been removed. When forms are removed, their fields in the HTML is deleted, so if you have three forms in a formset and you delete the second one, you'll end up only with fields `form-0-*` and `form-2-*`, and of course the same old `form-TOTAL_FORMS` set to 3.
- # 11:30 <liberum> I have the option of doing some messy changes to the JavaScript to ensure that form numbers are consecutive, but is there a way to tell formsets to simply ignore forms for which no values were submitted?
- # 11:30 <liberum> s/trying to form POST data/trying to pass some form POST data/
- # 11:30 <FunkyBob> liberum: I'd look to be sure that renumbering them doesn't mess with instance and initial values
- # 11:30 <md4d> here some more information about the caching question: http://dpaste.org/mkuOY/
- # 11:30 <mar> how can I create index using django for two columns? :)
- # 11:30 <FunkyBob> mar: pardon?
- # 11:30 <FunkyBob> md4d: so, yu want it to hold onto the value unless forced?
- # 11:30 <mar> django.db, mysql. I want index (name, email) for example
- # 11:30 <FunkyBob> mar: oh, right... because mysql is still stupid about using indices
- # 11:30 <lauxley> mar: unique_together
- # 11:30 <FunkyBob> lauxley: not actually what they're after
- # 11:30 <lauxley> hmm
- # 11:30 <FunkyBob> lauxley: whereas postgres will automatically combine multiple indices if it thinks they're useful... mysql can only use one index per table per join
- # 11:30 <mar> lauxley, but what if they're not unique together?
- # 11:30 <lauxley> are you sure ? :D
- # 11:30 <lauxley> okay :(
- # 11:30 <FunkyBob> well, that may have been fixed in more recent versions
- # 11:30 <FunkyBob> it's not like I bother looking at what mysql is doing :P
- # 11:45 <mar> so because other databases doesn't have the same index structure (you can't create index for 2+ fields), django doesn't implement such thing?
- # 11:45 <md4d> FunkyBob: right. i thought that i will do less querry if i hold the value in the model and just calculate the new one if something has changed.works fine so far - but i got no experience in caching. does memcache help me with that? so that i can use the version without "force_update" ?
- # 11:45 <FunkyBob> mar: not at all.. pretty much all DBs allow you to make multi-column fields
- # 11:45 <gsin> lauxley, ok i verified, any response without content is OK, seen as final http response, but if i have some content, like a simple string, it's not seen as final response... it's continuous http traffic
- # 11:45 <gsin> or a malformed packet
- # 11:45 <mar> so django just doesn't have it or am I unable to find it in docs?
- # 11:45 <FunkyBob> mar: the difference is... pretty much everything else can combine indices
- # 11:45 <FunkyBob> mar: I don't think django has it directly in the ORM... you can use a raw sql fixture to do it
- # 11:45 <mar> ok
- # 11:45 <Svedrin> lauxley, that doesn't take the current user's selected locale into account. but I found that django.utils.formats.localize works, and does.
- # 11:45 <lauxley> gsin: try to change the content type maybe ? (im feeling blind on this one)
- # 11:45 <FunkyBob> https://docs.djangoproject.com/en/1.4/howto/initial-data/#providing-initial-sql-data
- # 11:45 <lauxley> Svedrin: DATE_FORMAT can be (and should be) localised
- # 11:45 <Svedrin> lauxley, is there any reason not to use localize? I feel like it makes the app more robust against misconfiguration, which I'd prefer
- # 11:45 <gsin> lauxley, i tried content_type='application/json' and returned a json string, still same problem
- # 11:45 <lauxley> Svedrin: if you don't need any custom formats or such, then go ahead
- # 11:45 <gsin> there's something really weird here, i googled and it doesn't seem like a common problem
- # 11:45 <avu> is it possible to make an inline part of a fieldset in a ModelAdmin? (ie I have inlines = [FooInline] and want the form rendered by that be part of a fieldset defined in that same class)
- # 11:45 <lauxley> gsin: yeah i really don't see the problem, do you have anything that could come in the way, like a middleware or smthg ?
- # 11:45 <gsin> no
- # 11:45 <lauxley> gsin: and are you sure HttpResponse is called ? what if len(auth) != 2 or auth[0].lower() != 'basic' ??
- # 11:45 <Eren> I've uncommented the related admin configs in urls.py and activated admin app
- # 11:45 <Eren> now I get the following error after logged in the admin page
- # 11:45 <Eren> Caught ViewDoesNotExist while rendering: Tried home in module lookup.views. Error was: 'module' object has no attribute 'home'
- # 11:45 <gsin> lauxley, @csrf_exempt
- # 11:45 <gsin> def foo(request):
- # 11:45 <gsin> if request.method == 'GET' :
- # 11:45 <gsin> return HttpResponse('there u go')
- # 11:45 <gsin> else :
- # 11:45 <gsin> return HttpResponse('here u go',status=405)
- # 12:00 <gsin> even this has the same problem
- # 12:00 <lauxley> gsin: runserver or apache or something else ?
- # 12:00 <gsin> runserver
- # 12:00 <bahamas> Eren: do you have a view called "home" in lookup.views?
- # 12:00 <Eren> bahamas: I just fixed that
- # 12:00 <Eren> bahamas: the problem was app-specific :)
- # 12:00 <Eren> thanks
- # 12:00 <lauxley> gsin: i am out of ideas
- # 12:00 <bahamas> no problem
- # 12:00 <Eren> it's strage that admin site requires all-valid views
- # 12:00 <bahamas> gsin: what's the problem?
- # 12:00 <Eren> strange*
- # 12:00 <gsin> bahamas, any response without content is OK, seen as final http response, but if i have some content, like a simple string, it's not seen as final response... it's continuous http traffic or malformed packet
- # 12:00 <gsin> as per wireshark
- # 12:00 <gsin> bahamas, for instance in this snippet http://dpaste.com/725597/ all get requests give a final http response, but anything else returns a response with 405 status code, but it's not a final response to the request, its seen as continuous http
- # 12:00 <bahamas> gsin: you said that you don't have any custom middlewares?
- # 12:00 <gsin> bahamas, just the defaults
- # 12:00 <gsin> Common,Session,Csrf,Auth and Message
- # 12:00 <Hemebond> Is it possible to modify the context (add something) from an included template?
- # 12:00 <FunkyBob> Hemebond: and pass it to the outer template?
- # 12:00 <Hemebond> Yes.
- # 12:00 <FunkyBob> no
- # 12:00 <Hemebond> FunkyBob: You and I have already discusses this :-)
- # 12:00 <FunkyBob> the reason is include 'pushes' the context state... which will then be 'popped' on return
- # 12:00 <FunkyBob> then why are you asking again? do you not trust me?
- # 12:00 <Hemebond> How do I do this then? There must be a way.
- # 12:00 <Hemebond> I do trust you. You said you hadn't looked into it yet.
- # 12:00 <FunkyBob> why must there be a way?
- # 12:00 <Hemebond> You hadn't got around to doing your own solution and were going to research contexts more.
- # 12:15 <Hemebond> I mean there must be a solution to what I am trying to achieve.
- # 12:15 <Hemebond> A different method.
- # 12:15 <FunkyBob> let's start from the beginning, then
- # 12:15 <FunkyBob> what's your overall goal?
- # 12:15 <Hemebond> I want templates to specify the scripts and stylesheets they require, and have them collected, de-duplicated and put to an appropriate place in the final page.
- # 12:15 <FunkyBob> ok
- # 12:15 <Hemebond> Grouped, of course.
- # 12:15 <Hemebond> In the final page.
- # 12:15 <FunkyBob> so what you'd want to do is store those details somewhere outside the usual context approash
- # 12:15 <Hemebond> Okay. Reading the template docs again.
- # 12:15 <FunkyBob> won't be in there
- # 12:15 <lauxley> FunkyBob: Hemebond: blocks with {{super}} would do the trick
- # 12:15 <Hemebond> Oh. I thought maybe there was something already available to templates I could use.
- # 12:15 <flashingpumpkin> Hemebond, that sounds like a custom template tag that stores that information on, say, the request
- # 12:15 <Hemebond> flashingpumpkin: I had that, but it doesn't work with includes.
- # 12:15 <lauxley> well not for the non duplicated part
- # 12:15 <Hemebond> lauxley: Unless there was something that processed the block in the final (top) template.
- # 12:15 <flashingpumpkin> Hemebond, define includes. Inclusion tags? Or {% include %} ?
- # 12:15 <Hemebond> {% include %}
- # 12:15 <Hemebond> Each include gets a copy of the context, not the actual context.
- # 12:15 <Hemebond> (as far as I understand it)
- # 12:15 <gsin> bahamas, any clue?
- # 12:15 <flashingpumpkin> Hemebond, included templates can use any template tag and have the full context available
- # 12:15 <Hemebond> flashingpumpkin: While the template tag works, the changes made are not carried upwards.
- # 12:15 <Hemebond> Unless there is something else going wrong.
- # 12:15 <Hemebond> I wanted the template tag being called, but the changes were not available to other templates.
- # 12:15 <bahamas> gsin: does this happen with only one application or every application served from that machine?
- # 12:15 <gsin> bahamas, it's a dev box... i'll try another application
- # 12:30 <wcapio> How do you have a primary key that uses multiple database columns? I have three columns (fi. venue, row, seat). Now I select on the three columns. Is this the best way to do it?
- # 12:30 <flashingpumpkin> Hemebond, http://dpaste.org/eFzZD/ - Note that this will only work if you use `request.csslist` only *after* you've called every {% addcss %} tag, ie only at the bottom of your template
- # 12:30 <Hemebond> Ooh, having a look now. Thank you :-)
- # 12:30 <flashingpumpkin> Hemebond, make that bottom of your root template
- # 12:30 <FunkyBob> Hemebond: if your context processor adds a list/dict for holding the values... and your template tag adds to the existing value... it could work
- # 12:30 <wcapio> any news on multiple column primary keys?
- # 12:30 <bullicon> this ticket https://code.djangoproject.com/ticket/7577 was opened four years ago
- # 12:30 <Hemebond> flashingpumpkin: It doesn't seem to work from the include.
- # 12:30 <Hemebond> It works in the base and object template.
- # 12:30 <Hemebond> But not the include.
- # 12:30 <bullicon> anyone knows if django now supports that, I still get that behaviour..django.contrib.auth.view.login displays login form to a logged in user
- # 12:45 <mattmcc> bullicon: Well, the ticket was marked invalid with a thorough response from a core developer seeking more information and a better patch.
- # 12:45 <dross> bullicon: as commented by one of the other devs, I've no fucking idea what you're talking about due to the ticket not being a diff
- # 12:45 <mattmcc> dross: Well put. :P
- # 12:45 <dross> mattmcc: stop being more polite than me :-)
- # 12:45 <bullicon> easy dross mattmcc
- # 12:45 <wcapio> dross **
- # 12:45 <mattmcc> dross: Stop being an ass.
- # 12:45 <dross> :-)
- # 12:45 <dross> mattmcc: I try my best to be more like Linus :3
- # 12:45 <bullicon> lol
- # 12:45 <dross> or PHK
- # 12:45 <FunkyBob> ACTION wanders off looking to make git work via a proxy
- # 12:45 <mattmcc> FunkyBob: SSH tunnel or agent forwarding?
- # 12:45 <bullicon> whatever, dross: is there some sort of option for preventing django.contrib.auth.view.login from displaying the login form to a logged in user ?
- # 12:45 <dross> FunkyBob: git config --global http.proxy %PROXY_HERE%
- # 12:45 <FunkyBob> dross: except that only appears to work for http:// git urls
- # 12:45 <FunkyBob> mattmcc: mmm?
- # 12:45 <bullicon> mattmcc: any idea ?
- # 12:45 <mattmcc> bullicon: Two things you can do in your own code: 1) Don't link to the login form when a user is logged in. 2) Wrap the login view with an 'anonymous_required' sort of decorator.
- # 12:45 <dross> matt already answered it
- # 12:45 <bullicon> thanks mattmc
- # 12:45 <mattmcc> Of course you'd have to decide on your own where to send a request if they try to access the login form while logged in already.
- # 12:45 <dross> I mean, Django is a framework, not a hand holding thing =3
- # 12:45 <bullicon> dross you dont have to be rude to appear smart :P
- # 12:45 <dross> bullicon: Linus does it all the time though =)
- # 12:45 <bullicon> dross: you are not Linus
- # 12:45 <dross> anyone who he disagrees with are Nazis
- # 12:45 <mattmcc> A modern day logical fallacy. "Well, Linus gets away with it, so I can too.."
- # 12:45 <bullicon> dross: not even my boss :D
- # 12:45 <dross> I can with my boss o.o
- # 12:45 <bullicon> dross: you dont even have a face here, just a five character handle
- # 12:45 <mattmcc> Well, that's your boss's shortcoming, it doesn't apply here.
- # 12:45 <dross> mattmcc: :3 not really
- # 12:45 <gsin> bahamas, tried another application same problem
- # 12:45 <dross> mattmcc: I'm paid to produce and get shit done
- # 12:45 <dross> I'm not a devop for just my programming ability ;)
- # 12:45 <mattmcc> That's nice. But again, it's not relevant to your conduct here.
- # 12:45 <wcapio> any alternative for a multiple column primary key?
- # 12:45 <dross> mattmcc: bah =3
- # 12:45 <mattmcc> wcapio: Depends on your needs. Multi-column unique keys can sometimes meet the same need.
- # 12:45 <bahamas> gsin: ok, so it's something to do with the server than. do a fresh install of django and see if the problem persists
- # 12:45 <bahamas> s/than/then/
- # 12:45 <gsin> bahamas, yeah, i had to upgrade to 1.4 anyways
- # 12:45 <wcapio> mattmcc, yet if I'm right django's ORM does not support multi-column uniques does it?
- # 12:45 <flashingpumpkin> wcapio, it does
- # 12:45 <wcapio> ?
- # 12:45 <thnee> I'm trying to install django-admin-tools, but I get a 404, even though I have added the url-conf. How can I debug a 404?
- # 12:45 <mattmcc> wcapio: https://docs.djangoproject.com/en/1.4/ref/models/options/#unique-together
- # 12:45 <wcapio> https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys
- # 12:45 <nkuttler> ow nice i can get a list of talks before buying my djangocon tickets..
- # 12:45 <dross> omg >.<
- # 12:45 <dross> someone registered my nick wolfe on here
- # 12:45 <flashingpumpkin> wcapio, https://docs.djangoproject.com/en/1.4/ref/models/options/#unique-together
- # 12:45 <dross> :< fuck, that's what I get for not using it regularly
- # 12:45 <flashingpumpkin> wcapio, ah sorry, that's multi column uniques, not pks :/
- # 12:45 <talin> hello and spello as well
- # 12:45 <dross> moin
- # 12:45 <dross> now go code :V
- # 12:45 <wcapio> flashingpumpkin, hmm. uniques are what I am looking for! :) what the difference between multiple uniques and pks
- # 12:45 <wcapio> +'s
- # 12:45 <wcapio> mattmcc, 1.4 is stable?
- # 12:45 <mattmcc> Yes.
- # 12:45 <wcapio> sweet
- # 12:45 <dross> =]
- # 12:45 <Hemebond> flashingpumpkin: I'm full of crap. It appears to work!
- # 12:45 <Hemebond> Thank you very much!
- # 12:45 <dross> I usually use trunk for dev work :P
- # 12:45 <wcapio> mattmcc, how risky is it to upgrade eyes closed?
- # 12:45 <dross> by the time you're done with the your code, the release will be out
- # 12:45 <mattmcc> wcapio: I wouldn't call it risky, I'd just call it foolish.
- # 12:45 <Hemebond> flashingpumpkin: Ah, you're adding it to the request, rather than the context itself. Brilliant.
- # 12:45 <dross> unfortunately that doesn't work with dojo since they're undergoing a major change
- # 12:45 <mattmcc> wcapio: Release notes exist for a reason.
- # 12:45 <wcapio> mattmcc, check
- # 12:45 <gsin> bahamas, ok, i upgraded to 1.4, just the first response with content was ok(final response), after that same problem
- # 12:45 <gsin> even if i kil runserver and restart it
- # 12:45 <bahamas> gsin: do you have another machine that you can try on?
- # 12:45 <mucker> Hi guys. I have a "from core.models import Model". Model has a date field. Now when I run a query Model.objects.filter(date__range=(from,to)) ... I get "globel name date__range not found" But when I do Model.objects.filter(date__range=[from,to])) #used in django docs# It works. Can you guys explain me the diff ??
- # 12:45 <dross> FunkyBob: what are you trying to proxy btw?
- # 12:45 <flashingpumpkin> Hemebond, it's just an example. You could add your own custom list to the context and append it there.
- # 12:45 <gsin> bahamas, no, not right now
- # 13:00 <mucker> * Model.objects.filter(date__range=(from,to)) is used in django docs ... Model.objects.filter(date__range=(from,to)) found on stack overflow. Whats the diff b/w these two ?
- # 13:00 <bullicon> mucker: tuples are immutable, so I suspect the model manager updates that parameter when running the query
- # 13:00 <dross> ACTION yawns
- # 13:00 <mucker> ok. when does it do that ?
- # 13:00 <bullicon> mucker: I assume it does.
- # 13:00 <talin> in the admin part where you add/remove objects, i want to use different field names than those i have in my class... like "deadline", i wnat to be shown as "deadline (hours)"
- # 13:00 <bullicon> dross: knows best
- # 13:00 <atula> if my simple tag is taking a string and returning a string, is there something special I need to do to make variable assignment on result: {% my_simple_tag string_arg as new_template_context_variable %} ?
- # 13:00 <talin> since i have deadline = models.blahblah() in my models.py, it shows up as "deadline" in my admin editor
- # 13:00 <mucker> bullicon: ok thnkx
- # 13:00 <bullicon> talin, use the verbose_name argument
- # 13:00 <talin> bullicon: that is for my class name, not for my class attributes?
- # 13:00 <atula> got it. assignment tags. thanks anyway.
- # 13:00 <bullicon> deadline = models.CharField(max_length...verbose_name='deadline (hours)')
- # 13:00 <FunkyBob> dross: I have a git:// git url... I need to clone it
- # 13:00 <bullicon> talin: ^
- # 13:00 <talin> bullicon: perfect, thank you!
- # 13:15 <dross> FunkyBob: ah, I see why that's troublesome :/
- # 13:15 <dross> FunkyBob: I guess you'll just have to do it the hard way =3
- # 13:15 <dross> http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/
- # 13:15 <dross> FunkyBob: why doesn't your git server have a http frontend? :<
- # 13:15 <Hemebond> flashingpumpkin: Is render_context isolated to a particular template?
- # 13:15 <flashingpumpkin> Hemebond, ?
- # 13:15 <Hemebond> flashingpumpkin: The tag I already had was adding the media to context.render_context['media'].
- # 13:15 <Hemebond> It just occurred to me that render_context might be isolated to each template, whereas context itself is the same everywhere.
- # 13:15 <flashingpumpkin> Hemebond, no. Every time you descend one level into the template, the context for a key gets pushed: media == [['level-1]] --> media == [['level-2'],['level-1']]
- # 13:15 <flashingpumpkin> once you return from a template, the context gets popped -> media == [['level-2'], ['level-1']] --> media == [['level-1']]
- # 13:15 <Hemebond> So it was the particular key I was using?
- # 13:15 <flashingpumpkin> no, it's that you're supposed to use context['your-key'] instead of context.render_context
- # 13:15 <flashingpumpkin> they're different
- # 13:15 <Hemebond> Right.
- # 13:15 <Hemebond> That's where I went wrong.
- # 13:15 <Hemebond> Thank you very much.
- # 13:15 <gsin> bahamas, tried on another machine with django 4.1, same problem
- # 13:30 <gsin> django 1.4 i mean
- # 13:30 <bahamas> gsin: don't know then. maybe someone else has more insight
- # 13:30 <stummi> hi, how can i bring a view to deliver a static image file?
- # 13:30 <flashingpumpkin> Hemebond, well, it depends. context['your-key'] is global, where as context.render_context is template local
- # 13:45 <Hemebond> flashingpumpkin: Yeah. That's where I went wrong.
- # 13:45 <TwoDaemon> Afternoon all. I've been trying to work out how to stop one of my databases (defined in the usual way in settings.DATABASES) from being automatically syncdb'd (and migrated with South) when I run tests. I'm using the Nose test runner, in case that's important. My default DB is being synched as expected, but so is another DB I have which I'd prefer was left alone. Can anyone give me any
- # 13:45 <TwoDaemon> tips, please?
- # 13:45 <Hemebond> flashingpumpkin: Though it doesn't seem to work if I use context['my_collection']
- # 13:45 <Hemebond> TwoDaemon: Doesn't South have a system for doing that?
- # 13:45 <Hemebond> TwoDaemon: I think I read in their documents about excluding databases from syncs.
- # 13:45 <Hemebond> TwoDaemon: I don't use South yet.
- # 13:45 <antihero> if I'm using a model for, is there a way to access the bound instance?
- # 13:45 <antihero> in a templaet
- # 13:45 <gsin> bahamas, there?
- # 13:45 <antihero> or is there a way to have uneditable fields show up as normal text
- # 13:45 <flashingpumpkin> antihero, form.instance
- # 13:45 <gsin> i think the problem is with wireshark...
- # 13:45 <gsin> anubody got wireshark on a dev box? just need to verify something
- # 13:45 <TwoDaemon> Hemebond: I'll take a look, thanks.
- # 13:45 <flashingpumpkin> Hemebond, are you sure 'my_collection' is in the context?
- # 13:45 <Hemebond> flashingpumpkin: I'm adding it, but I'm adding it inside the template tag.
- # 13:45 <flashingpumpkin> Hemebond, don't do it in the template tag. Create a context processor for it
- # 13:45 <Hemebond> flashingpumpkin: Ah.
- # 14:00 <bahamas> gsin: yes, I'm here, but I don't have a clue. explain your problem again with all the tests that you've done. maybe someone else knows more
- # 14:00 <blip2> yes, your problem is spread out quite a lot
- # 14:00 <blip2> summary would b nice :]
- # 14:00 <blip2> be*
- # 14:00 <gsin> ok, i have a view def foo(request), when I return a HttpResponse with no content, wireshark see's the response as Final HTTP response(this is irrelevant of the status code that im returning)... but when I add some content to the response, such as a string 'Failure', the response as per wireshark, is a malformed packet or continuous http trafic and NOT a final http response
- # 14:00 <gsin> there's only default middleware
- # 14:00 <gsin> i tried this on a fresh 1.4 install on a new machine as well
- # 14:00 <lauxley> gsin: what if you use curl ?
- # 14:00 <gsin> lemme check, i was using python-requests library to test the calls
- # 14:00 <gsin> lauxley, the content-length header is not being set by django
- # 14:00 <gsin> that's why it's malformed packet
- # 14:00 <lauxley> gsin: i've seen this before
- # 14:00 <WaqarAzeem> Hi, Is there any working framework avaliable for javascript and Django
- # 14:00 <gsin> lauxley, what;s the likely cause?
- # 14:00 <lauxley> gsin: can't remember :D
- # 14:00 <gsin> hmmm
- # 14:00 <lauxley> WaqarAzeem: js and django are two separate things, as it should be
- # 14:00 <lauxley> WaqarAzeem: get jquery if you want a js 'framework'
- # 14:00 <gsin> lauxley, content-length is set by middleware?
- # 14:00 <lauxley> gsin: im not sure but i guess so
- # 14:00 <WaqarAzeem> these two combinations works for me on these other platform
- # 14:00 <WaqarAzeem> but for Django ... ? any idea
- # 14:00 <lauxley> gsin: so, what if you set it yourself ?
- # 14:00 <joe4465> Can anyone have a look at this please http://stackoverflow.com/questions/9975934/django-comments-redirect-from-posted-preview
- # 14:00 <thnee> I am trying to install django-admin-tools, but I keep getting "Reverse for 'admin-tools-dashboard-set-preferences' with arguments '('dashboard',)' and keyword arguments '{}' not found." any ideas?
- # 14:00 <lauxley> WaqarAzeem: im not sure what you are talking about but jquery is very solid and used by almost every web dev out there
- # 14:15 <lauxley> joe4465: you can redirect to request.get_full_path() even though its weird
- # 14:15 <lauxley> joe4465: btw, if you INSERT or UPDATE, use POST, not GET, and a form while your at it
- # 14:15 <gsin> lauxley, works if i set it myself
- # 14:15 <lauxley> gsin: well gratz :)
- # 14:15 <gsin> :)
- # 14:15 <gsin> so, now that the problem is identified, does this warrant a bug report?
- # 14:15 <lauxley> gsin: https://code.djangoproject.com/ticket/5897
- # 14:15 <WaqarAzeem> so, anyone have a experience of these pajamas :D ... http://pyjs.org/
- # 14:15 <gsin> lauxley, so that's normal behaviour then? content-length has to be specified while returning a HttpResponse
- # 14:15 <joe4465> where would i put request.get_full_path()
- # 14:15 <joe4465> in value?
- # 14:15 <gsin> i mean *manually* specified
- # 14:15 <lauxley> gsin: no it seems that content-length is not mandatory, but you can use ConditionalGetMiddleware to set it every time (according to the ticket, im not sure about this)
- # 14:15 <lauxley> gsin: wireshark probably expects a content length
- # 14:15 <gsin> yup
- # 14:15 <gsin> i think its that...
- # 14:15 <gsin> cool.. thanks...
- # 14:15 <gsin> ACTION moving on :)
- # 14:15 <lauxley> joe4465: in place of post.get_absolute_url() ?
- # 14:15 <joe4465> in views.py?
- # 14:15 <lauxley> yeah where else would you make a redirection ?
- # 14:15 <lauxley> joe4465: btw i think you have a problem, your form's method is POST but you test request.GET ?
- # 14:15 <joe4465> so i need to change my views.py to POST?
- # 14:15 <lauxley> joe4465: wait
- # 14:15 <lauxley> joe4465: i really don't get this code, where do you create the comment ?
- # 14:15 <joe4465> on my image page
- # 14:15 <joe4465> on the template i load comments and then render the list and form
- # 14:15 <joe4465> like in the comments example on django site
- # 14:15 <joe4465> so now im just modifing the default templates
- # 14:15 <lauxley> joe4465: ok so the form's action does not point to comment_posted, right ?
- # 14:15 <lauxley> but to another view that create the comment
- # 14:30 <joe4465> i tried to redirect to comment_posted via the urls.py but that didnt work
- # 14:30 <joe4465> i just want a simple way of making the page basically refresh when the comment is posted
- # 14:30 <joe4465> there are loads of different ways on the internet, but none seem to actually work
- # 14:30 <lauxley> joe4465: oh ok
- # 14:30 <joe4465> is there anything you can reccommend to go from the default comment behaviour to what i require
- # 14:30 <lauxley> joe4465: i guess the easiest way would be js, because the post view already redirect, so you lose the url
- # 14:30 <lauxley> joe4465: its typical ajax task
- # 14:30 <lauxley> joe4465: quick win : try to replace post.get_absolute_url() with request.HTTP_REFERER
- # 14:30 <lauxley> joe4465: this is ugly but should work
- # 14:30 <ionelmc> can't belive you're advising that
- # 14:30 <lauxley> ionelmc: i know right :D
- # 14:30 <lauxley> but ajax is a bit brutal if you never tried it
- # 14:30 <joe4465> its for a school project, it dosnt need to be secure/correct etc. it just needs to work
- # 14:30 <joe4465> i dont know much about django, other than what ive picked up mfrom tutorials
- # 14:30 <lauxley> hmm anyway i think it was stupid because its gonna redirect to the comment post view -_-a
- # 14:30 <lauxley> joe4465: ok phase 2 ! i think the right way is to make a custom post view, which mean you gonna have to change the form's action, make a new url and a new view with the form validation, comment creation and redirection
- # 14:30 <joe4465> why is there not an easy way to do this, the django comments are so quick to set up initially. There should be an option not to have a preview or posted page ;(
- # 14:30 <lauxley> joe4465: seems cool ah ?
- # 14:30 <lauxley> joe4465: well there is no way to do anything easily when you know nothing ;)
- # 14:30 <joe4465> i dont think im going to bother, but thanks anyway. Ill just go to the posted page and have a back link
- # 14:30 <joe4465> there is a lot to learn, and i dont really know where to start, i get models/views/templates and the url system but thats about it
- # 14:30 <lauxley> joe4465: good you only need forms then
- # 14:30 <elektronisk> I'm trying to override the admin template (base_site.html as a start), but t doesn't take effect. Here is my file structure http://dpaste.com/725634/ . I have the app_directories and filesystem template loaders enabled.
- # 14:30 <lauxley> joe4465: you can look at the post view in the comment app to see how its done, its really not that hard (maybe 10 lines of code if there is no weird stuff)
- # 14:45 <joe4465> ok, thanks
- # 14:45 <lauxley> elektronisk: shouldn't project be the root dir ?
- # 14:45 <Hemebond> flashingpumpkin: I've created a context processor but I'm getting the scoping problem with it.
- # 14:45 <joe4465> does anything get passed to the posted page that i can perform .get_absolute_url on?
- # 14:45 <elektronisk> lauxley: Folder structure created by django-admin I beleive
- # 14:45 <lauxley> joe4465: only the post parameters, which are strings, so no, but you should have something like an object_id, so you can do foo = Foo.objects.get(id=object_id) and foo.get_absolute_url()
- # 14:45 <Hemebond> flashingpumpkin: Ah. I see that your code doesn't add to the context until it's all rendered. I guess I also need to do that.
- # 14:45 <lauxley> elektronisk: and do you have a TEMPLATE_DIRS in settings.py ?
- # 14:45 <elektronisk> lauxley: it is empty
- # 14:45 <elektronisk> as in TEMPLATE_DIRS = ()
- # 14:45 <Ilian> is there a way to change model object primary key and just update the object?
- # 14:45 <lauxley> elektronisk: add the path to templates/
- # 14:45 <lauxley> Ilian: yeah but it doesn't seem like a good idea :p
- # 14:45 <Ilian> lauxley, long story short I have to create new object, delete the old, and then change the pk of the new to be the same as the old_one
- # 14:45 <elektronisk> lauxley: I've tried that, does not seem to affect it
- # 14:45 <Ilian> I know it sounds "idiotic" but this is the "fastest" way instead of overwriting half of the app
- # 14:45 <elektronisk> do you think i should have my app dir inside the project dir along with settings.py etc?
- # 14:45 <Mogget> In a template I am comparing a models.AutoField(primary_key = True) with a number that arrives from urls.py when a user enters data. Even though debugging this shows that the number are the same, ifequal will not consider it True. Any suggestions to what I am doing wrong?
- # 14:45 <FunkyBob> elektronisk: are you using django 1.4 ?
- # 14:45 <lauxley> elektronisk: did you add the full path ?
- # 14:45 <elektronisk> FunkyBob: yes.
- # 14:45 <ralc> Hi. Is there some simple way of displaying a form as pure text, i.e. no input fields at all? I've looked at preview forms, but it seems to do too much. This is for giving users a quick overview of a number of forms they have previously filled out
- # 14:45 <FunkyBob> elektronisk: then no
- # 14:45 <elektronisk> lauxley: i put in an absolute path
- # 14:45 <FunkyBob> elektronisk: apps should live in the workspace dir, next to the project module
- # 14:45 <Ilian> lauxley, so what is the way?
- # 14:45 <elektronisk> FunkyBob: ok, thanks
- # 14:45 <lauxley> Ilian: im not sure what your trying to do but what happend if you change the pk and save the instance ?
- # 14:45 <Ilian> lauxley, it raises IntegrityError: (1062, "Duplicate entry 'user_1' for key 'username'")
- # 14:45 <lauxley> Ilian: didn't you delete the copied instance ?
- # 15:00 <Ilian> lauxley, my sample code is http://dpaste.org/YKpg5/
- # 15:00 <elektronisk> is there any way I can find out how django looks for templates, in order to find out how it misses mine?
- # 15:00 <lauxley> Ilian: well its pretty safe explenatory, you already have an User with username='user_1'
- # 15:00 <wcapio> can one field have a foreignkey to multiple users
- # 15:00 <wcapio> ?
- # 15:00 <Ilian> lauxley, yes and I do not wont to create a new user, just to change the pk/id of the old one
- # 15:00 <busata> http://dpaste.org/GAR9x/ I'm trying to define the get_last_comment function in my discussion model, but since it has no comments list, I was trying to refer to it as the related_name in comments,but that doesn't work. Is it possible through another way?
- # 15:00 <wcapio> I'd like to have a like button (compare fb) that when you click on it, displays who liked it... any ideas?
- # 15:00 <lauxley> Ilian: then do x = User.objects.get(username='user_1') / x.pk = 10 / x.save()
- # 15:00 <Ilian> lauxley, it raises the same exception
- # 15:00 <Ilian> I think it is trying to create a new object instead of updatign the old one
- # 15:00 <RuslanPopov> re all
- # 15:00 <lauxley> Ilian: yeah indeed, i think there is a parameter to save like force_update=True (not sure about that)
- # 15:00 <RuslanPopov> I hit my head about keyboard trying to make with ORM the following query: select firm_id, info_id, sum(earned) from bablo_mobileearn group by firm_id, info_id;
- # 15:00 <Ilian> "DatabaseError: Forced update did not affect any rows."
- # 15:00 <RuslanPopov> ppl, what the right way to aggregate with ORM?
- # 15:00 <lauxley> Ilian: well i dunno :p
- # 15:00 <lauxley> custom query would work for sure
- # 15:00 <Ilian> yeah I am thinking for this
- # 15:15 <RuslanPopov> select firm_id, info_id, sum(earned) from bablo_mobileearn group by firm_id, info_id; - how to do this with ORM ORM ORM?!?
- # 15:15 <RuslanPopov> this shit doesn't work
- # 15:15 <Hemebond> flashingpumpkin: Even with the context processor the variable is still scoped.
- # 15:15 <flashingpumpkin> Hemebond, can you post the code somewhere?
- # 15:15 <Hemebond> flashingpumpkin: Sure, just a moment.
- # 15:15 <Hemebond> I need to undo my testing changes.
- # 15:15 <Hemebond> flashingpumpkin: http://www.dpaste.org/FVYLP/
- # 15:15 <ralc> I hope you don't mind me bumping my own question: Hi. Is there some simple way of displaying a form as pure text, i.e. no input fields at all? I've looked at preview forms, but it seems to do too much. This is for giving users a quick overview of a number of forms they have previously filled out.
- # 15:15 <Hemebond> flashingpumpkin: http://od-eon.com/blogs/liviu/scope-variables-template-blocks/
- # 15:15 <flashingpumpkin> Hemebond, and where are you rendering template_meda? At the end of your root template, or at the start?
- # 15:15 <flashingpumpkin> if you do {{ template_media }} at the start of the template, but haven't used `require_media` yet, it'll be empty and not append anything to the template
- # 15:15 <Hemebond> flashingpumpkin: At the very end of base.html
- # 15:15 <flashingpumpkin> Hemebond, I don't know the behaviour of Media() += Media()
- # 15:15 <Hemebond> Media() is the class that form media uses.
- # 15:15 <Hemebond> Appending like that just merges them.
- # 15:15 <Hemebond> er, adding like that.
- # 15:15 <Hemebond> It handles de-duplication and pathing for you.
- # 15:15 <busata> when model B defines a foreign key to model A with a related name, is it possible to access this "relation" in model A in the model definition itself?
- # 15:15 <elektronisk> I'm trying to override the admin template (base_site.html as a start), but t doesn't take effect. Here is my file structure http://dpaste.com/725634/ . I have the app_directories and filesystem template loaders enabled. My TEMPLATE_DIRS contains absolute path to the shown templates/ directory. Any tips?
- # 15:30 <Hemebond> elektronisk: Have you added your template path to TEMPLATE_DIRS?
- # 15:30 <elektronisk> yes, in settings.py i have TEMPLATE_DIRS = ('/absolute/path/to/templates/')
- # 15:30 <Hemebond> elektronisk: Is it first in the list?
- # 15:30 <elektronisk> it is the only entry in TEMPLATE_DIRS.
- # 15:30 <Hemebond> Oh, you might also need to put filesystem.Loader first in your TEMPLATE_LOADERS
- # 15:30 <elektronisk> that did it
- # 15:30 <elektronisk> :D
- # 15:30 <Hemebond> :-D
- # 15:30 <RuslanPopov> http://djbook.ru/forum/topic/532/?page=1#post-2825 - annotation has an error, see SQL
- # 15:30 <elektronisk> thanks Hemebond.
- # 15:30 <holms> anybody available for a job in amsterdam :P?
- # 15:30 <nkuttler> what kind of job?
- # 15:30 <holms> nkuttler: not porn )) pm
- # 15:45 <RuslanPopov> https://github.com/django/django/blob/7692625eb132f23947c4a2d4bc317be5998a621a/django/db/models/query.py#L805 - who this crazy man which add all field into aggregation?
- # 15:45 <Hemebond> flashingpumpkin: Got it all working. But now I realise it can't be used to put media before content blocks. *sigh*
- # 15:45 <Hemebond> Something for me to figure out later I think.
- # 15:45 <Hemebond> flashingpumpkin: Thanks again for your help.
- # 15:45 <holms> seems legit
- # 15:45 <holms> 15:31 < RuslanPopov> https://github.com/django/django/blob/7692625eb132f23947c4a2d4bc317be5998a621a/django/db/models/query.py#L805 - who this crazy man which add all field into aggregation?
- # 15:45 <holms> ;D
- # 15:45 <holms> explain pls somebody
- # 15:45 <RuslanPopov> http://djbook.ru/forum/topic/532/ - check ORM queries and look at their SQL
- # 15:45 <RuslanPopov> this code will never work correctly with postgresql at least
- # 15:45 <RuslanPopov> why those man put all field into aggregation?
- # 15:45 <holms> RuslanPopov: if I were you , i'd put your review on that line (in github)
- # 15:45 <holms> with this link =}
- # 15:45 <holms> this helps usually
- # 15:45 <RuslanPopov> ok
- # 15:45 <holms> django devs are slow at fixing bugs
- # 15:45 <holms> at least it's like 40% less then I had them in django 1.1
- # 15:45 <RuslanPopov> I see no button to leave a comment there
- # 15:45 <holms> hmz
- # 15:45 <holms> sad
- # 16:00 <holms> lol even in master it's not fixed https://github.com/django/django/blob/master/django/db/models/query.py
- # 16:00 <holms> maybe you could fork and fix it
- # 16:00 <RuslanPopov> I HAVE FOUND A BUG IN DJANGO :)(
- # 16:00 <holms> they won't fix it like forever if it's still not handled ;D
- # 16:00 <holms> https://code.djangoproject.com/newticket
- # 16:00 <holms> :P
- # 16:00 <bmbouter> hey, I'm having some trouble overridding a single field clean method on a ModelForm
- # 16:00 <bmbouter> I really want to override the validation of that field because the form complains that it never passes validation
- # 16:00 <bmbouter> I modify the form with javascript (client requirements) so the backend validator isn't going to work
- # 16:00 <bmbouter> http://dpaste.com/725676/
- # 16:15 <bmbouter> anyone?
- # 16:15 <bmbouter> my clean method is just not getting called
- # 16:15 <bmbouter> it should be
- # 16:15 <bmbouter> but it is not
- # 16:15 <byomkeshbakshi> hi is it possible for some models, I dont want to show delete action or allow edit in admin. just display data
- # 16:15 <PKKid2> byomkeshbakshi, http://stackoverflow.com/questions/1618728/disable-link-to-edit-object-in-djangos-admin-display-list-only
- # 16:15 <byomkeshbakshi> ok thanks will look into it
- # 16:30 <holms> bmbouter: so just override the form ))
- # 16:30 <holms> or take care of validation from view
- # 16:30 <bmbouter> yes but it should work
- # 16:30 <bmbouter> def clean_school(self)
- # 16:30 <bmbouter> it's properly indented
- # 16:30 <bmbouter> when you say override the form, I think I already am
- # 16:30 <Hemebond> flashingpumpkin: Couldn't sleep. Found this https://github.com/ojii/django-sekizai
- # 16:30 <Hemebond> Works well (if a little verbose)
- # 16:30 <ojii> Hemebond, glad you like it
- # 16:30 <Hemebond> Hey!
- # 16:30 <Hemebond> I was quite surprised when I found it.
- # 16:30 <Hemebond> ojii: If I can mention one thing, it wasn't immediately clear to me that it would only de-duplicate based on the entire block, not the items the block contained.
- # 16:30 <ojii> Hemebond, "items"?
- # 16:30 <Hemebond> Script elements.
- # 16:30 <flashingpumpkin> Hemebond, yeah, I was about to suggest to introduce a new block tag too
- # 16:30 <Hemebond> I had addtoblock around a whole lot of script elements.
- # 16:45 <flashingpumpkin> that way you can add the media files to the head
- # 16:45 <Hemebond> Then another that duplicated one script element.
- # 16:45 <flashingpumpkin> (just prepend it to all the rendered child blocks)
- # 16:45 <Hemebond> flashingpumpkin: It didn't even occur to me that I could create a new block tag.
- # 16:45 <bmbouter> I wonder how the clean_ methods are looked up by modelform?
- # 16:45 <ojii> Hemebond, http://docs.django-cms.org/en/latest/extending_cms/custom_plugins.html#sekizai-style
- # 16:45 <ojii> Hemebond, maybe I should add that to the official docs
- # 16:45 <Hemebond> ojii: Yeah, I was reading the Sekizai docs.
- # 16:45 <ojii> Hemebond, sekizai is stupid on purpose when it comes to content in addtoblock.
- # 16:45 <Hemebond> ojii: That's fine. It just took me some trial and error to figure out what it was doing.
- # 16:45 <ojii> Hemebond, btw we had some discussions about sekizai recently and we might even get rid of the restrictions for render_block! YAY!
- # 16:45 <Hemebond> Restrictions?
- # 16:45 <ojii> http://django-sekizai.readthedocs.org/en/latest/restrictions.html#render-block
- # 16:45 <Hemebond> Oh.
- # 16:45 <ojii> especially the "must NOT be in another block-like tag"
- # 16:45 <Hemebond> Yeah, I was just this minute dealing with that.
- # 16:45 <ojii> ;-)
- # 16:45 <ojii> Hemebond, the workaround for now: http://django-sekizai.readthedocs.org/en/latest/usage.html#processing-sekizai-data
- # 16:45 <ojii> ACTION needs to write nicer docs for this stuff
- # 16:45 <Hemebond> Well, with that issue mostly solved, it's back to bed.
- # 16:45 <Hemebond> Thank ojii.
- # 16:45 <Hemebond> *Thanks
- # 16:45 <ojii> good night Hemebond
- # 17:15 <Meztek> anyone here setup 1.4 with centos 5.8?
- # 17:15 <kyrix> Meztek, the underlying OS should have very little influence on the django version
- # 17:15 <kyrix> Meztek, what python version are you using?
- # 17:15 <Meztek> 2.4
- # 17:15 <Meztek> and whm
- # 17:15 <Meztek> whm/cpanel
- # 17:15 <Meztek> on vps
- # 17:15 <Meztek> i know if u upgrade python it breaks yum
- # 17:15 <mattmcc> Meztek: Django 1.4 doesn't support Python 2.4. https://docs.djangoproject.com/en/dev/releases/1.4/#python-compatibility
- # 17:15 <Meztek> i know this
- # 17:15 <evelyette> hi
- # 17:15 <evelyette> I'm trying to solve the 403 error I'm getting if sending POST requests to django server ... if I send GET request everything works, but not for POST
- # 17:15 <evelyette> any ideas why ?
- # 17:15 <gandalfar> evelyette, CSRF?
- # 17:15 <Meztek> maybe ill try #centos :)
- # 17:15 <gandalfar> evelyette, do you have {% csrf_token %} in your forms?
- # 17:15 <evelyette> gandalfar, no I don't, so I need to put this in my template ?
- # 17:15 <gandalfar> evelyette, https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
- # 17:15 <kyrix> meztek: if you don't want to touch your system python, i recommend using pythonbrew
- # 17:15 <burhan> Meztek: try upgrading to CentOS 6
- # 17:15 <kyrix> Meztek, you will need certain libraries & compiler. here an example for a debian based system as a guide: http://stackoverflow.com/questions/6377921/problems-compiling-python-3-2-and-2-7-using-pythonbrew/8324176#8324176
- # 17:15 <Meztek> burhan: update a vps running live sites... me thinks not :)
- # 17:15 <evelyette> gandalfar, is there any way to disable that for testing purposes ... because I just want to post some data to a view and that's it ...
- # 17:30 <burhan> 2.4 is quite ancient in python world.
- # 17:30 <gandalfar> evelyette, yes, https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#csrf-protection-should-be-disabled-for-just-a-few-views
- # 17:30 <gandalfar> evelyette, or just remove it from your middleware list
- # 17:30 <evelyette> ok I've done that, but now I'm getting the 500 error :)
- # 17:30 <gandalfar> evelyette, .. enable debug :)
- # 17:30 <evelyette> gandalfar, I have it enabled
- # 17:30 <gandalfar> evelyette, so what does the 500 say?
- # 17:30 <evelyette> nothing ... and I'm using telnet to send POST requests
- # 17:30 <anandjeyahar> hi, how do i get the inline forms in django customized admin form to display values/records from my table?
- # 17:30 <PKKid2> Whats that django error logging pckage to log errors to a new admin page?
- # 17:30 <gandalfar> PKKid2, I'm using raven/sentry combo
- # 17:30 <gandalfar> PKKid2, but that's a bit more heavy
- # 17:30 <PKKid2> gandalfar, thanks
- # 17:30 <PKKid2> sentry is the name i was trying to remember.
- # 17:30 <gandalfar> evelyette, hmmm, not sure. Try to make it a simple web form.
- # 17:30 <fishhead2567> any tastypie users around?
- # 17:30 <anandjeyahar> how do i customize the django admin app's views.pyu?
- # 17:30 <anandjeyahar> i am guessing i'll have to modify that to query my child table and pass to the render for displaying the child table data on the inline form.
- # 17:30 <anandjeyahar> right?
- # 17:30 <fishhead2567> anandjeyahar, what are you specifically trying to modify
- # 17:30 <anandjeyahar> fishhead2567: i have an inline form to modify child table details. It accepts new values entered from the form and displays them alright. But when i have entered data from a sql dump, it doesn't display the child table entries.
- # 17:30 <fishhead2567> anandjeyahar, ahh. that's a bit beyond what iwas thinking. I've resknned it, but i don't have experience modifying its forms
- # 17:30 <Meztek> http://www.slideshare.net/itisreal/rails-vs-django-study-presentation
- # 17:30 <Meztek> lol
- # 17:30 <anandjeyahar> fishhead2567: Ok. I have another part too. I need to change the admin list form displays
- # 17:30 <anandjeyahar> i.e: instead of saying NSPatSet Object, i want to display a field from that model. Any suggestions?
- # 17:45 <evelyette> gandalfar, ok I get the error now: Exception Value: name 'csrf_exempt' is not defined
- # 17:45 <evelyette> yeah I need to import the definition
- # 17:45 <fishhead2567> anandjeyahar, like inline? use the unicode method
- # 17:45 <russellneufeld> Hi all - is there a way to tell from django settings whether you are running from with a django management command or not?
- # 17:45 <fishhead2567> anandjeyahar, in the model defunition... create a function __unicode__(self) and have it return the data you want to see
- # 17:45 <anandjeyahar> fishhead2567: Hmm.. django admin pages use the __unicode__ function ok.. will try that. thanks.
- # 17:45 <nzee> I have a string " click this -> http:google.com " and I want to display this string on template but make the url click-able. How do I do it?
- # 17:45 <anandjeyahar> fishead2567: Thanks it works... Darn it sounds obvious in retrospect.. i feel silly for asking :-P
- # 18:00 <gandalfar> nzee, write <a href> ?
- # 18:00 <nzee> gandalfar, I got it. {{string|urlize}} does the trick
- # 18:00 <gandalfar> nzee, oh, nice :)
- # 18:00 <nzee> gandalfar, thnx anyways :)
- # 18:00 <artsim> Hi guys, need some help in dispaying a form within a modal window using bootstrap
- # 18:00 <gandalfar> artsim, what's the issue?
- # 18:00 <artsim> The form is not being displayed
- # 18:00 <artsim> still learning both django and bootstrap so i might be missing something obvious
- # 18:00 <artsim> here is a link to the code http://stackoverflow.com/questions/9979622/how-do-i-insert-a-django-form-in-twitter-bootstrap-modal-window
- # 18:00 <gandalfar> artsim, no html? How are you rendering it?
- # 18:00 <wassup> artsim: you need to write external forms.html file that you use in your templates later
- # 18:00 <magcius> http://fpaste.org/vToQ/ -- does anybody know what would cause this import error?
- # 18:00 <magcius> Looks like a circular import, but why?
- # 18:15 <artsim> wassup: how exactly do I do that? Do i render the forms to html?
- # 18:15 <mikeshultz> I think I'm hitting a web server timeout before django is timing out. So the process continues to run in the background even though the final page couldn't be served anyway. Where might I find settings for django timeout(if there is one)?
- # 18:15 <wassup> artsim: http://brainacle.com/how-to-use-django-uni-form-with-twitter-bootstrap-css.html
- # 18:15 <wassup> have a look here, it might give you a clue
- # 18:15 <nkuttler> mikeshultz: er, what would you expect that setting to do?
- # 18:15 <mikeshultz> nkuttler: Timeout the running scripts, if possible.
- # 18:15 <nkuttler> you mean kill them?
- # 18:15 <mikeshultz> nkuttler: If necessary. They're bunk at that point, anyway.
- # 18:15 <artsim> wassup: that would mean i have to rewrite the forms
- # 18:30 <v0lksman> anyone know how to see outstanding migrations in south?
- # 18:30 <v0lksman> IE migrations that are available but haven't been run
- # 18:30 <gandalfar> v0lksman, --list List migrations noting those that have been applied
- # 18:30 <gandalfar> voidy, ./manage.py help migrate
- # 18:30 <gandalfar> ups :)
- # 18:30 <v0lksman> gandalfar: excellent...thanks!
- # 18:30 <mpbsc> hi, our tinymce editor is producing a javascript error, type property cannot be changed, after we upgraded django-cms
- # 18:30 <mpbsc> has this been reported?
- # 18:30 <wassup> artsim: not rewrite them
- # 18:30 <wassup> just include a section in your templates that refers to forms.html or fields.html or however you call it
- # 18:45 <artsim> wassup: will keep trying with your pointers, hopefully it will work
- # 18:45 <artsim> wassup: thanks
- # 19:00 <sansb> what's the best way to override django.contrib.auth.models.User.__unicode__? http://dpaste.org/aq0JS/
- # 19:00 <sansb> Ah, found an SO: http://stackoverflow.com/questions/5062493/override-django-user-model-unicode
- # 19:00 <Vadimus> Webfaction, django app, using virtualenv. Trying to install Django in evironment, but pip finds Django in webapps/appname/lib ... How to remove this path?
- # 19:00 <iiie> Vadimus: if you're using virtualenv you need to be sure that the virtualenv's sitepackages is earlier in sys.path, then install with "pip install -U django==VERSION"
- # 19:00 <RuslanPopov> re ppl, I need help with aggregation
- # 19:00 <RuslanPopov> select firm_id, info_id, sum(earned) from bablo_mobileearn group by firm_id, info_id;
- # 19:15 <Vadimus> iiie: doesn't work. I need to remove some paths from sys.path but not in python
- # 19:15 <explodes> I want a readonly Inline in my model admin. This works fine, just set all of the fields to readonly. Is there any way to disable adding new records?
- # 19:15 <explodes> In the inline**
- # 19:15 <mpbsc> hi, our tinymce editor is producing a javascript error, type property cannot be changed, after we upgraded django-cms
- # 19:15 <mpbsc> has this been reported?
- # 19:30 <riley526> Why is everything in unittest camelCase? I thought the convention was underscores for function_names.
- # 19:30 <ionelmc> riley526: it's inspired by the java counterpart
- # 19:30 <ionelmc> it's also very old
- # 19:30 <riley526> ionelmc: Hm
- # 19:30 <riley526> ionelmc: So is it best to follow along, or should I be writing my TestCase methods with underscores?
- # 19:30 <riley526> even though I'm overriding setUp()
- # 19:30 <riley526> so then I'd have a mix of camel case and underscores
- # 19:30 <ionelmc> i don't think i ever saw a test case with test methods in camelcase
- # 19:30 <ionelmc> style is subjective anyway
- # 19:30 <ionelmc> you can follow pep8 or not
- # 19:30 <riley526> "Django 1.1 Testing and Debugging" by Karen M. Tracey defines test methods in camel case
- # 19:30 <riley526> lol
- # 19:30 <gandalfar> riley526, django test suite uses CameCase for TestCase and underscore for each function
- # 19:45 <percent20> I am creating a reusable django application. Is there a way to include a javascript file with it and reference that in a template
- # 19:45 <RuslanPopov> this is python related question
- # 19:45 <nicholasserra> Hey everyone. Having a dumb moment. Can a django form handle invalidating initial strings automatically? For example I have a contact form with a subject box. The value of the box is "Enter subject". I obviously want to invalidate that field if it still says that on post.
- # 19:45 <nicholasserra> Without having to make a clean for each field.
- # 19:45 <jaddison> nicholasserra: This is an approach (html5 way is awesome) http://stackoverflow.com/questions/6047943/adding-input-prompts-to-html-form-fields javascript way is good too.
- # 19:45 <at3560k> I've been having difficulty finding something I'm pretty sure exists. Hope I'm googling wrong. I know I can set verbose_name/plural on the Meta of a model. What if I want to change the section label of the entire plugin under admin? Maybe instead of "CMS" say "Content Management" for example ?
- # 19:45 <gandalfar> nicholasserra, clean() .. if self.cleaned_data().get('subject') == "enter..":
- # 20:00 <gandalfar> jaddison, in my experience, I still get a few direct form submissions in logs. Strange :)
- # 20:00 <nicholasserra> jaddison: Yeah i'm looking for a view logic approach though :(
- # 20:00 <nicholasserra> gandalfar: yeah, thats going to be my fallback. Wondering is there is any other way to do it.
- # 20:00 <SimSala> Hi guys! I am trying to complete the part 2 of the tutorial at djangoproject.com. But i can't get the admin site up.. I only get "Site matching query does not exist"
- # 20:00 <SimSala> anybody know why i get this message?
- # 20:00 <gandalfar> SimSala, did you change SITE_ID in settings.py?
- # 20:00 <gandalfar> nicholasserra, I only have complex ideas, atm :)
- # 20:00 <SimSala> site_id is 1
- # 20:00 <eshlox> example, application to add pictures, user gets form, enter title, select photo, clicks save, loading file to directory, entry added to database, app has lot of traffic, one file per second, what would be the bes way to validate file type and change size? type checking in form validator and resize immediately with pil can be difficult for server, checking this and resize with js may take a long time, any ideas? ;-)
- # 20:00 <gandalfar> SimSala, weird
- # 20:00 <wcapio> hi guys, how do you have a field in a model be filled with multiple entries? I want to make something like a fb like where you can check who liked...
- # 20:00 <gandalfar> eshlox, celery
- # 20:00 <gandalfar> eshlox, some sort of backend queue, celery is one example. Say to user "thanks" and add it to queue, and then you can also offload it to other server.
- # 20:00 <eshlox> gandalfar: this may be a good solution, thanks, i check it
- # 20:00 <drojas> How can I embed the registration/registration_form template in other template?? I need to render it like the 'render :partial' function in Rails
- # 20:00 <fxdgear> ACTION needs to setup a block on espn.com at home
- # 20:00 <queso> I'm going to be starting a new project soon and was researching which framework to use. I am considering Django and Flask. Django looks preferable right now because it appears as though it would be the more rapid route. Although, I have heard that there are some limitations related to the django ORM. Are those limitations documented anywhere? (Or perhaps some of them have been addressed in the recent release?) The project I'm starti
- # 20:15 <drojas> queso: can you describe the goodness of Flask please?
- # 20:15 <drojas> I'm curioues
- # 20:15 <drojas> *curious
- # 20:15 <wcapio> I want to make something like a fb like where you can check who liked... any idea on what this model would look like?
- # 20:15 <gandalfar> queso, you'll have to be more specific about 'limitations'
- # 20:15 <queso> drojas: You might want to do some web searching or ask in #pocoo, I'm not here to advertise.
- # 20:15 <drojas> queso: ok..
- # 20:15 <hanthana> how to remove django if installed from the source
- # 20:15 <queso> gandalfar: I wish I could be more specific.
- # 20:15 <gandalfar> queso, if you hit limitations, you can always drop to 'raw sql'
- # 20:15 <gandalfar> queso, through django's orm layer and still keeping some of the benefits. But it's hard to say wihtout knowing more about your DB needs.
- # 20:15 <queso> gandalfar: Actually, I think you just saying that already makes me more comfortable.
- # 20:15 <joshuajonah> hanthana: Just delete everything that comes up when you search: # find / -name "django"
- # 20:15 <drojas> Hey guys.. How can I embed a given template in another?
- # 20:15 <gandalfar> drojas, "include"
- # 20:15 <drojas> gandalfar: thx
- # 20:15 <gandalfar> drojas, or you mean {% extend %}?
- # 20:15 <joshuajonah> or do you mean {% extends %}
- # 20:15 <gandalfar> tnx :)
- # 20:15 <drojas> gandalfar: I need something like the render partial function of RoR
- # 20:15 <joshuajonah> :D
- # 20:15 <gandalfar> drojas, I have no idea what that does :)
- # 20:15 <joshuajonah> so include
- # 20:15 <naka> if all you need is this like functionality, you could probably use django, flask, or ror depending on your preference
- # 20:15 <drojas> joshuajonah: thx!
- # 20:30 <joshuajonah> wtf?
- # 20:30 <sobersabre> ubernostrum: u here?
- # 20:30 <sobersabre> hi.
- # 20:30 <sobersabre> ubernostrum: what rev. was 0.8alpha1 ?
- # 20:30 <sobersabre> hm, sorry. I'm talking about django-registration.
- # 20:30 <sobersabre> I've found 4 changesets on 13th in Oct 2009.
- # 20:45 <KorriX> \join #django-pl
- # 20:45 <joshuajonah> no
- # 20:45 <n9er> I have a timeout while ffmpeg is running using nginx + fastcgi, nginx keepalive_timeout and fastcgi read/send timeout set very high
- # 20:45 <johnnny22> is there a built-in way of making the contrib.auth require https for the login ?
- # 20:45 <johnnny22> actually, requiring https once logged in would probably be more sane than just the login :P
- # 20:45 <johnnny22> cookies can be sniffed ;)
- # 20:45 <johnnny22> but maybe i'm mad
- # 20:45 <johnnny22> *always worried about users logging in via open wifi's :P
- # 20:45 <seanbrant> johnnny22: you could write a middleware that does it
- # 20:45 <johnnny22> seanbrant: yeah, thinking about it :)
- # 20:45 <seanbrant> johnnny22: http://pypi.python.org/pypi/django-secure might have some useful stuff
- # 20:45 <johnnny22> oOh
- # 20:45 <johnnny22> saw the honeypot app :P
- # 20:45 <johnnny22> and django-brutebuster
- # 20:45 <johnnny22> thinking of putting those 2 along
- # 21:00 <johnnny22> thanks for the link, eating as i type
- # 21:00 <d0ugal> djangosecure.middleware.SecurityMiddleware is what you want IIRC
- # 21:00 <johnnny22> seems like it ;)
- # 21:00 <johnnny22> i'm so taking a look into it :)
- # 21:00 <joshuajonah> n9er: You need a task processing queue. Look into celery.
- # 21:00 <joshuajonah> n9er: http://djangopackages.com/grids/g/workers-queues-tasks/
- # 21:00 <johnnny22> yeah n9er, you really don't want your app to do the video conversion jobs.. delegate it to a system :)
- # 21:00 <saju_m> i could see that lot of python API methods returning result as tuple, for example dict of tuple, list of tuple. Have any advantage to do like this ???
- # 21:00 <sharkmonkey> Can I have an inline list in a template? Something like {% for col in [ 9, 7, 8 ] %}?
- # 21:00 <johnnny22> adding video conversion support does indeed seem like a big feat in a way..
- # 21:00 <johnnny22> sure costs more !:P
- # 21:00 <saju_m> what is the recommended type of function's return value ?
- # 21:00 <joshuajonah> saju_m: Thats pretty open ended. Whatever you want the return to be
- # 21:00 <saju_m> so tuple doesn't have any special use, right ?
- # 21:00 <saju_m> recently i used adwords python api client, there i could see that all methods returning a tuple
- # 21:15 <joshuajonah> saju_m: That's just a design philosophy of the writer.
- # 21:15 <jwpeddle> Am I stupid or is just not possible to pass kwargs to an inclusion tag?
- # 21:15 <gandalfar> jwpeddle, sure it is
- # 21:15 <gandalfar> jwpeddle, http://stackoverflow.com/questions/2111555/django-templates-changing-context-for-an-include-template
- # 21:30 <jwpeddle> gandalfar: not sure what this link has to do with inclusion tags. Just trying to do {% tag foo=1 %} instead of {% tag 1 %} and I get "VariableDoesNotExist while rendering: Failed lookup for key" (in 1.3, anyways)
- # 21:30 <jwpeddle> it's silly that after 5 years of Django I still can't remember how to do practically anything with template tags :|
- # 21:30 <tylerl> is django-cms generally considered the best cms engine for django?
- # 21:30 <tylerl> or is there another one I should check out?
- # 21:30 <gandalfar> jwpeddle, {% with foo=1 %}{% include "my.html" %}{% endwith %}
- # 21:30 <gandalfar> jwpeddle, oh sorry, tags ... not {% include %}
- # 21:30 <jwpeddle> yeah, I mean a tag decorated with @register.inclusion_tag
- # 21:30 <dstufft> What all hapens if you change a sites secret key? do sessons jsut get invalidated?
- # 21:30 <jwpeddle> Looks like this works in 1.4 though, so maybe they didn't work before
- # 21:45 <dogarrhea2> time to start thinking about going live..
- # 21:45 <dogarrhea2> webfaction ?
- # 21:45 <gandalfar> dogarrhea2, works great for me
- # 21:45 <johnnny22> dogarrhea2: works great for me too :)
- # 21:45 <dogarrhea2> ok.
- # 21:45 <hanthana> joshuajonah, thanks
- # 21:45 <dogarrhea2> time to think of a domain name
- # 21:45 <johnnny22> mysite.xxx ? lol
- # 21:45 <dogarrhea2> music related
- # 21:45 <dassouki> What's the ideal way to use class based views to return a spefied record of a model? Should I use detailview or listview?
- # 21:45 <dogarrhea2> oh ... so all my work this past couple of months is now deprecated since views are no longer functions
- # 22:00 <joshuajonah> dogarrhea2: If you were better this wouldn't be an issue.
- # 22:00 <dogarrhea2> n.
- # 22:00 <dogarrhea2> in a few years people will throw away django entirely as well..
- # 22:00 <joshuajonah> I'm just screwing with you. But seriously, get better.
- # 22:00 <RuslanPopov> re ppl, I need help with aggregation
- # 22:00 <dogarrhea2> i'm not gonna waste time on this refactoring
- # 22:00 <dogarrhea2> i have more interesting things to do
- # 22:00 <Spindel_> http://dpaste.com/725870/ - Gives me int() argument must be a string or a number, not 'tuple'
- # 22:00 <nomulous> I have staticfiles set up, but Django admin points to "/staticfiles/admin/css/base.css" which says "/site-packages/django/contrib/admin/media/css/base.css" does not exist"
- # 22:00 <nomulous> What's up with that?
- # 22:00 <jaddison> Spindel_: I don't think you have enough code pasted there.
- # 22:00 <johnnny22> dogarrhea2: oh no, your back ? :P
- # 22:00 <jaddison> Oh, wait, yes you do, Spindel_.
- # 22:00 <dmishe> Hey, is there a way to output SQL during testing?
- # 22:00 <Spindel_> jaddison: I checked the docs, seems like it returns a tuple of obj, created
- # 22:00 <jaddison> get_or_create returns the object itself along with a True or False that tells you if it was created - both in a tuple
- # 22:00 <jaddison> Yes.
- # 22:00 <Spindel_> So... How should the code look like?
- # 22:00 <jaddison> so do company1, created = blah.objects.get_or_create(
- # 22:00 <jaddison> Spindel_: see http://dpaste.com/725871/
- # 22:00 <Spindel_> Oh... I see
- # 22:00 <jaddison> Yah mon.
- # 22:00 <Spindel_> Thank you :)
- # 22:00 <jaddison> np.
- # 22:00 <m1chael> what would the best way to do this: i have a template, and i need to have a django admin area so that I can edit the template
- # 22:00 <jaddison> m1chael: database templates instead of file-based templates?
- # 22:00 <m1chael> it could stay file based, i just need a way to edit it
- # 22:00 <PKKid2> m1chael, I generally use something more human editable such as Markdown, and store that in the database.
- # 22:00 <nomulous> Does anybody know why the admin media is 404ing?
- # 22:00 <nomulous> It's true that the files don't exist... the paths are different
- # 22:00 <PKKid2> m1chael, And Django comeswith a markdown -> HTML converter IIRC.
- # 22:00 <PKKid2> nomulous, You may need to run collectstatic?
- # 22:00 <nomulous> It's looking for "/site-packages/django/contrib/admin/media/css/base.css", but it's "/site-packages/django/contrib/admin/static/admin/css/base.css
- # 22:00 <nomulous> PKKid2: But I have the 'django.contrib.staticfiles.finders.AppDirectoriesFinder' finder installed, that should work, right?
- # 22:00 <PKKid2> nomulous, Are you running in DEBUG=True or False?
- # 22:00 <nomulous> It's set to True
- # 22:00 <RuslanPopov> ppl, how to write a query with ORM: select firm_id, info_id, sum(earned) from bablo_mobileearn group by firm_id, info_id; ?
- # 22:00 <nomulous> And running collectstatic didn't change anything
- # 22:15 <PKKid2> RuslanPopov, You want to use .annotate(...)
- # 22:15 <PKKid2> nomulous, Do you have this in CnotextProcessors? 'django.core.context_processors.static',
- # 22:15 <RuslanPopov> http://djbook.ru/forum/topic/532/ - I have tried, it has a bug
- # 22:15 <RuslanPopov> it duplicates a group_by fields
- # 22:15 <nomulous> PKKid2: No, I didn't. I've added it though, and still the same
- # 22:15 <PKKid2> RuslanPopov, huh? thats looks like it worked to me.. not sure what output you want.
- # 22:15 <PKKid2> nomulous, Restart the dev server when adding things like that to settings.
- # 22:15 <nomulous> I did
- # 22:15 <PKKid2> nomulous, Also, check this is in installed apps: 'django.contrib.staticfiles',
- # 22:15 <RuslanPopov> I just need to solve simple sql task, and annotate doesn't help
- # 22:15 <nomulous> Yeah, that was the first thing I checked
- # 22:15 <nomulous> It's definitely there
- # 22:15 <dogarrhea2> We shall take reasonable measures to endeavour to maintain our services, but you will not be eligible for any compensation because of any loss or unavailability of any service we provide. We reserve the right to change any service at any time.
- # 22:15 <dogarrhea2> We shall not be held responsible for any loss however caused resulting from any suspension or unavailability of any service.
- # 22:15 <dogarrhea2> You are responsible for any material stored on our servers. We shall not be held responsible for any loss, however caused, of this material.
- # 22:15 <dogarrhea2> hrm. a hosting service not responsible for hosting. sounds fun
- # 22:15 <RuslanPopov> http://dpaste.com/725878/ - it doesn't aggregate
- # 22:15 <m1chael> im pretty sure all hosting companies say that in their legal terms
- # 22:15 <nomulous> It broke when I started using 1.4
- # 22:15 <dassouki> What's the ideal way to use class based views to return a spefied record of a model? Should I use detailview or listview or am I off in the rhubarb?
- # 22:15 <RuslanPopov> Full example - http://dpaste.com/725880/
- # 22:15 <andornaut> Just upgraded south to get around a django 1.4 datetime related error during migration. Now I get "ValueError: Function for on_delete could not be serialized.", any ideas?
- # 22:15 <andornaut> (same happens with south "tip")
- # 22:30 <smsfail> so I want to build an edit form. I use forms to build the inputs, but how do I select the record from the database and pass it to the template as a form? anyone
- # 22:30 <Absolute0> How can I get the base url of the site?
- # 22:30 <heiths> is it anti-'loose coupling' to make ForeignKeys to models in other applications?
- # 22:30 <Absolute0> for runserver localhost:8000 will return.
- # 22:30 <m1chael> PKKid2: im looking at markdown, im confused. do i really need this?
- # 22:30 <heiths> also, I'm trying to build a form that will allow up to three submissions for a given value... any suggestions?
- # 22:30 <m1chael> i want a django admin app that allows editing of a django html template
- # 22:30 <dlam> is there a way on a model to do some processing whenever .save() is called on it?
- # 22:30 <dmishe> m1chael have you seen this http://pypi.python.org/pypi/django-dbtemplates ?
- # 22:30 <dlam> i have an Article which can be set to a boolean 'featured', and i wanna record if an Article was featured before
- # 22:30 <andornaut> so, I've figured out that south schemamigration dies with an error if any of my models have on_delete=models.SET(get_sentinel_user)
- # 22:30 <ojii> okay so I have a management command that has to download about 15000 images and save them to django models. what would be the smartest way to parallelize that?
- # 22:30 <RuslanPopov> http://stackoverflow.com/questions/6835355/can-i-control-the-group-by-in-django-1-3s-orm - the good example of BUG
- # 22:30 <Mogget> In my templates, i wish to use external .css documents. Where would i have to store these so that they will be used when rendering the pages?
- # 22:30 <heiths> I put mine on an external server and just link them into the base.html. did you try that?
- # 22:30 <Mogget> heiths: no, i was hoping to host them on my own server. i though maybe there was "proper" place to put it in django.
- # 22:30 <ojii> if i want to store the file associated with instance1.myfile to instance2. can I just do instance2.myfile = instance1.myfile;instance2.save()?
- # 22:30 <heiths> I think, and I'm new so I could be wrong, you just put them where ever your 'MEDIA' location is pointed to in your settings.py... then you just link them like: {{ MEDIA }}/style.css (for example)
- # 22:45 <RuslanPopov> WTF - http://dpaste.com/725880/
- # 22:45 <dmishe> RuslanPopov However, when a values() clause is used to constrain the columns that are returned in the result set, the method for evaluating annotations is slightly different. Instead of returning an annotated result for each result in the original QuerySet, the original results are grouped according to the unique combinations of the fields specified in the values() clause
- # 22:45 <dmishe> https://docs.djangoproject.com/en/1.4/topics/db/aggregation/#values
- # 22:45 <dmishe> put values after annotate
- # 22:45 <nomulous> Can somebody tell me why "/staticfiles/admin/css/base.css" looks for "/django/contrib/admin/media/css/base.css" ?
- # 22:45 <nomulous> There's no such file anymore
- # 22:45 <RuslanPopov> dmishe, it doesn't help, because annotate() add all field into GROUP BY clause
- # 22:45 <lacrymology> is there a way to do math in the templates? I need to give a div the class "span{{ 12 / list|length }}"
- # 22:45 <dmishe> hm, well only raw() then i guess
- # 22:45 <RuslanPopov> this is a bug
- # 22:45 <RuslanPopov> as I see on stackoverflow,ppl know about since jul 2011
- # 22:45 <RuslanPopov> and 1.4 has the same code :(
- # 22:45 <Yxven> lacrymology: calculate that in the view and pass it to the template?
- # 22:45 <RuslanPopov> lacrymology, try inclusion_tag
- # 22:45 <lacrymology> Yxven: not an option. Plus, that'd kinda break responsibility separations
- # 22:45 <lacrymology> RuslanPopov: well, of course I can always make my own filter, I was asking if there was a built-in way
- # 22:45 <ionelmc> RuslanPopov: maybe you have default ordering in model's Meta ?
- # 22:45 <ionelmc> remove it
- # 23:00 <dogarrhea2> cool. registered my domain
- # 23:00 <dogarrhea2> can't believe it wasn't taken
- # 23:00 <Yxven> What domain?
- # 23:00 <dogarrhea2> a secret. for now
- # 23:00 <apollo13> dogarrhea2: please keep that kind of off topic out of here, thx
- # 23:00 <russellneufeld> Does anyone here have experience with using pylibmc from django? I'm trying to find out how to use the "remove_failed" setting
- # 23:00 <caitifbrito> Hi folks, anyone know how generate a Graph ER with informations that 1->N, N2N,... Without graph_model extension!?
- # 23:00 <caitifbrito> if use GraphViz it's cool
- # 23:15 <dogarrhea2> hrm. anyone who hosts django on webfaction, is the default ssh password different from your administrative login account's password/
- # 23:15 <dogarrhea2> bah nevermind. instructions never said to use control panel to change ssh password. it said "use your WebFactional account password to log into ssh"
- # 23:15 <dogarrhea2> fail
- # 23:15 <barefoot> ACTION doesnt care
- # 23:15 <thongor> I am going through the "Practical Django Projects" coltrane tutorial and I am getting a "CSRF token missing or incorrect" when I try to add a flatpage. My question is: what file would I edit to fix this error?
- # 23:15 <Yxven> csrf tokens have to do with form submissions
- # 23:15 <Yxven> Most likely you are missing {% csrf_token %} inside of a form
- # 23:15 <thongor> If it was a form that I made I would know where to go, but this something to do with the admin page.
- # 23:15 <thongor> https://bitbucket.org/ubernostrum/practical-django-projects/src
- # 23:15 <thongor> that's the source code for the lesson.
- # 23:15 <dogarrhea2> maybe he's using ajax and doesn't have the ajax crsf file
- # 23:15 <thongor> So is this a template issue then?
- # 23:15 <Yxven> thongor, your tutorial was written for django 2.1, and csrf protection was added in 2.2 or 2.3?
- # 23:30 <apollo13> Yxven: django 2 doesn't exist yet ;)
- # 23:30 <Yxven> thongor: just install an older version of django to complete the tutorial. Most of what you learn will still apply
- # 23:30 <thongor> I figured. But then I also thought trying to get it to work on a newer version on Django might be worthwhile.
- # 23:30 <thongor> As a learning experience.
- # 23:30 <Yxven> Sorry I meant 1s
- # 23:30 <thongor> It's a great book, it's too bad that it's so out of date.
- # 23:30 <apollo13> thongor: well first you have to figure out the view where the form is displayed, then figure out the template(s), find the form and add csrf_token
- # 23:30 <thongor> ok
- # 23:30 <Yxven> The tutorial's settings file doesn't include csrf middleware. Why is it bothering him about csrf anyway?
- # 23:30 <apollo13> cause if a view is decorated with csrf required the middleware isn't needed
- # 23:30 <thongor> Yxven: I was wondering the same thing.
- # 23:30 <thongor> Yxven: I went to disable it as a temporary measure and noticed it wasn't there.
- # 23:30 <Yxven> thongor: that means instead of modifying a django project for a learning experience you're modifying the admin module in whatever version of django you actually have installed
- # 23:30 <Yxven> well no
- # 23:30 <Yxven> I'm wrong. The tutorial did customize the admin
- # 23:30 <thongor> Yxven: I saw some lines missing under middleware classes. That's why I thought the protection wasn't enabled.
- # 23:30 <lifeiscontent> Hi there, in a ModelForm how can I overwrite a label on a field?
- # 23:45 <killianes> lifeiscontent: http://stackoverflow.com/questions/636905/django-form-set-label
- # 23:45 <smsfail> this is breaking my syncdb. Anyone know why?? http://dpaste.de/1adAo/
- # 23:45 <seanbrant> smsfail: prob the way you are doing choices
- # 23:45 <seanbrant> smsfail: wrap them in a callable and pass that as the choices arg
- # 23:45 <seanbrant> def get_districts(): return ... (choices=get_districts)..
- # 23:45 <smsfail> thanks seanbrant
- # 23:45 <smsfail> will give that a shot now
- # 23:45 <seanbrant> smsfail: why are you not using a ForeignKey for this?
- # 23:45 <johnnny22> that's a good question :)
- # 23:45 <smsfail> no clue
- # 23:45 <smsfail> I guess I should
- # 23:45 <johnnny22> it'll be nice, try it! :)
← next day
previous day →