|
Thank you Wulfeh - you understood perfectly what I was going for in every instance. The next step is deploying it to my hosting provider
|
# ? May 23, 2008 14:29 |
|
|
# ? May 30, 2024 12:37 |
|
For getting plurality right, django offers the pluralize template tag
|
# ? May 23, 2008 15:46 |
|
Is there a reason that development on Django-rest-interface appears dead? I'm looking at using Django for a new project that pulls data in from two databases and creates new data in a third. However multi-database support is still in development, lma0, and it's not clear whether MySQL's fruity cross-database feature works. Another project I have running uses PHP and it was easy working with the developer to get Pear:ata_Object to support MySQL multi-database syntax, committed into trunk a long while ago. The alternative is to setup some form of web services, e.g. REST on the two external databases and using that hidden behind Django Models. However this seems to be a very under-developed technology for Django, what gives?
|
# ? May 23, 2008 16:14 |
|
Honestly REST has no place in Django, it is by far the worst feature ever added to Rails... what is the point of it, it's huge, it's obtrusive to coding anything, it offers negligible benefit to users. In fact it's worse for users if it is implemented incorrectly as it was initially with Rails, with the funky semicolons in the URL. Is there any reason at all that we would need REST in Django? I understand you don't have to use REST in Rails but when you don't, you cannot use a lot of the new or upcoming features. It's like development in RESTless rails just stopped dead after the idea popped up and it's unnecessary.
|
# ? May 24, 2008 01:33 |
|
okay, I admit defeat again. I'm going to try an abstract explanation of my database search problem. my database is full of entries like this: a1b2c3d4e5 code:
Is it possible to instruct django's database api to be greedy and return (a1b2c3d4e5) from my query(abcde)? Now let me complicate things - my search query is unicode, my data is unicode. I have 12 unicode characters I want the search to ignore. Is it possible to .split() "query" and use wildcards to make the match? Or should I consider .strip()-ing all 12 characters and maintain another database?
|
# ? May 24, 2008 18:48 |
|
This query will probably be pretty slow but what you can do is:code:
|
# ? May 24, 2008 19:00 |
|
Wouldn't you want to and_ them together in that case?
|
# ? May 24, 2008 19:09 |
|
I'm getting "reduce() of empty sequence with no initial value" also, preferably it'll be doing this across 27 fields from 5000 rows... what about this from djangobook appendix C: http://www.djangobook.com/en/1.0/appendixC/ quote:search
|
# ? May 24, 2008 19:26 |
|
Yeah, that's cause reduce will fail if it gets an empty sequence with no initial value. In your case that happens when query == ''. I think you could pass a third argument, Q() to that reduce to avoid getting that error on an empty string, but I'm not really sure. However, I think anding the Q objects together won't work like expected because that just checks that the field contains all those letters. It doesn't check their order or how many of them there are. I think you might be able to achieve what you want by using the iregex field lookup and specify the regex so that it ignores the characters you want.
|
# ? May 24, 2008 19:43 |
|
I got a interesting one for you all. We have been tasked with creating a new site that has some interesting properties. I could use some help since I'm still starting with Django. The idea is to create a 'reference' site that implements all the features we need. This part I can do. I create a project with an application called super. This all works fine. Here's the interesting part. I need to create an unlimited number of subsites. The subsites use the same models / db. The subsites will differ mostly in images and css, but sometimes they will need to modify the templates as well. So the idea is that the subsites will use the super site's implementation, templates and views UNLESS the subsite defines it's own, then those should be used. I'd like to do this without copying anything over and over again so if changes need to be made, they only need to be made in one place. My idea was to have the views in the reference site load templates based on a setting. The subsites would override this setting to their individual template dirs, but would check for the existence of a template and if one isn't found, use the reference template. Am I right that I can have the subsites inherit the views from the supersite and then just override any methods that it wants to implement? How would I do this for the site_media stuff? Images / css should be loaded from the subsite specific folders unless they don't exist, then they should load from the supersite...is that possible?
|
# ? May 25, 2008 01:37 |
|
As some of you may know, Django Dash(http://www.djangodash.com/) will be occuring next weekend, and registration ends today. Is there anyone who would be interested in working on something with me. I have no idea for a project(or at least no original ones :P). If you are interested either let me know here, or message me in the #django channel on freenode IRC(my name is the only one that starts with Alex_ in the channel).
|
# ? May 25, 2008 01:47 |
|
I am hoping I can find some help, currently I am trying to build a page which will create a new object, save it to the database and redirect me to the new object. The object being created spans over two tables, this is the first time I've done this so I want to be sure I'm doing it correctly before I continue doing it wrong for the rest of the project. The object is named Conversation and it is basically a thread topic with first post. CommentContainer is the post, Comment is going to contain previous edits but I'm not concerned about it too much right now. EDIT: I've updated my code into working status. urls.py code:
code:
code:
code:
It seems I was being a little bit greedy and that Generic views don't really do what I wanted, in that the view needed to save two models at once. If I could get it any shorter at all that would be great, In Rails I can fit it into about 5 or 10 lines of code which is why it feels like I'm not doing this right. If I refresh the page after I've posted Firefox asks me if I want to resend the data, I don't want it to give me the opportunity to do this. Nolgthorn fucked around with this message at 11:52 on May 27, 2008 |
# ? May 25, 2008 23:38 |
|
How in the hell do you people handle dynamic menus? I just want a simple submenu on my sections, but have no idea how to go about pulling the relevant subsections (which could be flatpages or not). Flatpages I can get because I gave them a section property, but regular urls/views I have no idea how to specify their parents/pull them out. Without data duplication anyways.
|
# ? May 28, 2008 15:24 |
|
James Bennett has apparently just finished up some of the final edits on his upcoming Django book, "Practical Django Projects". You may recognize him from some online sites as ubernostrum, but he's one of the higher profile Django devs and an all-around pretty bright guy. I'm sure his book will be very good, and for anyone looking to get started in the next few months it sounds like this may be a good book to have on the shelf.
|
# ? May 29, 2008 04:04 |
|
No Safe Word posted:James Bennett has apparently just finished up some of the final edits on his upcoming Django book, "Practical Django Projects". You may recognize him from some online sites as ubernostrum, but he's one of the higher profile Django devs and an all-around pretty bright guy. I'm sure his book will be very good, and for anyone looking to get started in the next few months it sounds like this may be a good book to have on the shelf. But this other book says I could most assuredly learn Django in 24 hours. So what's James Bennett going to do about that?
|
# ? May 29, 2008 05:16 |
|
James' book is, in my understanding, exactly what the title implies - a look at developing some practical sample applications. I don't think he's going for the "learn Django just by reading my book", which is what the official book, the Sams (lol) book, or my book (http://www.amazon.com/dp/0132356139/) would be good for. Looking forward to James' book, though, he's a very smart cookie and he and I pretty much tag-teamed the IRC channel back in the day in terms of fielding questions. He's also been the official Django release manager for, what, a year now? so he's practically part of the core team.
|
# ? May 29, 2008 15:08 |
|
Neato, is a developers library more or less what you find on the Django web site? I'm curious.
|
# ? May 29, 2008 18:12 |
|
Nolgthorn posted:Neato, is a developers library more or less what you find on the Django web site? I'm curious. If you mean the "Developer's Library" on the cover image of my book, naw, it's just the "line" or series of Addison-Wesley books it's being published in (sorta like how O'Reilly has the In A Nutshell series). The book I'm writing (with two other guys, so it's really "our" book, not "my" book ) is sort of a generalist book...it's got wide coverage of the framework's features, both basics and contrib apps (so it functions as a general howto like the official Django docs/book); it's got four example application chapters (probably similar, but smaller, than James'); it's also got an intro chapter on Python for Python newbies, and overall tries to keep a focus on practical development practices, something none of the other books really have (except James' by virtue of the example-app focus). /self-promotion
|
# ? May 29, 2008 19:47 |
|
Has anyone seen a clever way to store revisions or changes to data? (That wasn't a great way to explain it. Basically a have a set of models but, I want to be able to go back and explore the past versions and easily identify the differences between the older version and the current version) I have a couple of ideas kicking around in my head but, I don't want to reinvent the wheel if someone has already found a clever way to do it.
|
# ? May 30, 2008 23:18 |
|
Yeah, ummm, do you mean like version control? Like mercurial, git, svn, etc.
|
# ? May 30, 2008 23:31 |
|
Checkout django-wikiapp it keep revisions for all the articles, theres also django-rcsfield.
|
# ? May 30, 2008 23:32 |
|
Checkout django-wikiapp it keep revisions for all the articles, theres also django-rcsfield.
|
# ? May 30, 2008 23:32 |
|
Checkout django-wikiapp it keep revisions for all the articles, theres also django-rcsfield.
|
# ? May 30, 2008 23:32 |
|
Bonus posted:Yeah, ummm, do you mean like version control? Like mercurial, git, svn, etc. The triple post below you got it right... BTW, how the gently caress do you triple post!
|
# ? May 30, 2008 23:34 |
|
Ooh, you mean like revisions are stored in wiki pages, kind of like that? Ah, I don't know, but it seems like the cool triple post nailed it. lol
|
# ? May 30, 2008 23:36 |
|
Bonus posted:Ooh, you mean like revisions are stored in wiki pages, kind of like that? Ah, I don't know, but it seems like the cool triple post nailed it. lol Yeah djnago rcs looks pretty cool actually. It looks fairly beta though. I want to take a peak under the hood to see how hacky it is.
|
# ? May 30, 2008 23:38 |
|
Not sure if this has been answered but I can't search, so here goes. This documentation talks about how to get the person and city of a given book, but what is the best way to get a list of books, their associated author, and any other city information in the model given a city id? I could probably figure out the SQL, but what's the Django way?
|
# ? May 31, 2008 02:41 |
|
Are you asking whether select_related() will pull things down across reverse foreign keys? As far as I know, not having checked the source, it wouldn't (but I'm not an expert in this area) - it would probably only follow 'forward' relationships. So in the setup given in that documentation, City.objects.all().select_related() wouldn't pull in all the Persons and Books. Should be pretty easy to figure out if this is the case, though, by doing from django import db and then printing out db.queries (I think that's the right name) at different points, before/during/after running some queries. Just did some Googling and found at least one Django-users post implying that it does not follow reverse relations at this point in time; the post was from mid April, though, so it's possible the queryset-refactor merge has changed things.
|
# ? May 31, 2008 03:49 |
|
Correct, select_related() only goes forward at present, there was some discussion a while ago about having it work backwards as well, and malcolm said he would probably look at it, and that it was doable.
|
# ? May 31, 2008 05:39 |
|
Correct, select_related() only goes forward at present, there was some discussion a while ago about having it work backwards as well, and malcolm said he would probably look at it, and that it was doable.
|
# ? May 31, 2008 05:39 |
|
That's what I figured. So how would you get that information? Straight up SQL query?
|
# ? May 31, 2008 06:00 |
|
You can still do backwards relations: http://www.djangoproject.com/documentation/db-api/#backward you just can't use select_related to prefect them
|
# ? May 31, 2008 07:39 |
|
Is there any good reason why I shouldn't customize a set of Users by creating them as instances of a subclass of django.contrib.auth.models.User? I can't see why it wouldn't, but the official book doesn't even suggest it as an idea, and further suggests that to create Users with a profile you should create a new model for the profile with the user id as a foreign key.
|
# ? May 31, 2008 22:36 |
|
Because then you don't get to use some the nifty features that contrib.auth offers, like messages and getting the user directly from request. The proper way to extend the User model is described here.
|
# ? May 31, 2008 22:45 |
|
Bonus posted:Because then you don't get to use some the nifty features that contrib.auth offers, like messages and getting the user directly from request. The proper way to extend the User model is described here. Excellent, thanks!
|
# ? May 31, 2008 22:51 |
|
I've Googled around, and can't find an answer -- is there any significant performance boost from using a SmallIntegerField in my models instead of an IntegerField? One of my models is going to have about 100 attributes, only a handful of which are going to be negative or possibly exceed 65,535. However, I'd rather not make my model less flexible unless I'm going to get something for it.
|
# ? Jun 1, 2008 01:32 |
|
Sock on a Fish posted:I've Googled around, and can't find an answer -- is there any significant performance boost from using a SmallIntegerField in my models instead of an IntegerField? One of my models is going to have about 100 attributes, only a handful of which are going to be negative or possibly exceed 65,535. However, I'd rather not make my model less flexible unless I'm going to get something for it. Performance? none. The advantage comes when you have millions (or even billions) and it nets you a slight storage improvement.
|
# ? Jun 1, 2008 04:40 |
|
ATLbeer posted:BTW, how the gently caress do you triple post! Its that drat robot again
|
# ? Jun 1, 2008 12:41 |
|
duck monster posted:Its that drat robot again He seems to be stuck in a negative incrementing loop. First triple post, then double post, now single post. I think he's broken now
|
# ? Jun 1, 2008 17:28 |
|
|
# ? May 30, 2024 12:37 |
|
Does anyone know anything about the ImageField that they tossed into the trunk version of Django? I can't find much documentation on it. I need to make sure the image a user uploads isn't some 100mb monstrosity and I can't really find anything on Google that helps me out. Anyone have any ideas? edit: well, here are the two models I came up with. I think someone can still attack me just by virtue of uploading a huge image, though. code:
ashgromnies fucked around with this message at 19:47 on Jun 2, 2008 |
# ? Jun 2, 2008 18:53 |