|
============================================================ Experienced Django programmers click here and skip the basic tutorial below ============================================================ So what is Django?
I'll quote Jacob Kaplan-Moss here, one of the creators of Django to answer that --------------------------------------------------------------------------------------------------------------------- Ok.. Enough fluffing... Lets get to the links. If you don't want to read the rest of the thread and just want to start coding here are your links. Django Website - http://www.djangoproject.com/ Django Download - http://www.djangoproject.com/download/ Django Install - http://www.djangoproject.com/documentation/install/ Django Book (best starting guide) - http://www.djangobook.com/en/1.0/ Reference Materials (always have these in an open window when your starting) - Django Model Refernce - http://www.djangoproject.com/documentation/model-api/ - Django DB API - http://www.djangoproject.com/documentation/db-api/ --------------------------------------------------------------------------------------------------------------------- I'm going to teach you the power of Django and show you how to write a quick piece of blog software at the same time First off. This thread is not about Python. Sorry. If you need to learn Python I highly recommend Dive Into Python a free web based book that will easily give you enough information to start programming in Django. Second off. This thread isn't a primer or a teaching thread about MVC designs. Hopefully you at least already know what it is and why you should be using them. If you are still writing raw SQL code, that looks like SELECT * FROM articles WHERE ID=$_GET['article_id'] in a PHP file that also contains HTML code then you have some reading to do outside this thread. Your welcome to stay and follow along but, you may get lost along the way. If you post questions surrounding a topic like this please don't be shocked when people either: don't respond to you, mock you mercilessly, or just give you links and don't answer your question. Thirdly. I'm gonna dump you off the the Django Installation instructions (Recommended install instructions for Windows Users). Sorry.. I don't really need to rehash everything thats included in the links. I (and other people in this thread) will be glad to help you out in getting the framework installed and running. So you have a functioning and running version of Django up.. Good 1) Lets create a project code:
code:
So lets make sure you configured Django correctly. In the command lets type the following and you should see the following code:
Now lets do what it says. We need to configure Django to use a DB to actually do really useful things. Let's open settings.py and look at the DATABASE_* information. I'm going to use SQLite just for ease of use here but, your welcome to use whatever RDBMS you wish. Django supports postgre, mysql, sqlite3, oracle, and maybe MSSQL soon (I know it was in discussion). Here's what my settings.py looks like now (just the DATABASE_* section) code:
Scroll down a bit in the settings.py file and we'll find the section called "INSTALLED_APPS". We are going to add the folowing line to that tuple: django.contrib.admin to make our INSTALLED_APPS look like the following code:
We need to now sync the database that we told Django about (Django won't create the DB so create it if you haven't already) At the command line code:
code:
code:
code:
code:
http://127.0.0.1:8000/admin Pretty huh... Go ahead and log in with the superuser that you told Django about earlier. Go ahead and poke around and come back when you smiling. If you've developed a web application before you'll soon understand just how drat cool this backend really is in a bit. OK.. So I have a admin screen. Lets actually do something here. Remember when we first started we typed in django-admin.py startapp main? That's an application and our Django project (blog) needs to be told that the application 'main' exists. We do that simply in the settings.py file in the INSTALLED_APP tuple that we added 'django.contrib.admin' to earlier. So lets open settings.py again and add 'main' to the tuple code:
quote:NOTE: MY EXAMPLE USES DEPRECATED CODE READ BELOW Now lets define our data here for our blog. In models.py I'm going to add the following. code:
We have a real simple data model but, I want to wow you before we get into the nitty gritty here so go back to the command line and lets update our database with our new fancy model! (we're going to run python manage.py syncdb again) code:
Click on the humorously named "Categorys". See this? A pre-built CRUD interface. For any type of model that we define. You have a semi-yet? Ok.. It's not quite that cool but, it's gonna be. I promise. First lets fix that stupid "Categorys" things. Django will automatically pluralized all your model names but, doesn't quite work well with 'y' to - 'ie' yet but, we can fix that. Open up models.py again and add the following line to make your models.py looks the same as mine code:
If you haven't already go ahead and create a Category in the admin interface. Heck create 2. We're going to take a quick dive into the python shell and talk about the DB API before we create a more complex model. (You've created 2 categories by now I hope) Let's open the python shell a bit differently than normally here since we want to make sure we get all the needed Django bits. At the command line we are going to type in "python manage.py shell". A normal python shell has popped up but, it has some namespace stuff preloaded in it for our convenience. (Side note.. My copy and pastes are going to look a bit different here since I'm using the iPython interactive shell. I'm note going to use any commands that aren't included in the basic shell.. It just looks different.. Imagine the In[1] is actually >>> and it'll be normal again) In the shell the first thing we want to do is load up the model that we just defined code:
There's a lot of stuff in the Category class that Django put there for us but, most of the time we are going to use the 'objects' part. It has all sorts of real cool functionality. Lets get all of our Categories. code:
code:
Let's play with this object real quick. code:
code:
code:
code:
code:
Now.. All you PHP programmers. I just defined a data structure. Created an admin interface. Managed a list of objects. Altered an object. Created a new object. All without really writing one line of complex code or one smidgin or SQL. You should have a semi-by now. If you don't then your probably a girl and your nipples should be hard then... Lets go define our second model for our blog here. Go back to models.py and we're going to make one quick addition first before defining the new model. We want to able to tell what user wrote what post but, we need to first load the user model into the scope we're working in. Like I mentioned a while back Django won't do some things because it doesn't want to be overbearing and just be everywhere all the time. It's actually quite polite like that. We're going to add the following line to the top of the models.py file code:
code:
code:
Yeah... I guess we're used to this by now. Make a model and sync the DB and wow.. It show up here. Well click into Blog Posts and go create a new one Thats pretty cool right? You start typing in the Title field and the slug gets pre-built. Choose your category pre-populated from a drop down. Choose your author from a pre-populated drop down. Push save! Blog post... All your did was define the data models. Imagine how much time you had spent building back ends to your data models before. Lets create one or two posts here so we have some data. Place them in different categories so there's some differentiation. Lets go back into the Python shell and play for a bit ($ python manage.py shell) We need to load the models that we defined first off code:
code:
[3] We are loading all of the objects in BlogPost into the variable all_posts (this is a list) (it's a list of BlogPost objects) [4] We are taking the first object (index 0) from all_posts and putting it into one_post [5] We can see that the one_post variable is a BlogPost object [6] one_post.Category is a Category object instance (that foreign key reference in the model description) [7] one_post.Category.Name... we can go right into that object and get any attribute we want. This is a very powerful feature. Name was defined in the Category model [8] In the same way we can go into the foreign object Category we can go into the Foreign User object here too [9] Same thing... we can access all the attributes of the foreign related object Let's change the category that the BlogPost one_post lives in. Walking through the code here, we are going to get a new category (BEEES!) and assign it to Category attribute of one_post and save it. code:
We've been able to get all the blog posts with the objects.all() method but, what if we just wanted the posts in the category "bees" that would be useful for our software code:
[18] lets assign a_category to the objects in the all_categories list with the index 2 (which is the beess!! category) [19] just make sure I got that right [20] assign posts_in_category all the posts in 'a_category' using the objects.filter method. --- We are telling BlogPost to find all posts in which the Category is the same as 'a_category' [21] print out posts_in_category Now Python loves lists... Even lists of objects and we can use a for loop to interate through all these. code:
Lets hop back to the Admin interface real quick and look at the list of BlogPost objects. That's not very helpful. Just listing the name there. We have a lot of information in the model but, it's only displaying the name. Well, like I've said before. Django is will only do what you tell it to. How do we get more information here? Lets go back to the models.py and to the BlogPost Model code:
code:
Check out the filters... Especially the date filters. I love that... Ok.. We have all of this but, we still don't have a webpage.. Lets get started on that. This is where we start getting to the meat of a web app. For people who already know Django, I'm skipping generic views here for teaching sake.. Yeah. I know we should use them but, they can be confusing when your first learning. Let's make a really stupid 3 HTML page website. Django's view system and template system can do MUCH MUCH more but, we just want HTML output for right now and this is a really fast way. I HIGHLY recommend you now add basic Django view and urls.py documentation and the Django template reference to your ever growing reading list. Don't worry.. You won't use everything in there at first but, it's good to have a mile-high view before diving in. I'm going use this ridiculously simple HTML example as a basic template for my front page code:
This file is going to be created in our blog project root in a new directory called templates and be called front page code:
This following topic is a bit like skinning a cat. I've never heard anyone tell me, this is the proper way to do this. It's listed as one of the methods in the official documentation and it's the method that I find most flexible but, it's certainly not the only way. Also note that you don't even need to use the built in template system. Just import your own in and use that. Django doesn't care. But, caveat empor..This is my personal method and may not be for everyone. First lets open up urls.py and add a line to make our front page code:
Open up main/views.py and define the front_page view code:
First we need to import the objects that we need. We're going to add these lines to the top of our views.py file code:
Lets take care of that HttpResponse error that Django is still yelling about. We're going to make the function front_page return a HttpResponse object. Here is my views.py file now code:
We want to load the HTML file that we created before as a template so we need to tell Django where to find our templates (remember that subdiectory we created). So open up settings.py and scroll down to TEMPLATE_DIRS. You must use absolute directories and remember when you deploy your app to change this. I've forgotten that a few times and it's a little detail that is easy to overlook. Here's what the TEMPLATE_DIRS portion of my settings.py looks like code:
code:
code:
So the template is now getting feed the categories we need to replace them so they show up. Lets open back up frontpage.html. This is where pre-reading the Django Template Reference is going to come in handy Remember.. the 'all_categories' variable we are passing the template is a list of objects just like in the DB API (remember that for loop?). We can reference that objects in the same way (pretty much, in most cases) in the template engine. So in the HTML code I can say a_category.Name and it prints the name or a_category.id and prints the ID. I can also use the same for loop and loop through the list. So here's my modified frontpage.html now code:
Now we want to print the last 5 posts on the front page (we are going to skip pagination since I'm tired at this point... But, this is just a simple example and I'm running into the 50,000 character limit on a single post... oh god I've written too much) Back into views.py I'm going to load 5 blog posts. code:
code:
Some of the more powerful simple features of Django. Let's quickly go through the next two pages, since hopefully you've caught on here. I'm only going to stop to explain new things from now on The Category page. Alter urls.py to add the line code:
code:
code:
code:
code:
code:
It's a very powerful, and very open framework. You can mostly pull out any component and replace it with whatever you want. ATLbeer fucked around with this message at 23:39 on Mar 7, 2008 |
# ¿ Mar 5, 2008 23:18 |
|
|
# ¿ Apr 29, 2024 11:05 |
|
Official Django Resources:
Blogs about Django Development:
Django Powered Websites:
Django Modules:
ATLbeer fucked around with this message at 02:40 on Mar 6, 2008 |
# ¿ Mar 5, 2008 23:18 |
|
Git posted:That's one hell of an OP. I'll kick off the stupid questions: Like mentioned in the OP... There's a dozen different ways to render out in Django. Or just use an entirely different render engine entirely... So far I've seen - My method of loading the template, loading a context object, using template.render to parse and return to HttpResponse - render_to_response passing in the template and a tuple of objects - the RequestContext handler passing the request, a tuple of objects, and then use the template.render again Honestly.. It doesn't really matter. The variables all get passed to the template in the same manner. I went through all the manners and even though my method is MUCH MUCH more verbose than render_to_response I prefer it merely because it is verbose. I can easily understand the code mostly because I'm a visual person and I tab out my tuples to line them up vertically for easy visual reference. Any way is OK and I have not heard of a "best practices" method around the topic.
|
# ¿ Mar 5, 2008 23:48 |
|
king_kilr posted:A note about the OP, you define __str__ in your models, however when you query the db using the api it's attributes are unicode, which I believe means you are using svn, and therefore you should have defined __unicode__ instead, let me know if I'm wrong, either way: yay django, and use trunk Yes.. I screwed up.. Old habits die hard. I literally typed this up in a hurry during a 2 hour lull at work. You are correct. The SVN trunk defines it as __unicode__ I'll edit it to reflect that. genericadmin posted:I'm going to laugh if it has to do with the jazz guitarist Django. I forget his full name.
|
# ¿ Mar 6, 2008 01:06 |
|
ashgromnies posted:This post makes me want to learn Django... anyone know of a good cheap webhost that supports using it? I know MediaTemple has a beta up - http://www.mediatemple.net/labs/grid/gc-django-beta.htm The Django website has a decent list as well - http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts
|
# ¿ Mar 7, 2008 19:20 |
|
No Safe Word posted:If it was just the text in white I'd totally buy it I'm going to be at PyCon next week. If I run into any of the Django guys I'll mention it because I want a shirt that looks decent too.
|
# ¿ Mar 7, 2008 23:25 |
|
king_kilr posted:See you there! Are you sprinting? No.. I'm doing SXSW the first part of the week so I can't take a full 2 weeks off work. Although if anyone has a sprint that is just sickly amazing and I have to, I can probably get permission to stay in the frigid north for a bit more but, it's very unlikely.
|
# ¿ Mar 7, 2008 23:36 |
|
ashgromnies posted:
Yeah.. Thats a knock for Django right now. Especially during rapidly changing developments. It's hard to alter schemas quickly and efficiently. It's currently an open issue in the dev group of the Django Project - http://code.djangoproject.com/wiki/SchemaEvolution There also is some community code contribution that helps this out a bit as well - http://code.google.com/p/django-evolution/
|
# ¿ Mar 11, 2008 20:23 |
|
king_kilr posted:Take 50 out of quotes, I'm pretty sure it is try to do this int(str("50")). I dunno if you posted in the right thread or not but, I'm a bit confused at what your trying to do there "50" itself is a string. There's no reason to cast it into a string str("50") again. - "50" == str("50") == True To cast the string "50" into an integer (as you said 'Take 50 out of quotes') you would just int("50") the str part is redundant.
|
# ¿ Mar 12, 2008 19:02 |
|
http://code.google.com/appengine/ Django support out of the box It's the only framework supported http://code.google.com/appengine/articles/django.html Grr... Looks like the parts that are supported are only the request handling, and template engine side. No support for the Django ORM. Looks like there's already a problem on the Dev side about BigTable and the Django ORM mixing since BigTable has built in support for joining. ATLbeer fucked around with this message at 15:50 on Apr 8, 2008 |
# ¿ Apr 8, 2008 15:29 |
|
Figure I'd post this here first since I'm looking for people that would be reading this thread anyhow. Any Django programmers in the greater Atlanta area? I have a pile of programming work on my desk that is going to be impossible for me to do in this lifetime and I need some help doing the heavy lifting in the form of a contractor(s). I'm looking for Python Django (If you have good experience working in WebDev with other frameworks but, are learning Django thats fine too) HTML / CSS Experience Javascript / AJAX Experience a plus MySQL experience a necessity. We are doing very rapid application development for a big company. Not everything you do will see the light of day (public) and you WILL have to sign a NDA. This is a non-negotiable, sorry. Only get in contact with me if you understand what this means and are comfortable working with a NDA. You really have to be based in the ATL area. This can't be a telecommute thing, sorry (unless you live in a really cool exotic local and I can get my company to cover my T&E there... You better be a rockstar though ) (about 99% kidding there) GTech students. I know your probably the in the middle of your senior design work or exams. Don't worry, go ahead and shoot me an email and a resume (if you have one) as well. If your work is good enough and I can wait a bit for the semester to be over. atlbeer (at) gmail.com Things to include: - Resume - Current / previous websites with a short description of what your work for the site was, a bit about it's architecture - Open Source projects? - Have you written any Django or Python modules? Include some links. - Have you worked with other types datastores (BigTable, CouchDB, etc?) mention it - Have you had any work with Hadoop? mention it.
|
# ¿ Apr 23, 2008 18:25 |
|
duck monster posted:Oh hey my perfect Job. Django with posibility of working with "quirky" backends. (Hadoop & Couch.). So just humorously I checked to see what it would take to fly out to the underside of the world (never been there before ) From Atlanta the cheapest flight (business class ).. Atlanta -> Los Angeles (4hr 52m) (+2hr layover) Los Angeles -> Bangkok (17hr 30m) (+16hr layover) Bangkok -> Perth (6hr 15m) And the return trip Perth -> Phuket (6h 15m) Phuket -> Bangkok (1h 25) (+8hr layover) Bangkok -> New York (17h 30m) (I think that's actually an over the north pole flight, kick rear end) New York -> Atlanta (2h 41m) (+4 hr layover) NINETY HOURS OF TRAVEL... for only $9k USD... My rear end feels sore just thinking about that.. Although for $17kUSD I can fly on Thai Airways... Sorry man.. It's small planet with airplanes but, that's so far away.. Hahah.. If there's anyone else in this thread that's interested I'd send an email this weekend because Monday I'm going to post a SH/SC thread and start expanding my search options.
|
# ¿ Apr 25, 2008 18:13 |
|
Larry Horse posted:Yep, that's exactly how it looks. And it works! For example if you didn't know. You have a model already pre-built. Need a form for that model? ModelForm = form_from_model(SomeModel) ModelForm.as_ul() Poof..
|
# ¿ May 8, 2008 21:05 |
|
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 |
|
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 |
|
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 |
|
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 |
|
Just want to bump with the 1.0RC Roadmap and Timeline http://groups.google.com/group/django-developers/browse_thread/thread/5ce124e7526dad quote:This is a call for comments on the proposed Django 1.0 roadmap and schedule.
|
# ¿ Jun 12, 2008 23:13 |
|
StickBoy posted:I'm just learning Django. I love it so far. I have been a big fan of python for awhile but never did much with it. Are you using .96 or SVN? There was a bug in MTM a long while back that I know has been patched and refactored in SVN. Your model looks correct in syntax.
|
# ¿ Jul 5, 2008 20:19 |
|
duck monster posted:For Django hosting, checkout Slicehost. Its just a dirtcheap vHost, and they are pretty cool guys. Select debian (naturally), apt-get up to python 2.5, follow the apache->django setup and serve django like a motherfucker. too easy. Thats exactly the deployment set-up I plan on using +memcache I'm tagging that with AMZN S3 for static file hosting via a CNAME forward media.mydomain.com so I don't have to run lighttp or a second Apache instance. I'm hoping it flys for a time during my ramp up phase. Has anyone looked at deploying Django with mod_wsgi instead of mod_python. I've heard there are some performance benefits over mod_python but, it looks like you might have to hack your code base a bit to make it compatible. I've googled but, it's a bit sparse.
|
# ¿ Jul 8, 2008 19:33 |
|
Sivart13 posted:This is an epic change. Like, to the level that that trac page should have festive balloons and fireworks following your cursor. Followed by rewriting all your models.py files :\ It's a great change just breaks a lot.
|
# ¿ Jul 19, 2008 06:19 |
|
God.. Anyone want to rewrite my OP to update it to 1.0? I probably won't be able to get to it for another month or so... You get good karma and probably instant gold status.
|
# ¿ Aug 8, 2008 15:40 |
|
Space Kimchi posted:You mean like the one you're paying to run your Django application on? Offload your statics files to S3 or any other CDN. It's usually cheaper and faster* than either double tasking an app server or by getting another hosting account just for static media. *cheaper and faster is not universal. As always depends on scale and your costs. In general though it is comparable and efficient.
|
# ¿ Aug 18, 2008 17:52 |
|
geera posted:How is the state of Python and Django on Windows? I'd like to use them here at work and I have a free Windows 2003 server to host them on. However, it looks like Windows users have a lot of hoops to jump through and I don't see any information on getting this setup to work with IIS. I've started tinkering with them today and I'm already having issues with the MySQL-python drivers not wanting to install. http://www.vmware.com/products/server/ Your real problems are going to be in the DB bindings (which you've already discovered). I believe Postgres has cleaner bindings in Windows than MySQL but, it's been years since I've played with Python on Windows. (cleaner meaning easier to install) And IIS.... Wow... I would try Apache2 for Windows. I've used it before and it's not as "friendly" as IIS on Windows but, it still works. I would be hesitant to have it in production though. I know there was PyISAPI bindings and you could probably force Django to work in WSGI mode with it but, I have no idea if it's been done (probably has, there are crazy people everywhere)
|
# ¿ Oct 2, 2008 17:03 |
|
MetaKnyght posted:I've searched for information on this, but can't really seem to find anything useful. I think my Google-fu has gotten weak. Your second question is pretty hard. There are a few ways to skin this cat and the first thing that pops in my head is to have a DB table that has a "lock" boolean to be true when the cron is running and use a decorator around views that alter the DB. So when a view is called alters the DB you can redirect to a polite message to try again in a bit. Unfortunately this isn't a good user experience. I'm not sure of the exact situation that your working in that needs a full lock on the tables but, there's few options to really use here. If your user experience is critical and you don't want 1 minute down times (which is essentially what your doing) every 15 minutes you need to refactor this somehow. Is there anyway you can simple store up an array of updates that you want to do as your analyzing your data and then run through them while locked as opposed to locking doing all the queries analysis and updating then unlocking, etc...
|
# ¿ Feb 19, 2009 02:39 |
|
tayl0r posted:Another question: You still have to generate the models.py file for an application then fire up your app. You can either do it by hand or use a built in Django tool. I recommend a bit of both Configure all your database settings like normal (DATABASE_NAME, etc) then run python manage.py inspectdb > appname/models.py and Django will automatically construct the models.py file for you in your application. I highly recommend going into that models file and just checking it to make sure that it actually makes sense and has identified the relationships correctly. If you run syncdb after this thought Django will add some tables to your database for user administration and permissions like it always does for every app.
|
# ¿ Mar 4, 2009 15:35 |
|
Ansible posted:Wow, I love Django already. Never programmed in Python before, but was able to setup a linux VM and blow through the OP in under two hours. There are a few changes besides __unicode__ in 1.0 but they weren't a big deal. I'm glad the tutorial still works. I'm working on the itch to rewrite it all from scratch and I just might start a 'stupid-simple' for beginners Django blog as a motivation to do a whole rewrite. There's a bunch of little things in the tutorial that need refreshing since .96 -> 1 __str__ -> __unicode__ is an obvious one template.render(context) instead of render_to_response Not including all the all powerful context_processors which rock and are mandatory for any real app Aggregate is a sweet feature And just an all around refresh with better coding standards This might be my April project
|
# ¿ Mar 21, 2009 00:46 |
|
king_kilr posted:You're fine using render_to_response I think he meant it in the reverse. context processors are basically a way to have a "global" template variable. So say you want a logic form on every page you could put it in a template context processor so every single view didn't have to provide it. Yep... i inverted it... The shortcut of remder to response is the best practice
|
# ¿ Mar 21, 2009 17:46 |
|
Mashi posted:That's where I'm getting the readings from. I don't think its middleware because the same middleware is always run but the page load time can very between 30ms and 160ms. I'm also noticing that the slower pages show many more "context switches". Something to do with threads I think, though my app is single threaded. Something isn't right. Can you post one of your slow views? Your using the development server currently? MySQL is installed locally? What OS?
|
# ¿ Mar 24, 2009 04:08 |
|
Not quite ready for the OP but, I want to share this with you all first just to get some feedback and some basic error checking. I'm looking to finish off these tutorials sometime this week and start a new thread for 1.0+ since the OP here is quite old. http://simpledjango.com/tutorial/
|
# ¿ Mar 30, 2009 19:52 |
|
geera posted:I've read through the first couple pages and it seems well enough, but there have been several grammar/spelling/punctuation issues. Just figured you'd want to know so you can polish it up a bit. That sounds like my writing Yeah, there will probably wind up being about 12 sections in total. They I'm going to fill in some of the Quick Reference material. This blog isn't meant to replace the formal documentation but, merely augment. It's just going to show a basic tutorial and some normal design patterns for application development
|
# ¿ Mar 30, 2009 20:51 |
|
slobodan posted:I was using the jQuery library flot for a while, and it's great. Easy to use, and the API is simple enough. Flot's the way to go. I tried using Google's Visualization API's but, honestly it's really a mess. I found their methodology to graph construction to to be a bit cumbersome and not intuitive. Flot rocked. I pointed Flot to a URI that spit out JSON and it made a graph and it rocked
|
# ¿ Mar 31, 2009 16:05 |
|
m0nk3yz posted:Man if only we had an example http://sam.bluwiki.com/blog/2008/05/extending-user-model-profiles-in-django.php code:
code:
http://docs.djangoproject.com/en/dev/topics/signals/
|
# ¿ Apr 7, 2009 18:25 |
|
Yay posted:Ok ignore everything below, after spending hours googling, I'm apparently a spaztard, because 'django file uploads' tells me exactly what I needed to know, I needed to pass in request.FILES and POST. you win, Internet. Don't worry. I can't tell you the number of times I've reinvented the wheel in Django and in Python. When I have a something I'm looking for a solution now the first thing I do is browse through the Python docs for a few minutes then browse the Django docs. Usually something new will stick out at me and usually lead me to a solution and make me learn a new module or builtin
|
# ¿ Apr 8, 2009 14:45 |
|
king_kilr posted:Google Summer of Code has announced the selected projects and Django is participating again this year: http://socghop.appspot.com/org/home/google/gsoc2009/django . Last year brought us great stuff like the comments rewrite and aggregation/query expressions. I've been accepted to work on multiple database support so if that's something you need please follow along on django-dev(or ping me here) since I'll be sending an email to -dev every week starting this week to discuss the status of that including the API. A "bug" (almost) I ran into recently was having to do with date handling in Django. It's great to be able to find all messages from a certain month or day (e.g. Message.objects.filter(DateCreated__month=1, etc) but, the resolution of the search to only days creates a tricky situation when your dealing with more granular data. You can't do searches for items for the last hour for example code:
I'm not sure what other project dependancies there are in changing the time storage technique or if this should be resolved by a new model type like PreciseDateTimeModel, etc instead of reworking QuerySet to a different date/time format. Just throwing it out there as something I ran into recently.
|
# ¿ Apr 20, 2009 21:38 |
|
king_kilr posted:Hrm, a change like that would almost certainly be rejected for Django itself since it would break backwards compatibility, however you could write your own DateField implementation that looked exactly like the Django one except it stored data as a Unix timestamp, see http://docs.djangoproject.com/en/dev/howto/custom-model-fields/ MySQL doesn't support hour in it's datetime implementation. I might write up a custom model. I've basically added the logic adhoc in a model manager off a DecimalField.
|
# ¿ Apr 20, 2009 21:57 |
|
my stepdads beer posted:Anyone have any experience/recommendations for django forums? There's a slightly out of date wiki on Django projects http://code.djangoproject.com/wiki/ForumAppsComparison
|
# ¿ Jun 2, 2009 22:55 |
|
n/m
|
# ¿ Jul 22, 2009 05:28 |
|
MEAT TREAT posted:http://docs.djangoproject.com/en/dev/releases/1.1/ mmm... Proxy models look quite useful
|
# ¿ Jul 29, 2009 18:21 |
|
|
# ¿ Apr 29, 2024 11:05 |
|
Mulozon Empuri posted:'ello django people Best way I've seen to do is using the .extra() method in a QuerySet http://docs.djangoproject.com/en/de...ect-params-none User.objects.all().extra(select={'lower_name': 'lower(profile__name)'}).order_by('lower_name')
|
# ¿ Nov 5, 2009 17:43 |