May 9, 2012
← next day
previous day →
- # 00:00 <lorn> nkuttler: do you know any example that use that? or pattern? I'm thinking in create a intermediate model that both views will use
- # 00:00 <nkuttler> lorn: hrm, https://docs.djangoproject.com/en/dev/topics/class-based-views/#extending-generic-views maybe?
- # 00:00 <lorn> nkuttler++ thanks
- # 00:00 <logabr> hi guys i just put my django site on my webhost and the urls aren't worked. the project is in a folder off the site so its like www.website.com/djangosite/ and all of my urls are redirecting to www.website.com/url when they should be www.website.com/djangosite/url
- # 00:00 <danols_work> do you guys prefer ForgeinKey('FOO') - string version or from model import somewhere in the classes methods to resolve circular imports ?
- # 00:15 <pjs> danols_work, 'app.Model' works perfectly fine for that
- # 00:15 <danols_work> yes but by default should I be using 'app.Model' or from app import Model ?
- # 00:15 <pjs> danols_work, up to you. It makes no difference
- # 00:15 <danols_work> pjs even speed wise ?
- # 00:15 <pjs> danols_work, any speed issues would be unnoticable. I never even considered that lol. I generally use a string notation by default.
- # 00:15 <danols_work> thanks pjs I think i will start too, cleans up file's import section
- # 00:15 <danols_work> ty
- # 00:15 <pjs> np
- # 00:30 <rclw> Hi. I've got a question about class-based view dispatching
- # 00:30 <rclw> is the following code ok if I override def dispatch?
- # 00:30 <rclw> if self.args and self.kwargs:
- # 00:30 <rclw> return handler(*args, **kwargs)
- # 00:30 <rclw> elif self.args:
- # 00:30 <rclw> return handler(*args)
- # 00:30 <rclw> elif self.kwargs:
- # 00:30 <rclw> return handler(**kwargs)
- # 00:30 <rclw> else:
- # 00:30 <rclw> return handler()
- # 00:30 <mattmcc> Overriding dispatch isn't often needed.. Why do you want to?
- # 00:30 <rclw> this means I can do "def get(self, arg1=None, arg2=None):..."
- # 00:30 <rclw> dirn: so arg1 and arg2 are automatically in the function's namespace
- # 00:30 <mattmcc> What's wrong with self.kwargs['arg1']?
- # 00:30 <rclw> mattmcc: nothing, but it is much less nice than the functional views methods where one can set standard parameters
- # 00:30 <rclw> which is also good for debugging
- # 00:30 <Technodrome> postgres more common than mysql in the django world i take this time of the year?
- # 00:30 <mattmcc> rclw: Eh, I don't buy that argument. The approach CBVs use was partly inspired by the tendency for lists of arguments to get out of control, several of the function-based generic views literally had over a dozen arguments.
- # 00:30 <mattmcc> And debuggers are just as good at giving you access to object instance attributes as locally scoped variables.
- # 00:30 <rclw> mattmcc: I have no interest in generic views
- # 00:30 <mattmcc> Technodrome: "This time of year"? :)
- # 00:30 <mattmcc> Is it seasonal? :)
- # 00:30 <Technodrome> maybe hehe
- # 00:30 <rclw> I just want to check that my url parameters are passed with the least amount of friction into the class
- # 00:30 <Technodrome> i was just seeing what i should deploy on this for this app
- # 00:30 <mattmcc> rclw: You could just not use the CBVs..
- # 00:30 <mattmcc> That would be zero friction.
- # 00:30 <mattmcc> Technodrome: What are you familiar with?
- # 00:30 <rclw> mattmcc: so what precisely is wrong with overloading dispatch ?
- # 00:30 <Technodrome> mattmcc: mysql but postgres seems pretty solid
- # 00:30 <mattmcc> rclw: Eh, do it if you want, I just don't see any real benefit in this case.
- # 00:30 <mattmcc> The justification appears to be "eww, object attributes".
- # 00:30 <mattmcc> Which makes it curious why you'd use a class-based view at all.
- # 00:30 <mattmcc> Technodrome: Well, if you're looking for an opportunity to learn it.. :)
- # 00:30 <rclw> mattmcc: I don't agree (needless to say) -- the url to view interface is just that, a protocol or interface which is loosely typed
- # 00:30 <mattmcc> Technodrome: Except it's not, every DBMS has differences. MySQL, for example, has a variety of behavioral quirks that those of us who know Postgres find pretty hard to tolerate.
- # 00:30 <Technodrome> mattmcc: still? i mean mysql 5.5 did quite a bit
- # 00:30 <mattmcc> Not really.
- # 01:00 <v_y> how do i do array slicing in django templates? the expected [:n] etc doesn't work
- # 01:00 <mattmcc> Well, templates aren't Python. https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#slice
- # 01:00 <logabr> i'm using fastcgi on a shared host and my urls are getting messed up. the site is in a subdir like http://www.example.com/folder, however all of the urls through django's template on the site point to http://www.example.com/pages when they should point to http://www.example.com/folder/pages
- # 01:00 <logabr> according to the docs i might want to try FORCE_SCRIPT_NAME but i'm not having any luck. any suggestions?
- # 01:00 <easytiger> have i gone wrong with this... i have a widget... which contains a div/class which contains a div/class which contains a div/id which contains a div/id *3 one of which contains div/id * 2. The IDs will all have programatic variable names as they will have javascript render content to them and some will be filled in by text.
- # 01:00 <easytiger> My issue is... is it bad i now have to generate the CSS and maybe some javascript?
- # 01:00 <easytiger> is that normal? or is that the job i signed up for. I know it can work. Just seems inelegant. Though my design is very nice.
- # 01:15 <mattmcc> Well, as long as you're not dealing with too much data or complex queries, that's probably fine.
- # 01:15 <mattmcc> But no two DBMSs behave the same way beyond very trivial operations.
- # 01:15 <carljm> Or datetimes with greater than one second precision, or schema migrations, or...
- # 01:15 <mattmcc> I mean, look at the stuff that _isn't_ standard SQL, like limiting result sets.
- # 01:15 <superdmp> is there some convenient way to disable all users' access to admin functions temporarily?
- # 01:15 <superdmp> except superuser of course
- # 01:15 <mattmcc> Flip is_staff off for all of them?
- # 01:15 <superdmp> mattmcc: there are too many
- # 01:15 <superdmp> and even if I did it in the shell, some were not is_staff to beginwith
- # 01:15 <superdmp> so I can't easily turn the right ones back on
- # 01:15 <mattmcc> staff = json.dumps(User.objects.filter(is_staff=True).values_list('is_staff', flat=True)); User.objects.filter(is_staff=True).update(is_staff=False) :P
- # 01:15 <ckniffty> superdmp: do a db dump of the user table as a back up
- # 01:15 <superdmp> a sensible precaution
- # 01:15 <superdmp> it would be nice to be able to use Groups for this
- # 01:15 <mattmcc> Groups are just collections of permissions, they don't determine access to the admin.
- # 01:30 <emr> hows default language code?
- # 01:30 <ckniffty> superdmp: You could also extend AdminAuthenticationForm to only allow superusers.
- # 01:30 <superdmp> ckniffty: I will look at that
- # 01:30 <ckniffty> superdmp: And then set your admin site's login_form property to it.
- # 01:45 <terryleigh> is it possible to do something like this in the template?
- # 01:45 <terryleigh> {% if facility.banners.all %}
- # 01:45 <terryleigh> {% block banner %}
- # 01:45 <terryleigh> <li>...</li>
- # 01:45 <terryleigh> {% endblock %}
- # 01:45 <terryleigh> {% endif %}
- # 01:45 <terryleigh> So that it only replaces the code if there is actually something.
- # 01:45 <mattmcc> You can use {{ block.super }} to access the parent's block contents.
- # 01:45 <mattmcc> So {% block foo %}{% if ... %}...{% else %}{{ block.super }}...
- # 01:45 <terryleigh> ah thanks so much :)
- # 02:15 <lobius> I made a method for my class in models. http://dpaste.org/dOyBw/ did I do it correctly?
- # 02:15 <lorn> nkuttler: ping
- # 02:15 <lobius> I have several methods to make so I thought I would ask before finishing the rest of them.
- # 02:15 <ckniffty> lobius: It would appear so except for the ... which could have been a problem with the copy paste.
- # 02:15 <ckniffty> lobius: I did notice that you are not using self.
- # 02:15 <ckniffty> Was that intentional? because that could cause some problems if you are trying to access an instance property.
- # 02:15 <lobius> Not intentional.
- # 02:15 <lorn> I'm trying to send info from a view to another view, i'm doing this with url lib http://pastebin.com/ycJtiaeA do anyone know another way for do that?
- # 02:15 <lobius> I should return self?
- # 02:15 <ckniffty> lobius: That could be the source of your problem. You need to use self in python much in the way you might use this'
- # 02:15 <lobius> self.name?
- # 02:15 <lorn> the nkuttler send me this doc https://docs.djangoproject.com/en/dev/topics/class-based-views/#extending-generic-views, its nice i didn't know that but I can't use that
- # 02:15 <ckniffty> 'this' in other languages
- # 02:15 <lobius> Okay
- # 02:15 <lorn> lobius: in your case self.open_rate
- # 02:15 <ckniffty> so you likely want to do self.open_rate
- # 02:15 <lobius> I need cost_per_ad getting the right value so self that as well?
- # 02:15 <lorn> lobius: yes
- # 02:15 <jcp_> anyone know a plugin that would let me display the total number of posts (say that's a model in my app) created each day of a specific month? found this but it's 2 years old: https://github.com/mcroydon/django-qsstats
- # 02:15 <lobius> ckniffty: http://dpaste.org/y02b5/
- # 02:15 <ckniffty> lobius: is business_type also a property of Contrato?
- # 02:30 <lobius> Yes, it is. Okay, I get it now. Anything that is a property of the class requires self.
- # 02:30 <ejb> Evening. I'm hoping to get some design advice. I'm designing Accounts and Transactions models and I'm stumbling over the Transaction model. Have a look at http://dpaste.org/bXvFY/ if you have a minute.
- # 02:30 <ckniffty> correct
- # 02:30 <lobius> In the method.
- # 02:30 <lobius> Thank you.
- # 02:30 <ckniffty> lobius: no problem
- # 02:30 <SmileyChris> gabor
- # 02:30 <lorn> I'm trying to send info from a view to another view, i'm doing this with url lib http://pastebin.com/ycJtiaeA do anyone know another way for do that?
- # 02:30 <ckniffty> ejb: It looks legit to me. Is it not working or are you just looking for design confirmation?
- # 02:30 <ejb> ckniffty: well, just looking for input and advice
- # 02:30 <mlavin> lorn: what problem are you trying to solve?
- # 02:30 <ejb> Does it make sense to have 2 Transaction instances created per transaction?
- # 02:30 <lorn> mlavin: http://pastebin.com/ycJtiaeA I'm using url lib for pass payload to another view
- # 02:30 <mlavin> lorn: yes but why?
- # 02:30 <ckniffty> ejb: No it doesnt I would just have one.
- # 02:30 <schnippi> What do I have to do to let the admin interface resemble a one-to-many relationship? e.g. If I click on an author, I want the admin interface to show me a list of all articles the author has written.
- # 02:30 <lorn> mlavin: because one view get data and post to another
- # 02:30 <schnippi> (And if I click on an article, I want to know to which author it belongs.)
- # 02:30 <lorn> mlavin: Are you familiar with Facebook apps? its a canvas apps, one view get the signed_request and parse and show info to a user and this parsed content is deployed to another view
- # 02:30 <FunkyBob> time to re-discover hwo to emit csv reports with a generator
- # 02:30 <ckniffty> lorn: Is this new? When ive worked with facebook signed_requests in the past they used they could use the same view. Of course these were with php so it was a sigle file none the less.
- # 02:30 <mlavin> lorn: that's what I was looking for
- # 02:30 <mlavin> lorn: I agree with ckniffty. I've created a canvas app and never needed to do anything like this
- # 02:30 <ejb> ckniffty: so then the type of the transaction is kind of ambiguous
- # 02:30 <lorn> mlavin: ckniffty understood, maybe i'm doing a little bit of overengineering :D
- # 02:30 <ckniffty> ejb: It could be then what is the source and destination really mean? My though is that these are always deposit or withdrawl depending on the point of view of the account
- # 02:30 <mlavin> lorn: I used https://github.com/jgorset/fandjango and found it quite handy
- # 02:30 <lorn> mlavin: awesome, i did know this
- # 02:45 <ejb> ckniffty: so the type wouldn't really be a stored field? it would just be displayed as "w" or "d" depending on the point of view, as you said?
- # 02:45 <ejb> as*
- # 02:45 <ejb> er ,a*
- # 02:45 <ckniffty> ejb: yeah but thats my opinion i havent really built a transaction models where i had both accounts.
- # 02:45 <ejb> ckniffty: ok, thanks for your input.
- # 02:45 <ejb> Anyone else care to weigh in?
- # 02:45 <anuvrat> hi, I am trying to setup django 1.4 on my dreahost shared hosting. https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/ talks about editing httpd.conf ... can I achieve the same effect by editing the .htaccess ?
- # 02:45 <GrahamDumpleton> anuvrat: DreamHost uses Passenger or FASTCGI and not mod_wsgi.
- # 02:45 <GrahamDumpleton> You will need to go search DreamHost docs for their guide on how to use Passenger.
- # 02:45 <anuvrat> GrahamDumpleton: oh right
- # 02:45 <anuvrat> GrahamDumpleton: I wrong link
- # 02:45 <GrahamDumpleton> anuvrat: http://wiki.dreamhost.com/Passenger_WSGI
- # 02:45 <FunkyBob> ACTION looks at GrahamDumpleton
- # 02:45 <FunkyBob> ACTION starts playing Bruce Springsteen
- # 02:45 <GrahamDumpleton> FunkyBob: Very funny.
- # 02:45 <SmileyChris> i like to think of GrahamDumpleton as a superhero who hears the utterance of "wsgi" anywhere in the world
- # 02:45 <FunkyBob> GrahamDumpleton: you know we love ya! :)
- # 03:00 <FunkyBob> SmileyChris: hahaha
- # 03:00 <FunkyBob> Tirelessly correcting the frustrating misconceptions of developers and admins everywhere
- # 03:00 <GrahamDumpleton> FunkyBob: I actually slept right through the night last night. Baby didn't wake me and not did any WSGI alerts. No one must have been talking about it.
- # 03:00 <FunkyBob> GrahamDumpleton: <envy /> baby woke us at 5 for grumble, nappy and feed
- # 03:00 <FunkyBob> I think she's teething
- # 03:00 <GrahamDumpleton> FunkyBob: Didn't say wife didn't get up. Just didn't hear it. Remarkable considering I am a very light sleeper.
- # 03:00 <FunkyBob> :)
- # 03:00 <SmileyChris> GrahamDumpleton: I've decided that is every father's subconscious defence against sleep deprivation
- # 03:00 <FunkyBob> my wife is a poor sleeper anyway, so she's used to it, more or less
- # 03:00 <FunkyBob> but I didn't sleep well last night, so I changed and fed the baby..
- # 03:00 <GrahamDumpleton> SmileyChris: Sleep isn't the problem for me right now. It is the changed prescription in my glasses. Not used to them yet. :-(
- # 03:00 <FunkyBob> ooh
- # 03:00 <FunkyBob> my new glasses should arrive soon
- # 03:00 <FunkyBob> the opto said the change was so great, he was only going to step me half way, lest it make me nauseous
- # 03:00 <SmileyChris> maybe i should get some new ones so we can all be the same
- # 03:00 <FunkyBob> heh
- # 03:00 <schinckel> We need some new channels. #django-dads and #django-glasses
- # 03:00 <schinckel> :)
- # 03:00 <FunkyBob> schinckel: feelign left out?
- # 03:00 <pjs> there's no on ine #django-dads :(
- # 03:00 <schinckel> I can join in the dads stuff (in fact, just got to work now because of that).
- # 03:00 <pjs> s/ine/in/
- # 03:00 <schnippi> How can I get the admin to show a one-to-many relationship in both directions?
- # 03:00 <SmileyChris> with difficulty
- # 03:00 <FunkyBob> schinckel: as in, on both mdoel admins?
- # 03:00 <schinckel> You may be able to do it with an Inline.
- # 03:00 <schinckel> Wrong sch-tab, FunkyBob
- # 03:00 <FunkyBob> I think it's not done because it mostly doesn't make sense
- # 03:00 <FunkyBob> schnippi:
- # 03:00 <schnippi> FunkyBob: The author-model should display a list of articles. And an article should display the corresponding author.
- # 03:00 <FunkyBob> schnippi: except that it generally doesn't make sense to edit an author in the context of a single article
- # 03:00 <anuvrat> GrahamDumpleton: I am experiencing the same problem as this http://discussion.dreamhost.com/archive/index.php/thread-134713.html , even after trying the solution suggested there
- # 03:00 <FunkyBob> [ok, perhaps in your specific case... but in the general case]
- # 03:00 <GrahamDumpleton> anuvrat: Try setting up a WSGI hello world independent on Django first if you haven't done that.
- # 03:00 <GrahamDumpleton> IOW, make sure there setup works first.
- # 03:00 <anuvrat> GrahamDumpleton: that works
- # 03:00 <anuvrat> GrahamDumpleton: hello world works
- # 03:00 <anuvrat> GrahamDumpleton: their setup, not sure
- # 03:00 <GrahamDumpleton> Beyond that can't help. I don't really know anything about DreamHost and don't have the time to help with a deep debugging session.
- # 03:00 <GrahamDumpleton> Others here possibly can.
- # 03:00 <FunkyBob> GrahamDumpleton: hey, a little feedback on NR... it's hard to tell on the apdex graph what the different colours are... where the number are placed is in the middle of the colour that is _below_ their value
- # 03:00 <anuvrat> GrahamDumpleton: please help me with passerger_wsgi.py instead ignoring Dreamhost for a while. I know that it would work because I have setup django 1.3 on it before.
- # 03:00 <GrahamDumpleton> FunkyBob: The banding is meant to relate to satisfied, tolerating and frustrating, which may not mean too much if don't understand the apdex calculation.
- # 03:00 <GrahamDumpleton> anuvrat: It isn't that don't have ability to help, but that am trying to get work done and can't handle too much of a distraction.
- # 03:15 <FunkyBob> GrahamDumpleton: yeah, I get that... just the numbers are a little off...
- # 03:15 <FunkyBob> it looks like it's hovering just over 8, when it's really 7.6
- # 03:15 <GrahamDumpleton> DM me a link to your app again so don't have to go search.
- # 03:15 <theCeres> hello
- # 03:15 <theCeres> i have a strange question
- # 03:15 <theCeres> is possible to get a queryset and then override some of the results?
- # 03:15 <schnippi> FunkyBob: At the moment, I can see to which author an article belongs. It would be nice to see, which articles a certain author has written.
- # 03:15 <FunkyBob> schnippi: you can do that with an inline admin on the author
- # 03:15 <caleb_smith> theCeres: Describe your query and/or how you want to change it. You may not need to override the values per se, but if so you may have luck with .values() or .values_list()
- # 03:15 <schnippi> FunkyBob: Do you mean a ModelAdmin?
- # 03:15 <FunkyBob> InlineAdmin
- # 03:15 <FunkyBob> schnippi: you were wanting to show this in admin, yes?
- # 03:15 <FunkyBob> if it's just on a page, simple... follow the automatic reverse relation
- # 03:15 <lobius> Dumb question: model elements use 'initial=' to set a default value?
- # 03:15 <FunkyBob> you mean model fields?
- # 03:15 <lobius> Yes
- # 03:15 <FunkyBob> typically you use default=
- # 03:15 <FunkyBob> like it shows in the field docs
- # 03:15 <lobius> Okay
- # 03:30 <bradleyayers> i think it's stupid that the m2m field on User for permissions, is called user_permissions
- # 03:30 <bradleyayers> why don't we prefix every field with `user_`
- # 03:30 <FunkyBob> user_user
- # 03:30 <mattmcc> Well, go back to 2005 and tell them to fix it. :P
- # 03:30 <mattmcc> I don't think I've ever actually directly referenced user_permissions, I just use has_perm.
- # 03:30 <FunkyBob> yeah... 80s hair dos all 'round!
- # 03:45 <fission6> so, i need to build a crop image functinality
- # 03:45 <fission6> anyone have a good approach for this
- # 03:45 <fission6> ideally, upload image then crop using a js front end, the js front end is in place with jcrop but struggling how to make this into a django widget
- # 03:45 <fission6> or utitlize a thumbmail package
- # 03:45 <Squeige> why not use the thumbnail app?
- # 03:45 <fission6> well ive reviewed them but how dont see how to leverage them for this
- # 03:45 <Squeige> look up on youtube image gallery django
- # 03:45 <FunkyBob> fission6: why must it be squeezed into a widget?
- # 03:45 <Squeige> hey first time I am useful, FunkyBob you must be proud!!
- # 03:45 <Squeige> how are you toay btw?
- # 03:45 <fission6> FunkyBob: well ideally it would be right?, the issue is i want to package it up as much as possible since i need to crop an imagefield for projects and for user profiles
- # 03:45 <bDreadz> Squeige: got a link to that thumbnail app?
- # 03:45 <FunkyBob> Squeige: only, you don't quite seem to be groking the issue :)
- # 03:45 <FunkyBob> best thumbnailing app i know of is easy-thumbnails
- # 03:45 <bDreadz> ACTION is googling
- # 03:45 <fission6> again, i dont see how i could leverage a thumbnail app
- # 03:45 <fission6> FunkyBob: how would you approach this issue
- # 03:45 <bDreadz> FunkyBob: is the git from SmileyChris the one?
- # 03:45 <FunkyBob> fission6: well, you said you already have the crop tool working
- # 03:45 <FunkyBob> bDreadz: yes
- # 03:45 <fission6> think, user fills out profile uploads ImageField, but image must be cropped using a js tool to specify section
- # 03:45 <Squeige> wait looking for the link
- # 03:45 <SmileyChris> bDreadz: it's on pypi too
- # 03:45 <fission6> SmileyChris: maybe you could help you have solid image experience with easy thumbnails
- # 03:45 <Squeige> this app would let you specify the dimensions of the image to crop
- # 03:45 <FunkyBob> fission6: I'm unfamiliar with how jcrop works
- # 03:45 <fission6> well dont worry with that, im more interested in how to pass back the crop "box" and handle on the django server side
- # 03:45 <SmileyChris> yeah, it'd be nice to have a jcrop-type widget in easy
- # 03:45 <fission6> there is a simple approach of just json service and then crop the ImageField and save it into another ImageField
- # 03:45 <FunkyBob> fission6: which is in the jcrop docs as "Completing the crop"
- # 03:45 <fission6> right
- # 03:45 <FunkyBob> you already have the image saved... you just need to update it
- # 03:45 <fission6> but looking through SmileyChris i am curious if there is a way to make it a widget
- # 03:45 <Squeige> http://dl.dropbox.com/u/17482399/programming_an_image_hosting_application_with_django.ogg
- # 03:45 <fission6> but i cant seem to figure out how to dynamically pass data to a ThumbNailField
- # 03:45 <Squeige> you can find the youtube version here, http://www.youtube.com/watch?v=g8v4STgAAdA but author cuts it to 10 mins
- # 03:45 <Squeige> so you need the other one
- # 03:45 <fission6> Squeige: i doubt it will help
- # 03:45 <Squeige> ok no worries
- # 03:45 <fission6> thanks htough
- # 03:45 <SmileyChris> fission6: you'd be better having a other fields which stored the crop data
- # 03:45 <fission6> SmileyChris: well thats what i think i may need to do
- # 03:45 <SmileyChris> fission6: kinda like how the genericforeignkey field works
- # 04:00 <bradleyayers> who actually propsed "user_permissions"
- # 04:00 <bradleyayers> need git blame
- # 04:00 <SmileyChris> so use git blame
- # 04:00 <SmileyChris> we're on git now, you realise
- # 04:00 <FunkyBob> will it have carried over from svn?
- # 04:00 <SmileyChris> yup
- # 04:00 <bradleyayers> should have
- # 04:00 <bradleyayers> i just need to type the commands
- # 04:00 <mattmcc> There has been a git mirror with the svn history for some time, of course.. :)
- # 04:00 <fission6> SmileyChris: maybe, i was thinking something similar
- # 04:00 <bradleyayers> this all seems too hard i give up
- # 04:00 <fission6> like headshot = ImageField(), cropped_headshot = CroppedImageField('headshot')
- # 04:00 <fission6> something liek that?
- # 04:00 <mattmcc> ACTION hears the Unreal Tournament announcer.
- # 04:00 <FunkyBob> hehe
- # 04:00 <SmileyChris> :D
- # 04:00 <FunkyBob> ACTION considers starting #django-oldtimers
- # 04:00 <FunkyBob> just realising some of us have been in here for... most of the last decade
- # 04:00 <fission6> man i know there is a way to package this neatly
- # 04:00 <fission6> just need some guidance
- # 04:00 <bradleyayers> i've only been here for ~4 years
- # 04:00 <fission6> SmileyChris: any thoughts or are you not interested in discussing?
- # 04:00 <FunkyBob> bradleyayers: yep :)
- # 04:00 <SmileyChris> fission6: do you need this to be nondestructive?
- # 04:00 <FunkyBob> fission6: read up on PIL, perhaps?
- # 04:00 <fission6> sorry what do youmean by that
- # 04:00 <fission6> FunkyBob: well i have that in place
- # 04:00 <FunkyBob> though SmileyChris has some smart cropping tools
- # 04:00 <SmileyChris> FunkyBob: easy doesn't actually handle cropping on all four sides
- # 04:00 <bradleyayers> 10 years ago, did you think that in 10 years time django would be more advanced than it is now?
- # 04:00 <SmileyChris> it'd be an easy processor to write though
- # 04:00 <fission6> right, so i am curious if there is a way to leverage easy_thumbnail, i have the widget dont (kind of) but its unclear how to take a dynamic form value and pass it back to a ThumbNail field to use
- # 04:00 <SmileyChris> bradleyayers: i thought it'd have schema migrations :-/
- # 04:00 <bDreadz> SmileyChris: Cool. Going to clone it down and check it out. thanx.
- # 04:00 <fission6> SmileyChris: any ideas how to pass form data to a processor though - thats there i am stuck
- # 04:00 <SmileyChris> bDreadz: if you're just checking it out, pip install easy_thumbnails
- # 04:00 <fission6> like i can get [0,0,20,20] a crop box from the front end, but not sure how to pass that to a processor for a Thumbnail field
- # 04:00 <bDreadz> SmileyChris: cool. Looking it over this is awesome.
- # 04:00 <FunkyBob> bradleyayers: 10 years ago [has it been that long?] I was still reeling that Django had made me not loathe web dev any more
- # 04:00 <FunkyBob> fission6: don't ... pass it to PIL directly
- # 04:00 <FunkyBob> fission6: I don't see how a thumbnail field is helping you here
- # 04:00 <Leeds> 10 years ago I was using Zope :(
- # 04:00 <bDreadz> SmileyChris: this is at first site is just what I need for this project I have right now. :)
- # 04:00 <FunkyBob> Leeds: me too :)
- # 04:00 <bDreadz> Leeds: I loved zope back in the day.
- # 04:00 <FunkyBob> Leeds: and a friend has recently asked me if I know much about Plone!
- # 04:00 <bradleyayers> f69cf70e (Adrian Holovaty 2006-05-02 01:31:56 +0000 150) user_permissions = models.ManyToManyField(Permission,
- # 04:00 <fission6> well ive done that using an ajax call to a view which takes the info and crops headshot = ImageField, and puts that into headshot_cropped=ImageField, FunkyBob
- # 04:00 <FunkyBob> I did my zope apps almost entirely using TAL and Script Objects
- # 04:00 <SmileyChris> dtml 4 life
- # 04:00 <SmileyChris> lol
- # 04:00 <fission6> but i feel its messy
- # 04:00 <Leeds> I disliked zope then, and as far as I know I dislike it now... haven't used it in about 7 years
- # 04:00 <bradleyayers> so we have this horrible legacy for 6 years
- # 04:00 <anuvrat> hi
- # 04:00 <FunkyBob> if only Zope had docs as good as Djangos
- # 04:00 <Leeds> on the other hand, I rather like Django now... and it seems I'm about to start rewriting a largeish ASP project from scratch
- # 04:00 <FunkyBob> bradleyayers: it's far from the worst
- # 04:00 <fission6> ok, seems like no one is intereted in this, even though we have PIL based module maintainers in here (looks at Sm)
- # 04:00 <fission6> SmileyChris:
- # 04:00 <FunkyBob> bradleyayers: plenty of cases of feature improvements left behind to avoid breaking compatiblity
- # 04:00 <SmileyChris> fission6: it's interesting, for sure
- # 04:00 <FunkyBob> someohe should comb the tickets to find them all and log them for 2.x
- # 04:00 <bradleyayers> FunkyBob: maybe we need django 2.0 already
- # 04:00 <anuvrat> this line in my passenger_wsgi.py : os.execl(INTERP, INTERP, *sys.argv) causes this :An error occurred importing your passenger_wsgi.py
- # 04:00 <bradleyayers> kill django.contrib completely
- # 04:00 <bradleyayers> isntead bundle our own package manager
- # 04:00 <bradleyayers> dpm install auth
- # 04:00 <fission6> SmileyChris: i sense i can play with this some more - maybe there is a way to merge it into easy_thumbnails at some point, the main issue i see is passing dynamic data to a ModelField though - not sure how that is done outside of just the Value to set
- # 04:00 <FunkyBob> ACTION attempts to smack all the ruby out of bradleyayers
- # 04:00 <fission6> Ill review genericfk though
- # 04:00 <mattmcc> If the Python community hasn't reached a consensus on how to manage packages, I certainly wouldn't trust the Django community to do it.
- # 04:00 <fission6> SmileyChris: is there any way to pass supplmental data to a processor which would be the crop box info from the front end?
- # 04:15 <SmileyChris> fission6: i'm not sure you're actually benefiting from easy that much in this circumstance
- # 04:15 <FunkyBob> SmileyChris: well, that's two of us who've said that so far :)
- # 04:15 <fission6> in what sense, if i could pass the crop info to the processor there would be a connection, you have cropping - imagine passing a dynamic value
- # 04:15 <fission6> ie, crop="smart" because crop=[0,0,20,20] - i just dont know how to pass that info into the processor or any information into a modelfield for that matter which isn't the "Value" to set
- # 04:15 <SmileyChris> fission6: if it were me, i'd probably make it a model.ImageField subclass which if null, returns the source file field. Make it use a custom FileDescriptor which, if passed a 4-part tuple, crops the underlying image
- # 04:15 <SmileyChris> (with pil directly)
- # 04:15 <bradleyayers> FunkyBob: we can get a head start by just forking pip
- # 04:15 <fission6> SmileyChris: can you explain a tiny bit more = or paste some code, sounds interesting.
- # 04:15 <SmileyChris> fission6: django.db.models.fields.files is the code
- # 04:15 <fission6> SmileyChris: what about using {% thumbnail profile.photo 50x50 crop %} and do something like {% thumbnail profile.photo profile.headshot_crop_box crop %}
- # 04:15 <SmileyChris> fission6: easy-thumbnails is not the solution you need here
- # 04:15 <fission6> and check if the input is a list if so, crop it
- # 04:15 <SmileyChris> fission6: you don't care about the size as much as you do cropping to a bounded box
- # 04:15 <fission6> how does this work anyways {% thumbnail profile.photo 50x50 crop %} without hindering performance, does it check if a file exists by the expected name and if not create it
- # 04:15 <SmileyChris> yep
- # 04:15 <SmileyChris> along with modified date checks
- # 04:15 <SmileyChris> in newly released 1.0, you can have them pregenerated when the source is uploaded too
- # 04:15 <fission6> woops
- # 04:15 <fission6> i mean why wouldn't {% thumbnail profile.photo [0,0,20,20] crop %} like that work?
- # 04:15 <SmileyChris> {{ profile.photo|thumbnail_url:'avatar-small' }}
- # 04:15 <SmileyChris> becasue that doesn't make sense
- # 04:15 <fission6> how so?
- # 04:15 <SmileyChris> you just specify the width and heigh
- # 04:15 <SmileyChris> not all four bounding box coords
- # 04:15 <SmileyChris> and you don't know the source size to begin with
- # 04:15 <fission6> i would implement the 4 part logic
- # 04:15 <fission6> Image.crop() are you familar with that
- # 04:15 <SmileyChris> yes, but that defeats the purpose of thumbnail
- # 04:15 <fission6> how so
- # 04:15 <fission6> i must be missing something
- # 04:15 <SmileyChris> the tag shouldn't have to assume the size of the image
- # 04:15 <fission6> i dont follow
- # 04:15 <SmileyChris> you can't just crop 120, 120, 140, 140 without knowing that the image is at least 140x140
- # 04:15 <mattmcc> fission6: How do you know 0,0,20,20 is the part of the image you want?
- # 04:15 <fission6> well sure thats always the case with cropping - PIl will pad it if its larger with a background color
- # 04:15 <fission6> mattmcc: that part is covered with a front end widget i made using jcrop
- # 04:15 <SmileyChris> the correct way in easy would be {% thumbnail 20x20 crop=10,10 %} (where the 10's are the percentage of the top & left to crop from
- # 04:15 <fission6> which ic an store in a model Field for the profile
- # 04:15 <mattmcc> Well, if users are actively marking where to crop images anyway, you may as well just generate the thumbnail at that point.
- # 04:15 <SmileyChris> yep
- # 04:15 <mattmcc> That's not the use case for {% thumbnail %}, which is generating thumbnails for arbitrary, unprocessed images.
- # 04:15 <SmileyChris> yep
- # 04:15 <fission6> SmileyChris: maybe it makes more sense if i say, lets use a new processor - {% thumbnail cropbox=[0,0,20,20] %}
- # 04:15 <SmileyChris> fission6: except that still doesn't make sense for arbitrary images
- # 04:15 <SmileyChris> but i guess you could do that
- # 04:15 <fission6> mattmcc: agreed but there is no way to pass dynamic data to an ImageField to crop, accept for handling it all in a view
- # 04:30 <fission6> wich is my current solution
- # 04:30 <fission6> directly modifying the ImageField with a ajax POST with the crop box
- # 04:30 <SmileyChris> fission6: you don't need to pass dynamic data to the image field
- # 04:30 <mattmcc> Gar, why doesn't modelform_factory take a queryset. :P
- # 04:30 <mattmcc> Er, modelformset_factory even.
- # 04:30 <fission6> SmileyChris: what do you mean? if i were to try to have the solution as a ModelField i would right?
- # 04:30 <SmileyChris> fission6: let's assume you just want to destructively replace an image field
- # 04:30 <SmileyChris> fission6: so you're just going to use an alternate form field/widget
- # 04:30 <fission6> let me just ask it this way - given you know easy_thumbnail better than anyone, how would you handle the issue of having a user specify an area of an image to crop
- # 04:30 <fission6> and make it somewhat DRy for other croppable image fields
- # 04:30 <SmileyChris> you wouldn't, that's not the purpose of easy-thumbnails
- # 04:30 <fission6> thats fine - throw easy-thumbnail aside
- # 04:30 <fission6> what would be your approach
- # 04:30 <fission6> ps-what do you mean by destructively replace?
- # 04:30 <SmileyChris> my_profile.photo = new_cropped_image
- # 04:30 <SmileyChris> well, my_profile.photo.delete() first, but yeah
- # 04:30 <fission6> ok, is that arligth to do
- # 04:30 <fission6> SmileyChris: here is some almost working / psuedo code for the current view doing the cropping, again i am convinced this could be elegantly made into a model field to complete the widget/form/modelfield circle
- # 04:30 <fission6> http://dpaste.org/vxAtM/
- # 04:30 <theCeres> i have a problem...
- # 04:30 <SmileyChris> your custom form ImageField's clean(self, value, initial=None) method should take a a 4-part tuple as the bounding area, and use PIL to create an image from initial and crop it down, returning the result wrapped as a SimpleUploadedFile
- # 04:30 <SmileyChris> fission6: ^
- # 04:30 <SmileyChris> fission6: no need for a custom modefield at all then
- # 04:30 <SmileyChris> fission6: your widget just needs to correctly use value_from_datadict to build the four-part tuple
- # 04:45 <SmileyChris> fission6: and no ajax / views required
- # 04:45 <theCeres> hello, is it possible to get filter(...).values('FKobject__field__all') can i get all the FKobject.field.all() using values? thanks
- # 04:45 <SmileyChris> theCeres: approach it from the other way round
- # 04:45 <fission6> your widget just needs to correctly use value_from_datadict, what do you mena gere?
- # 04:45 <SmileyChris> fission6: it's a method of the widget class
- # 04:45 <SmileyChris> fission6: you'll want to have a good idea about how fields, forms and widgets interact - source reading is essential
- # 04:45 <fission6> so what captures the crop box dimensions in the form
- # 04:45 <SmileyChris> fission6: your widget
- # 04:45 <fission6> agreed on that lat statment
- # 04:45 <SmileyChris> fission6: most likely saves it as four hidden input fields
- # 04:45 <SmileyChris> (your js, tied to the widget's media)
- # 04:45 <fission6> agreed bu tthat swhere i hit a dead end, the ImageField's clean(self, value, initial=None) can only take in one input fields value, which in the case in the input type=file
- # 04:45 <SmileyChris> value is the tuple
- # 04:45 <SmileyChris> your widget can provide that correctly
- # 04:45 <SmileyChris> see: value_from_datadict
- # 04:45 <fission6> how does it make field names map from widget to value?
- # 04:45 <fission6> ok let me review, if eel youve given me some essential insight - let me see what i can learn, im sure ill have some questions but thanks for yoru guidance!
- # 04:45 <SmileyChris> assume '%s-1' % self.name, etc
- # 04:45 <fission6> oh okay so its like prefix
- # 04:45 <fission6> SmileyChris: so you see this line in the easy_thumbs doc ThumbnailField(..., resize_source=dict(size=(100, 100), sharpen=True))
- # 04:45 <SmileyChris> fission6: e.g. MultiWidget
- # 04:45 <SmileyChris> fission6: yup
- # 04:45 <fission6> so that resize_source can never change right, like i couldn't have the user specify a resize dimension from the front end and dynmically change model instances?
- # 04:45 <SmileyChris> correct
- # 04:45 <SmileyChris> it'll just ensure all images fit within 100x100
- # 04:45 <SmileyChris> and get sharpened
- # 04:45 <fission6> ok
- # 04:45 <fission6> letme review for a bit - thanks, ill prob ping you with what i come up with for review and guidance
- # 05:15 <sivy> handler?
- # 05:15 <sivy> anyone know the actual, proper signature of a user_logged_in signal hanlder?
- # 05:15 <FunkyBob> foo(sender, **kwargs) :)
- # 05:15 <FunkyBob> sivy: well, I just found it in the docs
- # 05:15 <FunkyBob> in that much time
- # 05:15 <FunkyBob> and if I told you there's a heading for it in the Auth docs, you should be able to find it even quicker
- # 05:15 <sivy> FunkyBob: I've been reading the docs
- # 05:15 <sivy> they didn't provide an example
- # 05:15 <sivy> this is what i've been trying
- # 05:15 <sivy> http://stackoverflow.com/a/6109366
- # 05:15 <anuvrat> I installed django in virtual env using pip. I don't have Django-1.4-py2.5.egg inside my site-packages, and import django in my passenger.py is unsuccessful .. any insights?
- # 05:15 <sivy> seems to be working now, but only after i removed the sender=User in the connect() call
- # 05:15 <sivy> FunkyBob: https://gist.github.com/c36ac4ab18276300a88f
- # 05:15 <FunkyBob> sivy: what more do you need? the docs say sender - the user class, request, and user
- # 05:15 <gamingdroid> I have a handful of records that needs to be updated from time to time. Is there a better way to do this: http://dpaste.com/745276/
- # 05:15 <sivy> FunkyBob: yeah, I think the extra sender kwarg i was passing the connect() method was breaking it; not sure.
- # 05:15 <sivy> I kept getting "your function requires <some number other than we're sending it> args"
- # 05:15 <FunkyBob> sivy:does your function accept **kwargs ?
- # 05:30 <sivy> FunkyBob: yes
- # 05:30 <sivy> sender, user, request, **kwargs
- # 05:30 <FunkyBob> do them as keyword... foo(sender, request=None, user=None, **kwargs)
- # 05:30 <FunkyBob> exactly what is the error you get?
- # 05:30 <sivy> aaaah
- # 05:30 <gamingdroid> I understand putting signals in signals.py, but where do you ensure it get's imported and hence registered?
- # 05:30 <anuvrat> why don't i have a Django-1.4-py2.5.egg, inside my site packages - I'm installing django 1.4 inside virtualenv
- # 05:30 <FunkyBob> anuvrat: because it doesn't install as an egg?
- # 05:30 <FunkyBob> hmm... actually, I have Django-1.4-py2.7.egg-info inside mine
- # 05:30 <anuvrat> FunkyBob: yes me too
- # 05:30 <anuvrat> so what do I tell my passenger_wsgi.py as the location from where to import django
- # 05:30 <FunkyBob> wait.
- # 05:30 <FunkyBob> which site packages did you point at?
- # 05:30 <FunkyBob> and why the fuck would you point passenger at the egg, not the installed code?
- # 05:45 <anuvrat> FunkyBob: pointed it at /home/aparashar/env/lib/python2.5/site-packages/django
- # 05:45 <anuvrat> because this http://discussion.dreamhost.com/archive/index.php/thread-134713.html said something similar
- # 05:45 <anuvrat> FunkyBob: ^^
- # 05:45 <anuvrat> FunkyBob: my passenger_wsgi.py I am trying to debug http://dpaste.com/745276/
- # 05:45 <anuvrat> FunkyBob: where am I going wrong?
- # 06:00 <Squeige> I am following yet another tutorial says I need to run
- # 06:00 <Squeige> pip install -e git+https://github.com/alex/django-taggit.git#egg=taggit
- # 06:00 <Squeige> but do I need to install antything to be able to use the git repository?
- # 06:00 <FunkyBob> git
- # 06:00 <Squeige> so first do pip install git?
- # 06:00 <FunkyBob> anuvrat: surely it'd be simpler if your script used the virtualenv's python? then you wouldn't have to mangle the sys.path
- # 06:00 <kevlarman> Squeige: git is not something you can install with pip
- # 06:00 <kevlarman> Squeige: use your package manager
- # 06:00 <FunkyBob> anuvrat: if you understand how python imports work, you'd see why you shouldn't be adding the django dir itself
- # 06:00 <FunkyBob> anuvrat: then again, I've never used passenger, so I don't know if it would honour a shebang
- # 06:00 <Squeige> oh I was confused since yesterday to import hg I pip installed mercurial,
- # 06:00 <anuvrat> FunkyBob: yeah .. was just checking that out ... so I am going to add my virtualenv's python's in my .bash_profile
- # 06:00 <prometheus> out of curiosity, why passenger?
- # 06:00 <anuvrat> prometheus: dreamhost
- # 06:00 <prometheus> oh...
- # 06:00 <Squeige> so git would need to be on my main distro not my virtualenv is that what you mean kevlarman ?
- # 06:00 <prometheus> yes
- # 06:00 <FunkyBob> anuvrat: wtf?
- # 06:00 <FunkyBob> why are you involving .bash_profile ?
- # 06:00 <FunkyBob> I give up... people do the wierdest random shit trying to fix things
- # 06:00 <anuvrat> FunkyBob: how do I ensure "my script uses virtualenv's python" ?
- # 06:00 <prometheus> anuvrat: call the python binary inside the virtualenv?
- # 06:00 <FunkyBob> anuvrat: specify it on the shebang line
- # 06:00 <FunkyBob> first line of your script make it: #!/path/to/my/venv/bin/python
- # 06:00 <FunkyBob> adjust path to suit
- # 06:15 <anuvrat> FunkyBob: added the shebang ... it still loads the /usr/bin/python :(
- # 06:15 <FunkyBob> then you need to teach passenger
- # 06:15 <anuvrat> FunkyBob: shared hosting .. any hacks for teaching passenger?
- # 06:15 <FunkyBob> as I said before... I've never used it
- # 06:15 <anuvrat> FunkyBob: btw .. call to os.execl(INTERP, INTERP, *sys.argv) successfully starts python from my virtual env ... can't this solve the problem?
- # 06:15 <anuvrat> FunkyBob: think of it as a simple script which needs to import django from a directory other than the default one ... thats my basic problem ... you would have done this wouldn't you?
- # 06:15 <FunkyBob> tried using site.addsitedir ?
- # 06:15 <Squeige> hey kevlarman is this what I would need to install then?
- # 06:15 <Squeige> http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/git-subversion/
- # 06:15 <FunkyBob> Squeige: no
- # 06:15 <FunkyBob> Squeige: you want 'git'
- # 06:15 <prometheus> or git-core
- # 06:15 <prometheus> (not sure what it's called on freebsd) :)
- # 06:15 <prometheus> ah, git, my bad
- # 06:15 <Squeige> ok I think its this one then
- # 06:15 <Squeige> http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/git/
- # 06:15 <prometheus> yes, that's it
- # 06:15 <Squeige> would it be recommended to look for mercurial and install that on my base system as well, so i dont have to keep pip installing it?
- # 06:15 <FunkyBob> you can pip install hg?
- # 06:15 <FunkyBob> probably best to use pkgsrc for that, yeah
- # 06:15 <spersaud_> anyone using joyent ?
- # 06:15 <Squeige> i did yesterday when I saw your site,
- # 06:15 <Squeige> I did pip install mercurial
- # 06:15 <Squeige> and that worked
- # 06:30 <spersaud_> I am trying to set a cronjob to run send_mail .. cron job will not work
- # 06:30 <Squeige> who comes up with all the crazy names, that sound exactly like something else,
- # 06:30 <Squeige> ok is it this one?
- # 06:30 <Squeige> http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mercurial/
- # 06:30 <Squeige> theres like 20 different ones hehe
- # 06:30 <FunkyBob> Squeige: doesn't surprise me... I knew hg was mostly written in python
- # 06:45 <sec_> mercurial is hg oh
- # 06:45 <sec_> its chemical
- # 06:45 <FunkyBob> indeed
- # 06:45 <prometheus> mercury :)
- # 06:45 <prometheus> speaking of mercurial, git's new community site is pretty damn spiffy http://git-scm.com/
- # 06:45 <sec_> :)
- # 06:45 <Squeige> FunkyBob, any good tutorials on using hg and how to setup your environment to upload etc
- # 06:45 <sec_> isn't it easy as 1,2,3?
- # 06:45 <Squeige> nothing here to seem to be easy hehe
- # 06:45 <FunkyBob> are you plannign to use hg for your own work?
- # 06:45 <Squeige> yes like for example, I reviewed your code, and I am also following the tutorial on blogs, so I am making one from scratch just to see is this helps learn,
- # 06:45 <FunkyBob> ok
- # 06:45 <AlecTaylor> hi
- # 06:45 <AlecTaylor> What are your thoughts about extending Django with multi-tenant support? - https://groups.google.com/forum/#!topic/django-developers/2c1QV57yolo
- # 06:45 <Squeige> also was thinking maybe there could be a filed that lets you upload a pic, and then once posted it adds it as a thumbnail at the bottom of the post.
- # 07:00 <spersaud_> FunkyBob: what os should I use linux or this smartos thing a majig ?
- # 07:00 <FunkyBob> linux is not an OS... what is "this smartos thing a majig" ?
- # 07:00 <Squeige> it's not O.O ok im all ears
- # 07:00 <FunkyBob> AlecTaylor: umm... if Mezzanine can do multi-tenancy as a Django app... what's the problem?
- # 07:00 <spersaud_> FunkyBob: what is linux then ? a kernel ?
- # 07:00 <FunkyBob> spersaud_: yes
- # 07:00 <spersaud_> FunkyBob: lol
- # 07:00 <Squeige> unix is a kernel too?
- # 07:00 <FunkyBob> unlike, say, FreeBSD, which includes a userspace, libc, and kernel
- # 07:00 <spersaud_> unix is a class of operating systems
- # 07:00 <Squeige> ah ok
- # 07:00 <FunkyBob> Unix is an operating system
- # 07:00 <Squeige> I always thought linux had a similar structure, and was considered an os
- # 07:00 <FunkyBob> no, it's juse a kernel
- # 07:00 <FunkyBob> a unix-like kernel
- # 07:00 <FunkyBob> then GNU provides most of the userspace
- # 07:00 <FunkyBob> although there are other projects that use, for instnace, one of the BSD userspaces on a Linux kernel
- # 07:00 <spersaud_> Im tired of this smartos sun/oracle crap joyent is trying to advertise .. I think its a mess
- # 07:00 <FunkyBob> and, just for balance, Debian has a version with a FreeBSD kernel, and GNU userspace
- # 07:00 <Squeige> yes I have played with the linux layer in freebsd, was handy to enable some linux functionality that was lacking a couple of versions ago if thats what you are referring to
- # 07:00 <FunkyBob> spersaud_: SmartOS.org ?
- # 07:00 <spersaud_> FunkyBob: yeah ..
- # 07:00 <FunkyBob> reads a lot like Solaris
- # 07:00 <FunkyBob> which went to shit about v10
- # 07:00 <AlecTaylor> FunkyBob: I'm not using Mezzanine for all my projects
- # 07:00 <FunkyBob> so what, in your mind, is multi-tenant support?
- # 07:00 <AlecTaylor> E.g.: multiple satchmo stores on the one django instance
- # 07:00 <eedeep> damianheard: hi guy
- # 07:00 <FunkyBob> AlecTaylor: you couldn't just run them as separate instances on the one site/
- # 07:00 <FunkyBob> ?
- # 07:15 <Squeige> ok Im off to reading and then to bed, good night.
- # 07:15 <damianheard> eedeep: hi
- # 07:15 <AlecTaylor> FunkyBob: I can, but that is a bit of a messier solution. Albeit I am currently taking that route, but if django...
- # 07:15 <damianheard> http://dpaste.org/gSgnS/
- # 07:15 <damianheard> Is it possible to assign a default value to a None field when using annotation to apply a filter?
- # 07:15 <damianheard> Would like to avoid having to use raw SQL few possible
- # 07:15 <FunkyBob> damianheard: what do you mean by a 'none field'?
- # 07:15 <damianheard> FunkyBob: Sorry, the num_in_stock field might be none on the variation (see dpaste above)
- # 07:15 <damianheard> FunkyBob: In this case Max/Min seem to pretty much ignore Nones. I'd like to provide a default value in this case instead
- # 07:15 <eedeep> damianheard: meaning that in the database it would be NULL right
- # 07:15 <damianheard> eedeep: Yeah, correct. Thanks
- # 09:15 <xterm> Hello, assuming i have model A(name, b(fkey(B, related='As') and model B(name). I would like to, within B's admin to list_display the count of As in every B. Is there a shortcut to doing this without having to create an internal function to B's admin ?
- # 09:15 <RedOktoberfest> is it possible to save request.user.username back into the database?
- # 09:15 <FunkyBob> RedOktoberfest: sure, just request.user.save()
- # 09:15 <FunkyBob> since request.user is a User instance
- # 09:30 <RedOktoberfest> hmm found the problem
- # 09:30 <RedOktoberfest> user is a char field
- # 09:30 <RedOktoberfest> but in the table im trying to save into, syncdb made it an integerr
- # 09:45 <RedOktoberfest> does anyone know why i get a value error (invalid literal for int() with base 10) when i try to save user.username?
- # 09:45 <bmispelon> RedOktoberfest: it looks related to your earlier problem of having username be an integerfield. What does your model look like?
- # 09:45 <RedOktoberfest> well that's what has me so confused. username is an fk of auth_user.username, which is a charfield. but for some reason the fk keeps getting constructed as an integer field
- # 09:45 <shurain> RedOktoberfest: isn't username a fk of auth_user table? instead of a single field?
- # 09:45 <bmispelon> RedOktoberfest: you can't have a foreign key to a model's field
- # 10:00 <bmispelon> FK are to a whole model, not one of its specific fields
- # 10:00 <bmispelon> the value of that foreign key field will be the primary key of the related object (usually, an integer)
- # 10:00 <bmispelon> RedOktoberfest: show the code that is giving you an error.
- # 10:00 <kinabalu> any of you here using django-userena? i've gotten mugshots (thumbnails) worked out and uploaded, but it appears the saved path is mugshots/filename.jpg ... so linking to it without prepending {{ MEDIA_URL }} causes heartache
- # 10:00 <kinabalu> and the docs seem to imply that something named MEDIA_PATH will be used to prepend, which is not the case.
- # 10:00 <harovali> hi, in an old django app there is a invocation of 'ChangeManipulator' which now that django got upgraded, fails. What changes should get done to get this working as seamlessly as possible ?
- # 10:00 <harovali> it's invocated as a method on a model
- # 10:00 <superdmp> I can avoid a "Cannot combine a unique query with a non-unique query." error by applying .distinct() to one of the queries - but what does this actually do?
- # 10:15 <schinckel> superdmp: It means that one side of a join has a .distinct() already, and you are applying it to the other side: which you need to do to get it to work.
- # 10:15 <superdmp> schinckel: I don't think I really understand what the concept of a distinct() query
- # 10:15 <superdmp> the actual contents of the query set seem to be the same both times, but one works and one doesn't
- # 10:15 <mippie_moe> for most small websites, is a single app in a django project enough? Could you guys give me an example of when you might need multiple apps in a single project?
- # 10:15 <Drajwer> mippie_moe: for example if you need news and gallery I would separate them
- # 10:15 <mippie_moe> Drajwer, thanks!
- # 10:30 <superdmp> mippie_moe: even the smallest of websites might need structured information
- # 10:30 <superdmp> news, events, contacts & people, and so on
- # 10:30 <superdmp> not to mention models for image sets, etc
- # 10:30 <superdmp> I wouldn't want all that in a single application
- # 10:30 <superdmp> what is the & called, when it's used with two querysets? e.g. relevant_pages = pages & ancestry
- # 10:30 <t0by> Hi!
- # 10:30 <t0by> I'm parsing a list of fields and trying to make sure that none of them is a RelatedManager
- # 10:30 <t0by> but if rel.__class__ == django.db.models.fields.related.RelatedManager gives me "model has no attribute RelatedManager"
- # 10:30 <t0by> yet django.db.fields.related.RelatedManager is what I get when I inspect one of the fields I'm trying to avoid
- # 10:45 <t0by> what's the gotcha here?
- # 10:45 <bmispelon> superdmp: wow, I had no idea this existed. It looks like it merges the querysets together
- # 10:45 <superdmp> the python & is intersection
- # 10:45 <superdmp> bmispelon: common elements
- # 10:45 <bmispelon> superdmp: https://github.com/django/django/blob/master/django/db/models/query.py#L212
- # 10:45 <bmispelon> superdmp: you're right. my mistake. It does common element (I think).
- # 10:45 <superdmp> I have *no* idea why I am using it in relevant_pages = pages & ancestry though...
- # 10:45 <bmispelon> superdmp: what are "pages" and "ancestry"?
- # 10:45 <iSays> n0ob question: i shouldn't put SECRET_KEY in versioning ?
- # 10:45 <superdmp> bmispelon: pages is every page (in django CMS); ancestry is current_page.get_ancestors(ascending = True)
- # 10:45 <bmispelon> superdmp: wouldnt ancestry be a subset of pages then?
- # 10:45 <superdmp> bmispelon: yes, one would think so!
- # 10:45 <bmispelon> superdmp: maybe there's some extra logic (like not showing pages that haven't been published or something liek that)
- # 10:45 <bmispelon> s/liek/like/
- # 10:45 <superdmp> bmispelon: I don't know, and I'm the one who wrote this rubbish!
- # 10:45 <superdmp> bmispelon: I think that's it though
- # 10:45 <bmispelon> superdmp: then you should go give past superdmp a slap on the head
- # 10:45 <superdmp> bmispelon: the things I could tell the young superdmp!
- # 10:45 <bmispelon> superdmp: now you just need to think of the things future superdmp would tell you
- # 10:45 <iSays> Which way you prefer to make settings for dev and deployment? i googl'ed already, there is a lot of way to do it, but actually i get confuse about them!
- # 10:45 <shurain> iSays: http://ericholscher.com/blog/2011/jan/10/handling-django-settings-files/
- # 10:45 <iSays> shirain: the best point about this approach is actually using django-admin.py and manage.py, Prefect!
- # 10:45 <iSays> shurain: Thank you
- # 11:00 <shurain> no prob
- # 11:15 <superdmp> how do I run the tests that a django project comes with?
- # 11:15 <superdmp> yes
- # 11:15 <superdmp> python manage.py runserver 0.0.0.0:8000
- # 11:15 <superdmp> sorry
- # 11:15 <superdmp> is it wise to allow django to create an destroy databases to run tests?
- # 11:15 <FunkyBob> so long as its name doesn't collide with your existing DBs, sure
- # 11:15 <lericson> How do people typically handle internationalized resources, like say a logo PNG which is to be translated?
- # 11:30 <nkuttler> lericson: abuse localized strings?
- # 11:45 <lericson> Really?
- # 11:45 <nkuttler> img src="foo{ trans "CC" }.png" doesn't look sooo bad to me
- # 11:45 <ticketbot> https://github.com/django/django/commit/bad
- # 11:45 <lericson> We produced graphical material for the other languages, so you suggest we put them into directories like /static/locale/en_GB/ and use ugettext to translate _('STATIC_LOCALE') -> 'en_GB' maybe?
- # 11:45 <lericson> ticketbot: not sure what you were thinking there, pal
- # 11:45 <nkuttler> lericson: how many localized images are you talking about?
- # 11:45 <lericson> I'm thinking maybe just look up the current locale's name.
- # 11:45 <lericson> nkuttler: For each language, about ten. We have four languages as of this moment.
- # 11:45 <nkuttler> lericson: it also depends, if they are background images you could add a language-specific class to <body> or somesuch
- # 11:45 <ticketbot> https://github.com/django/django/commit/a
- # 11:45 <ticketbot> https://github.com/django/django/commit/add
- # 11:45 <lericson> ticketbot: just shut up already
- # 11:45 <lericson> nkuttler: some of them are, which makes it all the more complicated
- # 11:45 <lericson> I simply generated a <style> instead
- # 11:45 <nkuttler> lericson: i'd definitely use css whenever possible
- # 11:45 <nkuttler> ew :)
- # 11:45 <bmispelon> what triggered ticketbot?
- # 11:45 <mattmcc> Good question. Nothing in the recent discussion looks like patterns it should trigger on..
- # 11:45 <pratz> hey guys I am using django cms and I want request.session but I do not have request object in django-cms custome plugin, so how can i get session other than in request ?
- # 11:45 <bmispelon> mattmcc: and is it a coincidence that he left when lericson told it to shut up?
- # 11:45 <ticketbot> https://github.com/django/django/commit/a
- # 11:45 <pratz> ok guys got it
- # 11:45 <mattmcc> bmispelon: I'd say it's just being buggy, I know they've been hacking on it lately.
- # 11:45 <ticketbot> https://github.com/django/django/commit/d
- # 11:45 <mattmcc> Probably trying to match git commit hashes..
- # 11:45 <mattmcc> a b c d e
- # 11:45 <ticketbot> https://github.com/django/django/commit/a
- # 11:45 <ticketbot> https://github.com/django/django/commit/c
- # 11:45 <ticketbot> https://github.com/django/django/commit/b
- # 11:45 <ticketbot> https://github.com/django/django/commit/e
- # 11:45 <ticketbot> https://github.com/django/django/commit/d
- # 11:45 <idan> sorry
- # 11:45 <idan> working on it.
- # 11:45 <mattmcc> idan: Good timing ;)
- # 11:45 <lericson> 1 2 3 4 5 a b c d
- # 11:45 <ticketbot> https://github.com/django/django/commit/a
- # 11:45 <ticketbot> https://github.com/django/django/commit/c
- # 11:45 <ticketbot> https://github.com/django/django/commit/b
- # 11:45 <ticketbot> https://github.com/django/django/commit/d
- # 11:45 <ticketbot> https://github.com/django/django/commit/1
- # 11:45 <ticketbot> https://github.com/django/django/commit/3
- # 11:45 <ticketbot> https://github.com/django/django/commit/2
- # 11:45 <ticketbot> https://github.com/django/django/commit/5
- # 11:45 <ticketbot> https://github.com/django/django/commit/4
- # 11:45 <lericson> sorry
- # 11:45 <nanonyme> come on
- # 11:45 <mattmcc> I was actually joking about regex matching git commit hashes earlier with a cowoerker.. If it required at least 5-6 hex chars it'd probably be fine.
- # 11:45 <bmispelon> mattmcc: looks buggy enough to me :)
- # 11:45 <nanonyme> idan, require full valid shorthash
- # 11:45 <nanonyme> that's about 5-6 chars
- # 11:45 <nanonyme> full hash allowed as well
- # 11:45 <lericson> too bad if you start talking about the island of aeaea
- # 11:45 <murr4y> is this stable? http://pypi.python.org/pypi/django-mssql
- # 11:45 <idan> I'm just going to check for 5-40 chars
- # 11:45 <nanonyme> lericson, that's only problematic if the hash is valid ie exists
- # 11:45 <nanonyme> the bot should have a git repo of its own it could check from
- # 11:45 <lericson> nanonyme: in this case the space of valid hashes is infinite
- # 11:45 <idan> bot is stupid
- # 11:45 <lericson> mm yes of course
- # 11:45 <idan> no validation
- # 12:00 <idan> just linkification
- # 12:00 <lericson> it actually links to a specific repository
- # 12:00 <nanonyme> yes, don't do that
- # 12:00 <nanonyme> make it check from repo before linking
- # 12:00 <lericson> talk to the github people, maybe you could make something reusable
- # 12:00 <lericson> they've also already got the algoritm for comments and so on and that works fine
- # 12:00 <lericson> +h
- # 12:00 <lericson> well I got what I was looking for, take care my fellowgents
- # 12:00 <nanonyme> weeell, yeah. the actually smart stuff would require the bot to understand Github post-receive POST messages so it could pull on each
- # 12:00 <nanonyme> (or actually sync data on each, pulling is overkill)
- # 12:00 <idan> nanonyme: you want something more, write it.
- # 12:00 <idan> ACTION E_INSUFFICIENT_HOURS_IN_DAY
- # 12:00 <nanonyme> idan, I actually want something less ie bots that don't talk garbage
- # 12:00 <nanonyme> or rather less bots that do
- # 12:00 <idan> https://github.com/idangazit/django-ticketbot/ avail yourself of forks and pull requests :)
- # 12:00 <idan> ticketbot: hey
- # 12:00 <idan> a 1 2 3
- # 12:00 <idan> a1234 a123
- # 12:00 <ticketbot> https://github.com/django/django/commit/a1234
- # 12:00 <nanonyme> well, simply disconnecting ticketbot would be an acceptable outcome to me as well ;)
- # 12:00 <idan> one of these is a valid sha: 1b05546bd50d1bf99e3d0e7def1238edf8d44065 91b05546bd50d1bf99e3d0e7def1238edf8d44065
- # 12:00 <ticketbot> https://github.com/django/django/commit/1b05546bd50d1bf99e3d0e7def1238edf8d44065
- # 12:00 <idan> ACTION dusts hands
- # 12:00 <idan> my work here is done, ciao.
- # 12:00 <nanonyme> and if it checks that by polling Github, we can wait a while until Github bans it
- # 12:00 <slikts> is django more popular than bread?
- # 12:30 <bradleyayers> good evening folks
- # 12:30 <pydonny> bradleyayers: hey mate
- # 12:30 <bradleyayers> long time no see
- # 12:30 <bradleyayers> whats going on here
- # 12:30 <pydonny> pretty quiet tonight
- # 12:30 <pydonny> bradleyayers: are you from brisbane ?
- # 12:30 <bradleyayers> yeah
- # 12:30 <bradleyayers> did we meet at pybris?
- # 12:30 <bradleyayers> arr brispy
- # 12:30 <pydonny> no but i would have liked to attend should i have known about it.. :)
- # 12:30 <bradleyayers> i havent been for a while
- # 12:30 <bradleyayers> i'll go to the next one though
- # 12:30 <pydonny> bradleyayers: are you working at the moment ?
- # 12:30 <bradleyayers> speak of the devil just got meetup email
- # 12:30 <pydonny> employed ?
- # 12:30 <bradleyayers> http://www.meetup.com/Brisbane-Python-User-Group/events/64051732/
- # 12:30 <ticketbot> https://github.com/django/django/commit/64051732
- # 12:30 <bradleyayers> yes
- # 12:30 <pgcd> hi all
- # 12:30 <bradleyayers> pydonny: you looking for work?
- # 12:30 <pydonny> bradleyayers: i might be soon :)
- # 12:30 <pgcd> i'm completely stuck: is there any way of forcing a formwizard to display only one page out of a set and then jump to the "done" page?
- # 12:45 <pgcd> i think condition_dict should do that, but I can't figure out how to implement the checks
- # 12:45 <bradleyayers> pgcd: ill help you out soon
- # 12:45 <pgcd> bradleyayers: that would be very very nice - I'm quite literally pulling my hair out
- # 12:45 <pydonny> bradleyayers: will lock in the next python meet and greet!
- # 12:45 <bradleyayers> lets hope its not too awkward
- # 12:45 <bradleyayers> pgcd: okay i'm ready
- # 12:45 <pydonny> bradleyayers: why would it be awkward ?
- # 12:45 <pydonny> bradleyayers: should i bring friends ?
- # 12:45 <bradleyayers> pydonny: if one of us was introverted
- # 12:45 <bradleyayers> then it may be awkward for the other
- # 12:45 <bradleyayers> or whatever
- # 12:45 <bradleyayers> pgcd: so you just want to jump to the done page?
- # 12:45 <pgcd> bradleyayers: the situation is as follows
- # 12:45 <pgcd> bradleyayers: i have a formwizard (backport from 1.4) with 5 pages + done
- # 12:45 <pgcd> bradleyayers: everything's fine when I am inputting the data for the first time
- # 12:45 <bradleyayers> pgcd: so django-formwizard?
- # 12:45 <bradleyayers> are you on 1.3?
- # 12:45 <bradleyayers> pydonny: can bring friends if you want, but no need
- # 12:45 <bradleyayers> pydonny: it's usually pretty packed
- # 12:45 <pydonny> bradleyayers: ok sweet..
- # 12:45 <pgcd> bradleyayers: yes, django-formwizard (with some changes I had to apply myself because there was something missing from the 1.4 version)
- # 12:45 <bradleyayers> pgcd: i forked django-formwizard too and heavily modified it
- # 12:45 <pgcd> bradleyayers: the problem is that afterwards I need to be able to edit the data in one of the pages
- # 12:45 <pgcd> bradleyayers: my mods are really rather simple - just get_step_url and somthing relating to that
- # 13:00 <pgcd> bradleyayers: anyway - as is, when I submit the data in the page, the formwizard assumes that I need to edit everything on all the other pages, so it brings me back to the beginning
- # 13:00 <bullicon> http://www.youtube.com/watch?v=zt_UrokYek0&feature=related
- # 13:00 <bullicon> infact
- # 13:00 <pgcd> bradleyayers: which is ok in most situations, but not in mine - I just need to be able to edit that data and go back to the done page (or redirect somewhere else)
- # 13:00 <bradleyayers> pgcd: i follow.
- # 13:00 <bradleyayers> yes so formwizard is shit like one
- # 13:00 <bradleyayers> one of it's many fails
- # 13:00 <bradleyayers> actually i might be wrong
- # 13:00 <bradleyayers> that might work
- # 13:00 <pgcd> bradleyayers: well, it mostly does its job... i think the docs need some loving, though
- # 13:00 <bradleyayers> it's pretty shit imo
- # 13:00 <bradleyayers> try putting a form and a formset on the same page
- # 13:00 <pydonny> pgcd: yeah its pretty shit..
- # 13:00 <bradleyayers> or.. having URLs that have more than one parameter
- # 13:00 <pgcd> bradleyayers: I know, I had to do that as well and it really wasn't pretty
- # 13:00 <pgcd> bradleyayers: that shouldn't be too hard?
- # 13:00 <pgcd> bradleyayers: just do stuff in get_step_url? isn't that enough?
- # 13:00 <bradleyayers> yeah, probably
- # 13:00 <pgcd> anyway - no ideas on how to do that in a proper way? i'm currently down to "make 5 copies of the url and call the view with the appropriate kwarg from each one of them"
- # 13:00 <pgcd> but it's not exactly nice and/or maintainable
- # 13:00 <bradleyayers> pgcd: https://code.djangoproject.com/changeset/17235
- # 13:00 <bradleyayers> i forgot that my patch got accepted
- # 13:00 <pgcd> bradleyayers: thank you for that =)
- # 13:00 <bradleyayers> you can see what it was like before :P
- # 13:00 <bradleyayers> i.e. impossible
- # 13:00 <pgcd> bradleyayers: yeah, good for one thing and one thing only
- # 13:00 <sjaak_trekhaak> I've made my Django App timezone aware. Will values retrieved from MySQL be timezone aware as well?
- # 13:00 <pgcd> anyway, I guess there's no way of making it do what I want, right?
- # 13:00 <bradleyayers> pgcd: there is, i'm looking
- # 13:00 <pgcd> bradleyayers: that would be awesome
- # 13:00 <bradleyayers> pgcd: here's my branch though https://github.com/bradleyayers/django-formwizard/blob/master/tests/app/views/namedurlwizard.py
- # 13:00 <bradleyayers> you can see how i added support for multiple forms/formsets on one page
- # 13:15 <bradleyayers> pgcd: okay so the issue is in render_done
- # 13:15 <bradleyayers> pgcd: do you have your fork on github somewhere?
- # 13:15 <bradleyayers> https://github.com/django/django/blob/master/django/contrib/formtools/wizard/views.py#L321
- # 13:15 <bradleyayers> see how that'll fail for forms that don't have any data yet
- # 13:15 <bradleyayers> which will force you to resubmit each of the pages in your wizard again
- # 13:15 <bradleyayers> even if you're only interested in editing a single page
- # 13:15 <pgcd> bradleyayers: sorry, gf called
- # 13:15 <RedOktoberfest> hi everyone
- # 13:15 <bradleyayers> pgcd: http://dpaste.com/745431/ is the jist of what i did
- # 13:15 <RedOktoberfest> can someone explain how to save foreign keys? i cant make sense of the documention
- # 13:15 <bradleyayers> RedOktoberfest: do you have an example you can show me? (of your attempt)
- # 13:15 <bradleyayers> pgcd: see how i check form.is_bound
- # 13:15 <bradleyayers> pgcd: and the signature of Wizard.done changes to expect a dict of cleaned forms
- # 13:15 <pgcd> bradleyayers: ok, i see what you mean - which is why I ended up passing a subset of the forms
- # 13:15 <bradleyayers> pgcd: in your situation since you're using standard django-formwizard, you'll probably just want to pass a list of cleaned data to done(), and leave empty forms as None
- # 13:15 <bradleyayers> pgcd: then in your implementation of done() check to see if you've actually got any data for that step, and handle it appropriately
- # 13:15 <RedOktoberfest> bradley: here's the pastebin: pastebin.com/me7s4GVQ
- # 13:15 <pgcd> bradleyayers: the problem is that I don't reach done() unless the form_list yields only the one form
- # 13:15 <pgcd> bradleyayers: so I'm using this horrible horrible url pattern: url(r'^(?P<pk>\d+)/edit_media/(?P<step>.*)$', edit_immobile, {'single_step':'media', 'step':'media'},name = 'immobili_edit_media'),
- # 13:15 <bradleyayers> pgcd: woah that's bad :P
- # 13:15 <pgcd> which I repeat for the 5 different steps ("media" is one of the steps)
- # 13:15 <bradleyayers> haha :P
- # 13:15 <pgcd> bradleyayers: it's so bad I want to gouge my eyes out =D
- # 13:15 <bradleyayers> yeah, i've been through it all myself
- # 13:15 <bradleyayers> i really need to polish up my branch and put some docs up
- # 13:15 <pgcd> bradleyayers: but I can't figure out any other way of instantiating the proper formwizard
- # 13:15 <bradleyayers> you need to modify the code
- # 13:15 <pgcd> bradleyayers: of formwizard, you mean?
- # 13:15 <bradleyayers> yes
- # 13:15 <bradleyayers> pgcd: just modify render_done
- # 13:15 <pgcd> bradleyayers: and post(), otherwise I still need the whole ludcrous url setup
- # 13:30 <bradleyayers> yeah, i don't understand your urls
- # 13:30 <bradleyayers> why's that needed?
- # 13:30 <pgcd> bradleyayers: because I use a view to instantiate the model that I need to edit, and somehow I need to tell this view that it's supposed to only edit one page instead of all five
- # 13:30 <pgcd> bradleyayers: and I couldn't figure out how to use condition_dict
- # 13:30 <bradleyayers> can you show me your code?
- # 13:30 <pgcd> bradleyayers: sure
- # 13:30 <pgcd> bradleyayers: http://dpaste.com/745432/ - only the caller view, if there's something else you might want to see let me know
- # 13:30 <bradleyayers> why don't you just use AnnuncioWizard directly?
- # 13:30 <bradleyayers> then implement https://github.com/django/django/blob/master/django/contrib/formtools/wizard/views.py#L353
- # 13:30 <bradleyayers> you can get get pk from self.kwargs["pk"]
- # 13:30 <bradleyayers> (assuming you're using a named url pattern)
- # 13:30 <pgcd> bradleyayers: you mean if pk in self.kwargs: (fetch instance etc) else (behave as unbound)?
- # 13:30 <bradleyayers> pgcd: that should work yeah
- # 13:30 <pgcd> bradleyayers: i still need two different urls, though, right?
- # 13:30 <bradleyayers> well your 'add' url won't have a pk
- # 13:30 <bradleyayers> so you'll need different urls
- # 13:30 <bradleyayers> but they can all use the same view potentially
- # 13:30 <pgcd> bradleyayers: ok, that I can do and it's a good thing; I'm still a bit scared of going around changing the rest of the formwizard code
- # 13:30 <bradleyayers> pgcd: don't worry it's mostly shitty anyway
- # 13:30 <pgcd> bradleyayers: it was the single thing that took me the longest to get working, and I'm kinda afraid of breaking everything again
- # 13:30 <bradleyayers> yeah, well that's completely possible
- # 13:30 <pgcd> since I'm on a (past) deadline
- # 13:30 <bradleyayers> :(
- # 13:30 <pgcd> then again, i suppose branching is my friend, right? =)
- # 13:30 <bradleyayers> yeah, but only when now < deadline
- # 13:30 <pgcd> i keep the shitty setup that sort of works that I'm using now, and try to clean up the mess
- # 13:30 <bradleyayers> yeah
- # 13:30 <bradleyayers> you need to change render_done if you want to be able to edit without going through every step
- # 13:30 <bradleyayers> but you could could just subclass your wizard if you want to do that
- # 13:30 <pgcd> bradleyayers: hmmm... is your fork a plug-in replacement? =)
- # 13:30 <bradleyayers> hah, not quite
- # 13:30 <pgcd> bradleyayers: that is true - I'm still a victim of my years of php (happily ended), and some things just don't come to mind
- # 13:30 <pgcd> so I'll fix the urls, get rid of the view and try to see if render_done can help me
- # 13:30 <pgcd> thankfully i didn't have any programs for tonight =D
- # 13:45 <bradleyayers> for my edit views i just have a mixin that i mix with the add wizard
- # 13:45 <bradleyayers> but just write something along those lines
- # 13:45 <pgcd> bradleyayers: I still can't entirely wrap my head around mixins (when they override a method in the "base" class, specifically), so I guess I'll start with subclassing =)
- # 13:45 <bradleyayers> pgcd: mixins are simple, do you understand MRO?
- # 13:45 <pgcd> bradleyayers: I can't say that I do - I don't even know the acronym =)
- # 13:45 <bradleyayers> here's some explanation http://www.python.org/getit/releases/2.3/mro/
- # 13:45 <pgcd> bradleyayers: thanks, I was looking for something like that
- # 13:45 <bradleyayers> pgcd: if it's confusing feel free to ask question
- # 13:45 <pgcd> bradleyayers: will do, once I have a chance to read it - it's been promptly sent to my kindle =)
- # 13:45 <bradleyayers> it uses some technical language, but don't let that daunt you.
- # 13:45 <pgcd> bradleyayers: I'll try not to =)
- # 13:45 <liberica> hi. I want to release my application as an open-source pluggable app. In my app I use decorator render_to (http://packages.python.org/django-common/). Is it okay to use "external" libs in pluggable apps?
- # 14:00 <pgcd> liberica: definitely ok - it's what stuff like django-cms etc do - just make sure you list the requirements
- # 14:00 <nviror> Could someone help me installing askbot (django based)?
- # 14:00 <nviror> through skype or msn
- # 14:00 <bradleyayers> liberica: just be sure to include the dependency in your setup.py
- # 14:00 <nviror> I know php, not advanced level though and now interested in learning python over ruby
- # 14:00 <bradleyayers> unless you have a good reason for using django-annoying (or whatever provides render_to), i wouldn't
- # 14:00 <bradleyayers> liberica: having small packages with few dependencies is nice.
- # 14:00 <liberica> bradleyayers, good point, thanks
- # 14:00 <bradleyayers> liberica: if you really want render_to, just copy it into your app
- # 14:00 <bradleyayers> liberica: i'm pretty sure it's only like 5 lines
- # 14:00 <langemyh> Can somebody please tell me why messages failes? http://avia.langemyhr.org:8080/ Login: djangeo / django, try sending a SMS (number must be 8 numbers, content must be filled in).
- # 14:00 <langemyh> Gived me de error: "You cannot add messages without installing django.contrib.messages.middleware.MessageMiddleware", and yeah, that middleware is already installed
- # 14:00 <langemyh> Eh, login is "django" for username og "django" for password.
- # 14:00 <bradleyayers> langemyh: you need to add "django.contrib.messages.middleware.MessageMiddleware" to your MIDDLEWARE_CLASSES setting
- # 14:00 <langemyh> bradleyayers: The problem is, it's already there... Just search for "django.contrib.messages.middleware.MessageMiddleware" in the Error-page
- # 14:00 <langemyh> bradleyayers: I also got django.contrib.messages in INSTALLED_APPS, and TEMPLATE_CONTEXT_PROCESSORS has 'jango.contrib.messages.context_processors.messages' as well
- # 14:00 <pgcd> brb
- # 14:00 <bradleyayers> langemyh: intriguing
- # 14:00 <langemyh> bradleyayers: Very...
- # 14:00 <bradleyayers> shouldn't you be doing messages.info(request, ...
- # 14:00 <langemyh> bradleyayers: Thank you <3
- # 14:00 <langemyh> bradleyayers: Holy, I think I'm used to the old way or something
- # 14:00 <langemyh> bradleyayers: *ashamed*
- # 14:00 <bradleyayers> i dunno, i've never used messages :P
- # 14:00 <langemyh> bradleyayers: But you were absolutely right, so, it works now =)
- # 14:00 <bradleyayers> awesome.
- # 14:00 <langemyh> No doubt =)
- # 14:00 <bradleyayers> that's the toll for using duck typing
- # 14:00 <langemyh> Something like that =P
- # 14:00 <bradleyayers> awesome errors
- # 14:00 <langemyh> bradleyayers: Pretty useless actually
- # 14:00 <bradleyayers> yeah :P my sarcasm was subtle
- # 14:00 <langemyh> *chuckle*
- # 14:15 <amitprakash> Hi.. in a template how can I do something like {% if variable in [ value1, value2 ] %}
- # 14:15 <langemyh> amitprakash: Probably https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#in-operator
- # 14:15 <pgcd> amitprakash: {% if var in "string1,string2,string3" %} works
- # 14:15 <bradleyayers> amitprakash: no, {% if variable == value1 or variable == value2 %}
- # 14:15 <amitprakash> pgcd, thats only true for strings
- # 14:15 <amitprakash> bradleyayers, so I can't use in with a dynamically created list inside template blocks
- # 14:15 <nanonyme> Afaik you should be able to.
- # 14:15 <nanonyme> https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#in-operator
- # 14:15 <amitprakash> nanonyme, haven't been able to.. hence the question.. unless I am writing the block incorrectly [ as shown above ]
- # 14:15 <pgcd> amitprakash: if you can cast the values to strings (if they're numbers, for instance)...
- # 14:15 <nanonyme> The tricky bit there is actually *making* that list.
- # 14:15 <amitprakash> pgcd, dates
- # 14:15 <amitprakash> nanonyme, exactly
- # 14:15 <pgcd> amitprakash: i see... then you should perhaps pass the list in the context?
- # 14:15 <nanonyme> amitprakash, did you try creating it with template tag with?
- # 14:15 <amitprakash> nanonyme, so is it possible to create those lists?
- # 14:15 <amitprakash> nanonyme, no.. that is the next step if django doesn't have something in built
- # 14:15 <nanonyme> amitprakash, that is in-built.
- # 14:15 <amitprakash> nanonyme, creating a template tag is by definition additional code to add another feature [ here .. creating a list inside template ]
- # 14:15 <nanonyme> amitprakash, if works the same way
- # 14:15 <m0hsin> django.wsgi contains the following lines
- # 14:15 <nanonyme> amitprakash, all the things you use in templates are like that
- # 14:15 <m0hsin> sys.path.append('/opt/bitnami/apps/django/django_projects/hp')
- # 14:15 <m0hsin> hp is my rpoject
- # 14:15 <m0hsin> what should this line points to? and what should be the project hierarchy?
- # 14:15 <nanonyme> amitprakash, if you dislike using Django's builtin template tags, don't use Django templates
- # 14:15 <amitprakash> nanonyme, these are the built in template tags, which one should I be using? https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs
- # 14:15 <nanonyme> amitprakash, https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#with
- # 14:15 <nanonyme> I'm not sure if it's doable with that but many things are. Creating a list might be.
- # 14:15 <amitprakash> nanonyme, ah sorry.. didn't realize you were talking about "with"
- # 14:15 <amitprakash> took that as part of the statement .. not as a noun there :)
- # 14:15 <nanonyme> amitprakash, that wouldn't have been a valid English sentence if it hadn't been a noun. :P
- # 14:15 <amitprakash> right :) my mistake :D
- # 15:00 <pgcd> is there any way of using a matched regex group in an url as a different kwarg? something like url(r'^(?P<field>)_delete', do_something, kwargs={'redirect':'\1_done'}))
- # 15:00 <pgcd> (ignore the names, what I'm interested in is the "\1" part)
- # 15:00 <urth> no, but you could wrap your view in a new function as \1 is already passed as a kwarg
- # 15:00 <pgcd> urth: ok, I think i see what you mean
- # 15:00 <pgcd> urth: thanks
- # 15:00 <urth> is it intented that request is not passed to AuthenticationForm on POST requests in django.contrib.auth.views.login ? (which effectively disables the cookie test)
- # 15:15 <fred-fri> i just fired up my first pinax project, the account project. im a bit mystified as to where the html for the top bar resides. it uses h3 tags, and ive searched my project for that but no files have any.
- # 15:15 <v0lksman> check pinax in your python path
- # 15:15 <fred-fri> sorry, not sure what you mean by that... its a fresh virtualenv where i just followed the instructions on the pinax site
- # 15:15 <v0lksman> fred-fri: well you installed pinax somewhere right?
- # 15:15 <fred-fri> /home/me/virtualenv/django_env/lib/python2.7/site-packages/pinax
- # 15:15 <fred-fri> oh, theres more views and stuff here
- # 15:15 <fred-fri> not what i seem to be looking for though
- # 15:15 <fred-fri> arguably all the html for my project should reside in the project folders template folders, no?
- # 15:30 <antihero> hello, when I'm using django-admin-extensions and ipython, is there a way to "refresh" files from disk without exiting the shell?
- # 15:30 <gcbirzan_> No.
- # 15:30 <antihero> darn
- # 15:30 <gcbirzan_> This is not necessarily a django or ipython problem, though.
- # 15:30 <gcbirzan_> I mean, yeah, there's a way to reload modules, but it won't do what you want.
- # 15:30 <fred-fri> v0lksman: i see that some of the files reside in the pinax folder. this to me seems quite odd.
- # 15:45 <pratz_> hey guys request.session.items() is a list of tuples, but how come it has all methods of a dict ?
- # 15:45 <gcbirzan_> Because request.session is a dict-like thing.
- # 15:45 <gcbirzan_> And dict.items returns tuples.
- # 15:45 <gcbirzan_> Erm, it returns a list of tuples, that is.
- # 16:00 <aQute> I have a django project and I want to provide authentication using oauth the poblem is it needs to be browserless is there any way to do that ?
- # 16:00 <lorn> Does anyone use fandango? I would like to know how did you extend your access_token ( for 60 days ) - https://developers.facebook.com/roadmap/offline-access-removal/
- # 16:15 <zhangxiao> SomeModel.objects.filter(...).delete() doesn't return anything. Is there a way to know how many lines have been deleted?
- # 16:15 <Tjati> Hi there. I am working with django since two weeks and I LOVE IT :D
- # 16:15 <gcbirzan_> Give it a little time.
- # 16:15 <Tjati> a lot of problems i have resolved using google and reading the documentation careful ;)
- # 16:15 <Tjati> But NOW my head is banging the wall next to me.
- # 16:15 <Tjati> I think it is a simple problem (hrhr): I have a class Obj(models.Model) with an attribute pub_date = models.DateTimeField()
- # 16:15 <gcbirzan_> zhangxiao: It seems that depends on your backend.
- # 16:15 <Tjati> Having obj = Obj() i try to obj.pub_date < datetime.now()
- # 16:15 <Tjati> but it does not work.
- # 16:15 <Tjati> HOW can i check if the pub_date is in the past?
- # 16:15 <gcbirzan_> Well, first of all, if you do obj = Obj() then obj.pub_date will be null
- # 16:15 <gcbirzan_> And second, what does "does not work" mean?
- # 16:15 <Tjati> gcbirzan_: i shortend my code.
- # 16:15 <Tjati> [u"'<built-in method now of type object at 0x000000001E262340>' is wrong formatted: YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]."]
- # 16:15 <gcbirzan_> Pastebin your code.
- # 16:15 <Tjati> just obj.pub_date < datetime.now throws: can't compare datetime.datetime to builtin_function_or_method
- # 16:15 <gcbirzan_> Well, firstly. You're trying to compare a datetime object with a method.
- # 16:15 <gcbirzan_> Call said method.
- # 16:15 <gcbirzan_> The list you pasted is not an exception, pastebin the exception and traceback as well.
- # 16:15 <antihero> is there a way to hook into the django admin log as opposed to implementing my own log?
- # 16:30 <nanonyme> antihero, do you mean "Django logging system"?
- # 16:30 <Tjati> gcbirzan_: http://pastebin.com/KBZWxCGB
- # 16:30 <Tjati> gcbirzan_: problem is line 20
- # 16:30 <Tjati> gcbirzan_: Exception Type: ValidationError
- # 16:30 <gcbirzan_> Tjati: Full traceback.
- # 16:30 <gcbirzan_> Also, you're comparing datetimes to functions below that.
- # 16:30 <gcbirzan_> I'd just do now = datetime.now() at the beginning of the code, and use now from there on.
- # 16:30 <pgcd> later guys
- # 16:30 <gcbirzan_> Also, you cannot change a datetime object like that. http://babbledrive.appspot.com/#datetime.datetime.replace
- # 16:30 <Tjati> gcbirzan_: http://pastebin.com/KkCNvUJW
- # 16:30 <Tjati> gcbirzan_: same error with 'now = datetime.now()' and if obj.pub_date < now:
- # 16:30 <lgp171188> Hi, I see that the django project structure has changed from 1.4 onwards. Which is the recommended place to create apps that constitute a project now? Inside the project folder or on the same level as the manage.py and the project?
- # 16:30 <gcbirzan_> Tjati: Also, you're using except without an exception type, don't do that. Your specific error is caused by the fact that you have an error in that try (21-30) and you're then replacing obj.pub_date with a method.
- # 16:30 <gcbirzan_> lgp171188: What's an app that consitutes a probject?
- # 16:30 <lgp171188> gcbirzan_: For example in a site that acts as an expense log, there can be an app for creating and managing expenses and an app for reports that interpret the data.
- # 16:30 <lgp171188> In Django 1.3, I used to put them inside the directory that contained the settings.py, manage.py and the project level urls.py
- # 16:30 <gcbirzan_> And now, you put them a directory above.
- # 16:30 <bmispelon> lgp171188: reusable app go beside manage.py (and in your code, you do import myapp).
- # 16:30 <bmispelon> apps that are tied to your projects go beside settings.py (and you use them with import myproject.myapp)
- # 16:45 <lgp171188> bmispelon: Ok, so I have to go to the directory containing settings.py and then run python ../manage.py createapp app1
- # 16:45 <lgp171188> because running the command from the same directory where manage.py is present - "manage.py startapp project/appname" doesn't work
- # 16:45 <bmispelon> lgp171188: there might be some options. You can also create the app folder and move it later.
- # 16:45 <lgp171188> bmispelon: Yes, after all an app is just a python module
- # 16:45 <bmispelon> lgp171188: exactly.
- # 16:45 <bmispelon> lgp171188: looks like you can do ./manage.py startapp yourapp yourproject
- # 16:45 <bmispelon> ie pass the destination folder as the last argument
- # 16:45 <Tjati> gcbirzan_: amazing! Your help was great. Thanks a lot.
- # 16:45 <Tjati> gcbirzan_: there's just one little thing I am confused about: obj.pub_date.replace(hour=now.hour, minute=now.minute, second=now.second)
- # 16:45 <Tjati> gcbirzan_: it does not change the time. why now?
- # 16:45 <Tjati> *why not
- # 16:45 <bmispelon> Tjati: .replace() returns a new datetime object
- # 16:45 <bmispelon> Tjati: you have to do obj.pub_date = obj.pub_date.replace(...)
- # 16:45 <bmispelon> (and then do obj.save() if you want to save the changes to the database)
- # 16:45 <danthedeckie> Strange - my admin interface quite happily sets a DateField, but refuses to display it again if I revisit the page (and it set's the field as blank)
- # 16:45 <Tjati> bmispelon: amazin! thanks a lot!
- # 16:45 <bmispelon> Tjati: you're welcome.
- # 16:45 <Tjati> :-)
- # 16:45 <danthedeckie> ah. I found it. SQLite DATETIME fields are set by Django DateField, but not read. Change to varchar(30) and it's fine...
- # 16:45 <danthedeckie> bit odd.
- # 17:00 <lgp171188> bmispelon: Specifying the destination directory doesn't work for me. I ran "python manage.py startapp appname project" and I get "Error: <full path>/projectname/projectname/__init__.py already exists, overlaying a project or app into an existing directory won't replace conflicting files" :(
- # 17:00 <bmispelon> lgp171188: yeah, i just tried. You have to create an empty directory first and then point startapp to that
- # 17:00 <bmispelon> so mkdir yourproject/newapp; ./manage.py startapp newapp yourproject/newapp/
- # 17:00 <lgp171188> bmispelon: how unintuitive! can't create inside the project in a straight way :-/
- # 17:00 <bmispelon> lgp171188: I agree with you, maybe it could be made better
- # 17:00 <lgp171188> bmispelon: I would rather use the single command python ../manage.py startapp appname from the project directory
- # 17:00 <bmispelon> lgp171188: consider opening a ticket to suggest improvements
- # 17:00 <lgp171188> bmispelon: I need to check if someone already has. Don't think such an obvious thing wouldn't have been observed by anyone else
- # 17:00 <bmispelon> lgp171188: well, this is related to the new project layout so it's quite recent
- # 17:00 <lgp171188> bmispelon: I agree, but Django 1.4 was released more than a month back, so let me check
- # 17:00 <lgp171188> bmispelon: The reason I asked this question regarding the recommended place was because the official tutorial asks to create the app in the same level as manage.py
- # 17:00 <bmispelon> lgp171188: well technically, you can put an app anywhere that's on your python path
- # 17:00 <bmispelon> putting an app in your project folder (beside settings.py) just makes it clear that it's tied to that project
- # 17:00 <lgp171188> bmispelon: I agree, but sometimes it makes sense to access it like project.app. Just thinking on the lines of "convention over configuration"
- # 17:00 <zain_aa> Hey all, I had a question RE the File API
- # 17:00 <zain_aa> If i am using the django-ajax-uploader[https://github.com/GoodCloud/django-ajax-uploader/], which takes the submitted file and writes it to a path, how can I use the File API to change its path?
- # 17:00 <jengdal> I'm making a new app that contains a model that I would like to, in the admin, be StackedInline against a model from another app, that already has its own admin. I get an already registered exception, is there any way around that. In my new app the model from the other app would not be editable, only the inline objects.
- # 17:15 <iSays> Can i access to auth.User in model area? i need to track the [creator|editor] of an object, can i access to user information in save() method at Model ?
- # 17:15 <antihero> is there a config option to divert all emails to admins if debug is set?
- # 17:15 <antihero> custom e-mail backend?
- # 17:15 <morninj> i've created a manytomany relationship with these models: http://dpaste.com/745543/plain/ . what query would i execute to add multiple Groups to a Person object?
- # 17:15 <iSays> I found an example about it, But it's just for AdminModel http://stackoverflow.com/a/1477428/636136, i couldn't find anything suitable to access user object at model area
- # 17:15 <ticketbot> https://github.com/django/django/commit/1477428
- # 17:15 <zain_aa> anyone know how to change the path of a file in django?
- # 17:15 <iSays> morninj: See the example => https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships
- # 17:15 <zain_aa> if i use ajax to upload a file, how can i change its path, and should i do it before or after associating it with a model?
- # 17:15 <iSays> zain_aa: haa ?
- # 17:15 <mlavin> antihero: you might find this app handy for that situation http://pypi.python.org/pypi/django-email-bandit
- # 17:15 <morninj> @iSays is there a way to do it without using an intermediate model like Membership?
- # 17:15 <zain_aa> iSays: ?
- # 17:30 <iSays> morninj: intermediate model is just for showing flexibility, of course it can be. Just get a instance of you model and added.
- # 17:30 <morninj> iSays nevermind, i was able to find the answer in https://docs.djangoproject.com/en/dev/topics/db/examples/many_to_many/. thanks!
- # 17:30 <gamingdroid> Where is a good place to learn how to write tests for django apps?
- # 17:30 <mlavin> gamingdroid: carljm had a great PyCon talk on testing http://pyvideo.org/video/699/testing-and-django
- # 17:30 <gamingdroid> mlavin: thanks! Are there specific methods you suggest? Something I should look at to ensure I can easily upgrade to another django version and eventually Python 3....
- # 17:30 <mlavin> gamingdroid: not sure what you mean by methods but if you want to test your app vs various Python/Django versions I would recommend looking at tox http://tox.testrun.org/latest/
- # 17:45 <mlavin> gamingdroid: there are already great examples of django apps which do this like django-compressor
- # 17:45 <lejocelynbis> some has tried to use reportlab ? I'd like to draw an image but I can't get it work
- # 17:45 <lejocelynbis> and the doc isn't very helpful
- # 17:45 <lejocelynbis> without any real example
- # 17:45 <lejocelynbis> and the error message of django aren't helpful, except getting TemplateDoesNotExist: 500.html
- # 17:45 <lejocelynbis> or maybe is there another place for the error messages ?
- # 17:45 <gamingdroid> mlavin: With methods, I was thinking of "unit" testing or "integration" testing techniques. Currently, I don't write any test, so any major change, I have no clue if it broke other parts.
- # 17:45 <mlavin> gamingdroid: you should have both unit tests and integration tests. integration tests are slower and are typically more fragile but "easier" to write using the Django test client.
- # 17:45 <Tjati> hell.... I try to deploy my django things on my debian server but using pgsql is impossible
- # 17:45 <gamingdroid> mlavin: I'm not looking forward to writing test cases, but appreciate your help! :D
- # 17:45 <Tjati> sudo easy_install psycopg2 says it needs the pg_config ... pgsql is installed and running, i do not know where to get this binary
- # 17:45 <mlavin> gamingdroid: no problem. you should look forward to having stable and tested code :)
- # 17:45 <gamingdroid> mlavin: true, but there are so many apps...
- # 17:45 <gamingdroid> mlavin: which also brings up the Q on python 3.0 support. I wonder if that really is coming with 1.5....
- # 17:45 <Naglik> hi all, i wanna compare dynamic (script) langues (python via django vs php via zend), but i need to say sth about compiled languages (c# via asp, java via jsp), what could i say
- # 17:45 <mlavin> gamingdroid: the official announcement was experimental Py3k support in 1.5. I expect it will be another release or two before it's completely stable
- # 17:45 <gamingdroid> mlavin: you mean major releases?]
- # 17:45 <mlavin> gamingdroid: yes major releases
- # 17:45 <gamingdroid> mlavin: so we are looking at probably 4-5 major releases before python 2.7 is deprecated.
- # 17:45 <mlavin> gamingdroid: it will also take time for third party apps to support Py3K
- # 17:45 <gamingdroid> mlavin: That is my biggest concern, most of these apps aren't likely to move over other than the really popular ones.
- # 18:00 <mlavin> gamingdroid: I can't say how many releases but I expect you'll have quite some time (read: years) before 2.7 support is dropped
- # 18:00 <mlavin> gamingdroid: it will be a nice way to weed out unmaintained apps from the community
- # 18:00 <Tjati> I tried python manage.py createsuperuser but it fails :( http://pastebin.com/8Q0NXgy8
- # 18:00 <Tjati> python -> import django; print django.get_version() returns 1.4
- # 18:00 <lejocelynbis> is reportlab being used by some people or would you recommend another library ?
- # 18:00 <mlavin> Tjati: see #16017
- # 18:00 <ticketbot> https://code.djangoproject.com/ticket/16017
- # 18:00 <Tjati> lejocelynbis: great, the workaround there helped me. :) my super user was successfull created
- # 18:00 <lejocelynbis> Tjati: sorry ?
- # 18:15 <Tjati> lejocelynbis: sorry -.- I meant mlavin
- # 18:15 <lejocelynbis> no problem Tjati
- # 18:15 <lejocelynbis> any clue about reportlab ? :)
- # 18:15 <Tjati> never heard about it
- # 18:15 <Tjati> I am working with python since two or three weeks
- # 18:15 <Tjati> sorry.
- # 18:15 <lejocelynbis> nevermind, thank you :)
- # 18:15 <urth> lejocelynbis: we've used it, and it's a pita at times, but I don't know of any other options
- # 18:15 <lejocelynbis> urth: pita ?
- # 18:15 <lejocelynbis> I don't know that word ?
- # 18:15 <lejocelynbis> pain in the a :)
- # 18:15 <lejocelynbis> urth: do you know how to put images in your pdf ?
- # 18:15 <lejocelynbis> the doc isn't very good
- # 18:15 <lejocelynbis> im = canvas.ImageReader("./LesoiseauxduVanuatu/100_Columba_vitiensis.jpg") p.drawImage(im, 2, 3) p.showPage() p.save() should do but it's not
- # 18:15 <urth> I've only used it to convert html to pdf, that enabled me to use django templates, the <img> tag is supported
- # 18:15 <endzYme> If I pass a dictionary to a template and the key I'm looking for has a dash it will not be able to look up the values?
- # 18:30 <synic> are there problems with django 1.4, staticfiles, and runserver? It seems to be automatically setting up some urls that don't seem to work with things like DJANGO_LESS and etc
- # 18:30 <Tjati> ooooooookaaaay.... well.... following is in my error.log trying to use Django with wsgi:: http://pastebin.com/VymjMffb
- # 18:30 <Tjati> there IS a settings.py in the same directory to wsgi.py
- # 18:30 <antihero> is there a way when doing Model.objects.all() I can force it to load a relation in the first query?
- # 18:30 <antihero> for speeds
- # 18:45 <Tjati> ah, okay, step by step it is woking
- # 18:45 <Tjati> working
- # 18:45 <Tjati> now I got DoesNotExist at /admin/ Site matching query does not exist. :D
- # 18:45 <dekuked> hey, if I use send_mail and set silently_fail to false, when is it supposed to fail?
- # 18:45 <dekuked> my emails aren't being delivered, but it's returning 1, which I assume means success
- # 18:45 <jaddison> dekuked: There are a lot of reasons email might not go through. Django is the easiest one to debug. ;)
- # 18:45 <jaddison> What are your email related settings?
- # 18:45 <dekuked> well that's what I'm wondering...
- # 18:45 <dekuked> do I have to install more than sendmail to get it to work?
- # 18:45 <XeN-Lo> hi
- # 18:45 <XeN-Lo> I looked into the django doc. I'm interessed to implement the inheritance for my template
- # 18:45 <XeN-Lo> I want to have base template for my entire site and provide one extend by application
- # 18:45 <XeN-Lo> but I don't understand when I have to put my base templat in the diretory hierarchy
- # 18:45 <lxsameer> hi, how can i set the global language in view ?
- # 19:00 <XeN-Lo> is it ok to put /home/me/mytemplate/base.html and home/me/mytemplate/myFirstApp/anExtend.html ?
- # 19:00 <Tjati> hooray it works
- # 19:00 <briancra_> would anyone know why "post_save.connect(update_feed, sender=Post)" at the end of models.py would trigger an error on "super(Post, self).save(*args, **kwargs)" in the Post model's save()?
- # 19:00 <briancra_> I don't need to return a model or instance from signals, correct?
- # 19:15 <mlavin> briancra_: no you do not need to return anything from the post_save handler
- # 19:15 <Kronuz> the name is in unicode (as it comes from the database and it's encoded in unicode)
- # 19:15 <lxsameer> how can i change the language in a view ?
- # 19:15 <intgr> Kronuz: I believe Python automatically detects the encoding from the locale environment variables.
- # 19:30 <Kronuz> intgr: it's not
- # 19:30 <Kronuz> :/
- # 19:30 <intgr> If those are unset, it falls back to ASCII and errors out
- # 19:30 <level09> with the new layout in django 1.4 , where should I put my templates ?
- # 19:30 <Kronuz> `locale` reports UTF-8 as my LANG and all
- # 19:30 <Kronuz> intgr: unless I'm missing something
- # 19:30 <intgr> Kronuz: Your shell environment doesn't necessarily match the server environment
- # 19:30 <level09> Kronok: are you having the lcoale problem on mac ?
- # 19:30 <Kronuz> not on my Mac, in my FreeBSD server
- # 19:30 <Kronuz> in my mac works fine
- # 19:30 <level09> Kondou: its the same thing
- # 19:30 <level09> I wrote about this issue
- # 19:30 <XeN-Lo> level09, I'm also quite lost with the template hierachy in 1.4
- # 19:30 <level09> http://level09.com/54/tip-how-to-fix-django-locale-problem-on-mac-osx-10-7
- # 19:30 <Kronuz> from the python console, how can I tell what locale it's set?
- # 19:30 <level09> Kronok: you can import locale
- # 19:30 <intgr> Kronuz: As I said, your shell's environment can differ from the web server's environment
- # 19:30 <Kronuz> 'cause I did that LANG thing and all, and `locale` from the shell showed UTF-8
- # 19:30 <lobius> Right now, I have this to control a drop down box. http://dpaste.org/tPWsx/ can I add a third item to each tuple without messing up the drop down? I want to access the third item in a method for a different purpose. Trying to think in DRY.
- # 19:30 <Kronuz> but still python failed
- # 19:30 <intgr> Kronuz: Try printing os.environ to log from the web server
- # 19:30 <Kronuz> I'm in a python console
- # 19:30 <Kronuz> and it doesn't work there either
- # 19:30 <Kronuz> let me try again
- # 19:30 <intgr> Oh
- # 19:30 <level09> python -c 'import locale; print(locale.getdefaultlocale());'
- # 19:30 <level09> what does that output ?
- # 19:30 <Kronuz> os.environ shows 'LANG': 'en_US.UTF-8'
- # 19:30 <Kronuz> import locale; print(locale.getdefaultlocale()); shows ('en_US', 'UTF-8')
- # 19:30 <Kronuz> :/
- # 19:30 <Kronuz> and now it worked
- # 19:30 <antihero> If I'm making list_fields = [] can I list a field on a foreign object?
- # 19:30 <antihero> how do I do that
- # 19:30 <Kronuz> I swear it wasn't working!
- # 19:30 <Kronuz> :/
- # 19:30 <intgr> Yeah right Kronuz, now we all know that you're a shameless liar! :)
- # 19:30 <Kronuz> it's working now
- # 19:30 <Kronuz> :P
- # 19:30 <Kronuz> maybe I set something wrong last time :/
- # 19:30 <Kronuz> now, does django have a configuration option where I can set that ?
- # 19:30 <Kronuz> instead of doing export LANG
- # 19:30 <Kronuz> ?
- # 19:30 <intgr> Well the "right way" is configuring that in your environment and making sure that the web server is properly launched with that environment.
- # 19:30 <intgr> But that's OS-specific and also depends on the init scripts. Perhaps /etc/profile is the right place
- # 19:45 <Yxven> http://dpaste.org/gcjzR/ Is this the right way to store decks for a javascript card game? It feels overly complicated to store/retrieve as opposed to just storing a json dictionary
- # 19:45 <endzYme> Hello all, trying to iterate through a dictionary in a template. http://pastie.org/private/z7i97hctclxv2p0iiyjvuq I am receiving no output at all. I am also fairly new with Django.
- # 19:45 <intgr> Yxven: Looks like a fully normalized schema, yes, but probably an overkill.
- # 19:45 <lacrymology> is there a way of having the dev server handle https?
- # 19:45 <intgr> Why do you need https in your dev server?
- # 19:45 <lacrymology> intgr: to test some difference between ssl-proteceted and non-ssl protected views?
- # 19:45 <intgr> You could write a middleware to inject those variables into the request.
- # 20:00 <kevlarman> endzYme: try writing that loop in python and you'll see why it doesn't work
- # 20:00 <endzYme> kevlarman: Ok only passes the str vals. So rewrote but I still don't appear to have the syntax right. http://pastie.org/private/z7i97hctclxv2p0iiyjvuq
- # 20:00 <kevlarman> endzYme: for i in some_dict: iterates over *keys*, not values
- # 20:00 <intgr> Yxven: Just store it as a bunch of text, each card is two characters specifying its suit and rank.
- # 20:00 <intgr> Or at least that's how I would do it as a "keep it simple stupid" approach
- # 20:00 <tanto> i'm having a strange issue with my django / apache2 / modwsgi. i just recently had to migrate my django stuff from old server to new server and everything works fine except for the admin section of django. when i try to save an update / POST, i get 'bad request, Your browser sent a request that this server could not understand." but the update is still working
- # 20:00 <tanto> i've checked the logs but not much is getting logged in apache
- # 20:00 <endzYme> kevlarman: so some_dict.values()?
- # 20:00 <tanto> just this: request failed: error reading the headers
- # 20:00 <kevlarman> endzYme: assuming you don't care about the keys, yes
- # 20:00 <kevlarman> otherwise iteritems or w/e
- # 20:00 <endzYme> kevlarman: ah right - makes sense thanks for your help
- # 20:00 <lorn> Does anyone know a good way to convert this Facebook date '2012-05-18T17:00:00' to django DateTimeField? I did this http://pastebin.com/1eL40Lig but I didn't like
- # 20:00 <intgr> What do you maean "I didn't like"?
- # 20:00 <kevlarman> lorn: um, datetime.strptime?
- # 20:00 <intgr> Ah I see the concatenation thing
- # 20:00 <RoosterJuice> where would i put a new definition for middleware?
- # 20:00 <RoosterJuice> settings.py?
- # 20:00 <lorn> kevlarman: what is the difference?
- # 20:00 <RoosterJuice> middleware.py?
- # 20:00 <kevlarman> lorn: it returns a datetime
- # 20:00 <lorn> kevlarman: I'll try that, thanks
- # 20:15 <Yxven> thanks intgr
- # 20:15 <sambao21> what are some good reasons not to just always use {% autoescape %}
- # 20:30 <intgr> sambao21: When you're templating non-HTML output
- # 20:30 <lgp171188> If I want to convert the value of a CharField to lower case before inserting to the database, how to do it? I know I have to override the save method and do the conversion there. But how do I convert the contents of a CharField to lower case?
- # 20:30 <iiie> lgp171188: model.fieldname = model.fieldname.lower()
- # 20:30 <sambao21> intgr:but if you can't be really be sure, then is it safe and recommended to just go ahead and do autoescape the entire thing then?
- # 20:30 <iiie> lgp171188: sorry self.fieldname = self.fieldname.lower() (self is in save...)
- # 20:30 <lgp171188> iiie: I have written code like that, but had doubts if it would work. Because I have declared fieldname=CharField() or TextField() and afaik those field objects don't have a .lower() method that string objects have
- # 20:30 <nanonyme> does autoescape leave things marked as safe unescaped, btw?
- # 20:30 <Nuckin> interesting question (at least i think so): so i have a tag object which has a foreign key to a post, I assume calling t.post (t being a Tag instance and post being the foreignkey field) hits the database, but does t.post.pk? since pk is the value stored in Tag's table to reference Post
- # 20:30 <sirfilip> morning
- # 20:30 <intgr> sambao21: Yes. autoescape is already enabled by default in recent Django versions
- # 20:30 <iiie> lgp171188: right, but you do get values out and set values the same way :) the model instance's self.fieldname isn't the field, but the value of the field
- # 20:30 <iiie> lgp171188: there is quite a bit of hand waving here yes
- # 20:30 <sambao21> oh, i might've missed that, will have to review the release notes again
- # 20:30 <lgp171188> iiie: ah, that makes sense. thanks for clarifying my doubt
- # 20:30 <sambao21> any idea when that happened? to help refine my query for finding that info about autoescape on by default
- # 20:30 <sambao21> nm, found it
- # 20:30 <iiie> lgp171188: a couple things to take a quick look at model_instance.__dict__ , model_instance.fieldname.__class__ (in the shell they are handy)
- # 20:30 <lgp171188> iiie: let me have a look
- # 20:30 <sambao21> intgr: thanks for that heads up
- # 20:30 <Nuckin> so, when getting the pk of a ForeignKey field, does it just grab the raw value from the field or query for the object and then read the pk from that?
- # 20:45 <dekuked> hey, what does this error mean?: https://gist.github.com/2647748
- # 20:45 <ticketbot> https://github.com/django/django/commit/2647748
- # 20:45 <dekuked> I think I setup postfix correctly...
- # 20:45 <sirfilip> night
- # 20:45 <lobius> These are the first two methods of my model class: http://dpaste.org/P8NnO/ Did I do this right? Will open_rate give the right value in the second method? I'm trying to create elements of an invoice. I fear spaghetti code might develop if I don't figure this out in the beginning with these two methods.
- # 20:45 <dekuked> ummm... any good, current tutorials for setting up django with postfix?
- # 20:45 <rors> i can't seem to find the django docs on verify_exists for a URL field. Did that go away?
- # 21:00 <bmispelon> rors: it did.
- # 21:00 <iiie> https://docs.djangoproject.com/en/dev/internals/deprecation/ about half way down, search for verify
- # 21:00 <mark_locklear> anyone running their django apps on heroku? http://stackoverflow.com/questions/10421302/folder-structure-and-running-an-exsisting-django-app-on-heroku
- # 21:00 <ticketbot> https://github.com/django/django/commit/10421302
- # 21:00 <rors> bmispelon: thx!
- # 21:00 <rors> but also, crap.
- # 21:00 <rors> iiie: thx also.
- # 21:00 <iiie> rors: you can customize save, or your form still it's just not going to be in django (from my reading of the time line deprecated in 1.3.1, removed in dev/1.5)
- # 21:00 <jnoob22> is there a decent "free"/open source IDE/editor for Linux to use with Django (besides Eclipse)?
- # 21:00 <rbenzaquen> Hi Guys, I'm looking a good training online or in the bay area. Does somebody knows?
- # 21:00 <mark_locklear> jnoob22, VIM ;)
- # 21:00 <jnoob22> hah hah
- # 21:00 <jnoob22> anyways.... ;-)
- # 21:00 <jnoob22> jk man
- # 21:00 <rors> but now i'm curious what these intractable security issues are, and whether i'll be able to reasonably protect against them in my case, and if i really even want to do this. ugh.
- # 21:00 <wunz> what is the recommended environment for developing django?
- # 21:00 <mark_locklear> nah...I mean unless u'r a mac guy then straight linux I don't think there are many great options...
- # 21:00 <wunz> linux, mac, or winblows?
- # 21:15 <intgr> wunz: Doesn't matter really. I'd say the best is what matches your server, which is more likely Linux. :)
- # 21:15 <wunz> ok, ubuntu, here i come then ;p
- # 21:15 <wunz> thanks intgr
- # 21:15 <mark_locklear> wunz, good choice...got 10.04
- # 21:15 <mark_locklear> *go
- # 21:15 <intgr> You mean 12.04 right?
- # 21:15 <mark_locklear> NO!
- # 21:15 <mark_locklear> 10.04 rocks...
- # 21:15 <iiie> rors: I remember it being mentioned.... http://www.cvedetails.com/vulnerability-list/vendor_id-10199/product_id-18211/Djangoproject-Django.html and http://www.livehacking.com/tag/django/ say a lack of timeout for the request leading to denial of service, and possibly unintended source IP
- # 21:15 <mark_locklear> ..nah...I have not tryed 12.x yet...how is it?
- # 21:15 <mark_locklear> I played with 11.x some...and went back to 10.x because everythign just worked...or at least I knew how to make it work.
- # 21:15 <intgr> 10.04 is ages old
- # 21:15 <mark_locklear> intgr, supported through 2014 though
- # 21:15 <intgr> I guess the only reason to use it is if you like Gnome 2
- # 21:15 <iiie> ACTION has fun with the change from python 2.7.2+ to 2.7.3 in virtualenvs for sys.urandom
- # 21:15 <iiie> but other than that it's good so far
- # 21:15 <mark_locklear> intgr, its just a system thing to me...I know all the packages I need to get my dev env going...
- # 21:15 <mark_locklear> so no one is using heroku for hosting huh?
- # 21:15 <rors> iiie: thx I'll take a look at that.
- # 21:15 <intgr> And srsly, Ubuntu 10.04 still has PostgreSQL 8.4
- # 21:15 <neataroni> how do i serve my django site from my computer to external
- # 21:15 <intgr> neataroni: If it's just for testing, use './manage.py runserver 0.0.0.0:8000'
- # 21:15 <neataroni> intgr: sweet, thanks
- # 21:15 <iiie> 11.10 to 12.04 changed python versions from 2.7.2+ to 2.7.3, there was a security fix in that change that changes how urandom is pulled into sys. This will break your existing virtualenvs.
- # 21:15 <intgr> neataroni: If you want it to actually work well, read https://docs.djangoproject.com/en/dev/howto/deployment/
- # 21:15 <neataroni> intgr: then where do i go to visit the site from other computers?
- # 21:15 <neataroni> intgr: i enabled port forwarding btw
- # 21:15 <intgr> If you forwarded port 8000 to your computer, just access http://your-external-ip:8000/
- # 21:15 <neataroni> intgr: thats what i figured, but it hangs when i try and access that from another computer, but is that because the other computer is also on the same wireless network?
- # 21:15 <intgr> Try your internal IP then
- # 21:15 <intgr> ##networking would be more relevant
- # 21:15 <neataroni> intgr: sorry, thans for the help
- # 21:15 <intgr> :)
- # 21:15 <vectorjordan> I've been reading the docs and I am having a lot of trouble setting up my first imagefield form. Can someone explain Media Root and request.FILES?
- # 21:30 <bracki> What can be done when pip is extremely slow?
- # 21:30 <pjs> use a mirror
- # 21:30 <bracki> How?
- # 21:30 <pjs> http://jacobian.org/writing/when-pypi-goes-down/
- # 21:30 <bracki> But PyPi is not down, I can easily browse and download with FF/Chrome whatever. Only pip is slow.
- # 21:30 <pjs> are you on fbsd?
- # 21:30 <bracki> fbsd?
- # 21:30 <pjs> I notice on FreeBSD pip is slow for some reason. I just pass --timeout=1 and it works fine
- # 21:30 <pjs> FreeBSD* so by your question, I assume no ;)
- # 21:30 <pjs> anyways.. try the timeout
- # 21:30 <bracki> Nah, Ubuntu 10.04
- # 21:30 <pjs> I gotta jet.. bbiab
- # 21:30 <bracki> thanks
- # 21:30 <intgr> pjs: Slow at what? Downloading? Installing? Building?
- # 21:30 <bracki> intgr: responding and then downloading
- # 21:30 <intgr> Well you should try another hirror anyway
- # 21:45 <bracki> Hm --use-mirrors seems to gazillion http connections to random 4 letter abcd.pypi.python.org. Is that intentional?
- # 21:45 <fission6> hmm i am dynamically resizing a profile image, how can i avoid the original image being cached
- # 21:45 <tanto> strange problem, in the admin i'm editing some data for an entry and when i hit save, django saves it, but then i get "bad request" "Your browser sent a request that this server could not understand." in the browser. it looks to be after the save sends a 302 redirect back
- # 21:45 <tanto> in apache the error i see: request failed: error reading the headers
- # 21:45 <tanto> works fine when i bypass apache and do manage.py runserver
- # 21:45 <mrm2m> I don't get it: http://dpaste.org/jtQqy/ works fine, but http://dpaste.org/YEuKr/ works not. The "<h1> {{ c }} </h1>" is evaluated correctly, but "{% for c_s in c.competitior_set.all %}" seems to return an empty list.
- # 22:00 <girasquid> If a user fails a permissions check and gets sent to the login page, does anything get set in context to tell me which permission they failed on?
- # 22:00 <iiie> mrm2m: they look like they should be equivalent too me too. in the template what do you get for {{ c.competitior_set.all|length }} vs c.competitor_set.all().count() in the cli?
- # 22:00 <iiie> girasquid: no, unless it's changed while I wasn't looking it doesn't even tell them why they have a login form
- # 22:00 <girasquid> iiie: that's what it looked like, but I wanted to be sure - thanks =/
- # 22:00 <iiie> girasquid: so I'd set a message on the request
- # 22:00 <tanto> hmm i wonder if i'm having a weird character set issue. my database is in latin1 and django utf8
- # 22:00 <anuvrat> django 1.4, just wondering if wsgi.py file in django 1.4 can be used in place of passennger_wsgi.py file ... used in previous ver
- # 22:00 <mrm2m> iiie: 0 vs 7
- # 22:00 <mrm2m> iiie: So the length gives back 0 while count gives back 7
- # 22:00 <intgr> mrm2m: Note that |length calls len(x) which is different from x.count()
- # 22:00 <iiie> intgr, mrm2m: fair enough {{ c.competitor_set.all.count }}
- # 22:15 <iiie> mrm2m: found it
- # 22:15 <mrm2m> intgr: In this case the result is the same - no matter if I use .count() or len()
- # 22:15 <intgr> But they should generally give you the same result if it's a QuerySet
- # 22:15 <intgr> Yes
- # 22:15 <v0lksman> having a bit of a brain fart...can someone point me: regex to match 'word #: 1000' OR 'word ID: 1000'
- # 22:15 <iiie> mrm2m: c.competitior_set.all vs c.competitor_set.all
- # 22:15 <v0lksman> for some reason my brain is stuck on [#|ID]
- # 22:15 <mrm2m> doh!
- # 22:15 <intgr> v0lksman: (#|ID)
- # 22:15 <intgr> v0lksman: [] is for matching single characters, () is for subexpressions
- # 22:15 <v0lksman> intgr: that will also place it in a capture group right?
- # 22:15 <mrm2m> iiie: Thanks so much. I'd have searched for ever.
- # 22:15 <intgr> Yeah, you can use (?:#|ID) to prevent that
- # 22:15 <v0lksman> intgr: awesome!!!! thanks!!!!
- # 22:15 <iiie> mrm2m: no worries, I do that too sometimes
- # 22:15 <intgr> iiie: lol
- # 22:15 <intgr> I spent an hour today debugging why {{ block.super }} didn't appear. Turns out I had a broken {%url%} in the parent block, but the templater hides all the exceptions.
- # 22:15 <intgr> I wish the template engine was more strict
- # 22:15 <iiie> intgr: you saying you don't want the silent failure option on callables and objects? (I suspect we could write a {% strict %} block template tag that would be loud with exceptions for it's render
- # 22:15 <dsarmientos> Hello. I am translating a django site. The strings I mark for translation in the template are translated just fine, but if I try to mark a string in a view (that will be shown using the messages framework) it does not get translated. I am using ugettext_lazy to mark the s tring. Is there anything else I have to do?
- # 22:15 <intgr> iiie: Well for one I find it inconsistent that {%url%} is strict and breaks everything if you get the args wrong, but {{}} wipes everything under a rug.
- # 22:15 <m0no> I am getting some weird error doing syncdb - django.db.utils.DatabaseError: relation "taggit_taggeditem" does not exist however I have never even installed taggit
- # 22:15 <iiie> intgr: there is a work around for url to make it work like {{}} {% url ... as my_url %}{{ my_url }}
- # 22:15 <gcbirzan> It's very unpythonic to hide exceptions to begin with.
- # 22:15 <intgr> iiie: Well your solutions would only work when I know what the problem is.
- # 22:15 <intgr> But it tends to bite me where I least expect it.
- # 22:15 <jeffheard> Okay, so I passed 5 dictionaries to "initial" in a modelformset. These are initial data I intend to use to create new model instances / rows in the database. There are NO rows in the database now. I get 0 foms printed on my page is this correct behavior?
- # 22:15 <iiie> intgr: correct. I use it for url fallback (I'd like to use some view if it has a url, otherwise use another one)
- # 22:15 <intgr> But it's just a pet peeve of mine :)
- # 22:15 <jeffheard> I was using a plain formset and it was working fine, but then I realized that i was just saving the results off, so I put a model in the backend
- # 22:15 <jeffheard> and called modelformset_factory instead of formset_factory
- # 22:15 <iiie> m0no: can we get a dpaste of the exception. my expectation is that one of your packages depends on taggit
- # 22:15 <glosoli> if I make folder which contains 2 apps, how do I import them in INSTALLED_APPS ?
- # 22:15 <glosoli> do I need that folder to have __init__.py and just do like folder.myapp1 and folder.myapp2
- # 22:15 <glosoli> ?
- # 22:15 <iiie> glosoli: 'folder.app1', 'folder.app2' yes for __init__.py
- # 22:30 <iiie> glosoli: if you want to get fancy you can just have app1 and app2, but put folder as part of the python path...
- # 22:30 <glosoli> iiie: thanks once again of a hundred times :D
- # 22:30 <glosoli> well being fancy is now what I am aimed to ;D
- # 22:30 <glosoli> is not"
- # 22:30 <m0no> iiie: http://dpaste.org/z6nud/
- # 22:30 <iiie> glosoli: I recently started writing .pth files to add directories to my python path. I like it better than symlinking, but I wouldn't start there :)
- # 22:30 <glosoli> iiie: .pth files are included in app dir ?
- # 22:30 <glosoli> or how they work ?
- # 22:30 <iiie> glosoli: no, idle of what I've done recently on the similar topic
- # 22:30 <easytiger> if i have multiple databases.. what's the best way to get a raw list of the tablenames of database_1 ?
- # 22:30 <m0no> iiie: wouldnt taggit appear in django_content_type
- # 22:30 <gcbirzan> Is there a way to get the actual DB exception?
- # 22:30 <iiie> m0no: yes it's models would be in content type, if it was ever in INSTALLED_APPS for a syncdb
- # 22:30 <gcbirzan> Or, rather, why isn't there a way to get the actual exception raised by the DB backend :(
- # 22:30 <m0no> iiie: there is nothing in content type
- # 22:30 <iiie> m0no: right, it's more or less saying that it can find the taggit python files, but that it isn't in installed_apps in settings.py
- # 22:30 <m0no> iiie: but why is it even looking if taggit isnt in installed apps or django_content_type table
- # 22:30 <iiie> m0no: one of your models has the tag field in it, but taggit needs to be in the installed_apps list in settings.py
- # 22:30 <m0no> iiie: ok I see
- # 22:30 <iiie> m0no: there are a few hand wavy fields out there that do more in terms of database access, tagging tends to be one of them. I certainly wish it could catch that exception and wrap it with text about the fix
- # 22:30 <dsarmientos> Do I have to load i18n in a template in order to show translated strings (marked in the view.py file)?
- # 22:30 <Ronnie> im trying to set some cache headers, but somehow it fails. Part of my code: http://paste.ubuntu.com/978658/ (the log outputs 'HTTP_CACHE_CONTROL': 'max-age=0', and firebug also shows the same). What did i forget?
- # 22:45 <iiie> Ronnie: are you running with runserver? if not you probably have to reload the code
- # 22:45 <Ronnie> iiie: running apache with mod_wsgi and i have restarted apache after changing the code
- # 22:45 <iiie> Ronnie: right, log, is inside the view and showing request not response, the decorator will be outside, I'd ignore the log, but firebug showing the same for the response says something is not right
- # 22:45 <dekuked> hey, can someone help me figure out how to get filebrowser grappelli working on a deployed server?
- # 22:45 <dekuked> http://i.imgur.com/nUci2.png
- # 22:45 <dekuked> is what it looks like
- # 22:45 <dekuked> instead of having the "Upload File" button like it does locally
- # 22:45 <dekuked> http://i.imgur.com/crTsU.png
- # 22:45 <dekuked> the html rendered is the same though
- # 22:45 <dekuked> so I have no clue how the hell to fix it
- # 22:45 <iiie> dekuked: was going to say "I don't use it my self, but does it's directory exist?" but now I wonder if you've collected static on the deployed server (obviously some of it has made it's way to the right places)
- # 23:00 <logabr> hi guys i am having a strange issue where hardcoded urls to pages in my site don't actually go to the url where the anchor tag points. i'm just trying to set up navigation and when i type in the urls they work fine, but the links do not. any advice here? i am using mod_fcgid
- # 23:00 <endzyme> Is there any way to build the form variables in django a little more dynamically? Example: http://pastie.org/private/rxqx2ltqeleznuxd6t48xa
- # 23:00 <silent1mezzo> logabr: we need more details, use dpaste to show us your urls.py, views.py and templates
- # 23:00 <logabr> the hardcoded links get forced down one directly, like if the anchor tag points to http://www.mysite.com/site/about the page that opens when i click it is http://www.mysite.com/about
- # 23:00 <logabr> directory i mean
- # 23:15 <lulzplzkthx> Hey guys, I was wondering whether it's valid to call "self.delete()" within a model's function.
- # 23:15 <logabr> urls.py is here: http://dpaste.com/745720 views.py here: http://dpaste.com/745721 templates all extend this base.html: http://dpaste.com/745727
- # 23:15 <logabr> the thing is if i go directly to the url in question the page loads
- # 23:15 <logabr> but if i click on one of the hardcoded links it will go to the wrong place, even though the anchor tag says it should go there
- # 23:15 <logabr> i'm guessing its something with .htaccess or the fgci file
- # 23:15 <greylurk> What are the values for "change" that get passed to a "save_model" function on a ModelAdmin?
- # 23:15 <greylurk> Is it 0 for add, and 1 for update?
- # 23:15 <SmileyChris> greylurk: False, True
- # 23:15 <greylurk> So, False for create, True for Update?
- # 23:15 <SmileyChris> logabr: firstly, you shouldn't have any hardcoded links. Secondly, your url patterns should end in '$' unless they are includes
- # 23:15 <SmileyChris> logabr: can't see how the behaviour would be different between entering the url manually and clicking a hyperlink to the same url though
- # 23:30 <ikirudennis> Hi. I'm trying to create a form that has multiple email address inputs with a separate widget for each input. I've read through the documentation for forms and formsets, but I'm still unsure of how to proceed. Would it be better utilize formsets? Can the MultiValueField (and presumably MultiWidget) be leveraged to do this?
- # 23:30 <crazydiamond> Hi. How do I change field's data, that is outputted in the table when looking list of elements?
- # 23:30 <crazydiamond> e.g. I need ImagField to display not filenames, but images
- # 23:30 <apollo13> which table etc be more precise
- # 23:30 <nkuttler> crazydiamond: in the admin?
- # 23:30 <crazydiamond> yes
- # 23:30 <apollo13> use a custom list_display method as described in the admin docs
- # 23:30 <crazydiamond> oh, yeah :) but wanted to change default behavior of the field
- # 23:30 <crazydiamond> e.g. let field provide "<img ...>"
- # 23:30 <nkuttler> what apollo13 just said
- # 23:30 <crazydiamond> is it method of Field also? (not only of ModelAdmin?)
- # 23:45 <apollo13> most likely not
- # 23:45 <crazydiamond> I can't grep it in Django's db module
- # 23:45 <crazydiamond> so it isn't
- # 23:45 <nkuttler> field as in form field? you can use a custom widget
- # 23:45 <crazydiamond> in list_display
- # 23:45 <bluepnume> Hi -- I'm having a problem with CSRF (that old chestnut) only on iphones in "private browsing" mode
- # 23:45 <bluepnume> Is there any info / fixes for this?
- # 23:45 <apollo13> lol
- # 23:45 <apollo13> does private browsing reject cookies?
- # 23:45 <nkuttler> afaik it throws all cookies away after the session
- # 23:45 <bluepnume> Yeah nkuttler that's my understanding too
- # 23:45 <bluepnume> haha, yeah I wish I could just tell that to our users
- # 23:45 <bradleyayers> morning
- # 23:45 <nkuttler> bluepnume: the problem is only on iOS? not safari?
- # 23:45 <apollo13> telling them to get a proper phone is another option^^
- # 23:45 <nkuttler> hush
- # 23:45 <apollo13> mit be some referer thingy though, are you over https?
- # 23:45 <nkuttler> where's this private mode hidden anyway? can't find it
- # 23:45 <bluepnume> nkuttler: just tried safari in private mode, works fine
- # 23:45 <bluepnume> apollo13: not using https
- # 23:45 <apollo13> then try https
- # 23:45 <apollo13> might be the fix you want
- # 23:45 <SmileyChris> from memory, csrf only uses referrer if you *are* using https
- # 23:45 <dekuked> s
- # 23:45 <dekuked> ls
- # 23:45 <dekuked> dang it
- # 23:45 <nkuttler> bluepnume: you might also want to look into remote debugging for iOS safari
- # 23:45 <apollo13> SmileyChris: indeed ;)
- # 23:45 <apollo13> I think it would be easier to throw gdb at it and set a breakpoint
- # 23:45 <nkuttler> oh wow i have to go through the settings app to enable that..
- # 23:45 <nkuttler> btw, i just logged into the django admin in private mode. doesn't that require working CSRF?
- # 23:45 <apollo13> it does yes
- # 23:45 <apollo13> at least all post views are manually decorated there afaik
- # 23:45 <nkuttler> yeah, the login form has the csrf token
- # 23:45 <apollo13> so off to compare ios versions ;)
- # 23:45 <nkuttler> latest for me of course. and i can edit stuff in the admin. worksforme
← next day
previous day →