Displaying template location in html
With 40+ HTML files it's easy to get confused as to where each component comes from. I don't want to annotate each file with its relative path manually, as this will prove cumbersome when the site finally goes production. Is there a trick to displaying the template location on-screen? Thanks for all suggestions, Alec Taylor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Adding Highlights for a product
Hi, Am trying to create a shopping cart using satchmo project. While creating a product, for certain types of products I want to add few highlights of a product similar to the one seen in this link http://www.flipkart.com/cameras/canon/itmczcrzgj3cysyx?pid=camcxq6nupdbxw56 As you could see the highlights of the products - 12.2 Megapixels - CMOS - with 2.7 inch LCD So i want to add something like this. Please let me know how i can configure a product as said above. Thanks and Regards, Swaroop Shankar V -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
lawgon, I have set up VirtualBox with Python and Django. Things have gone flawlessly. Only thing I've noticed is it seems to be running a tad bit slow. I feel this way because I had a native installation before and it ran quite well. Before I go too far into writing code I was hoping to "perfect" my environment. I want to be able to donate enough resources such as RAM to the VM so that it runs well but at the same time maintain a steady local Windows boot. Would you mind helping get me situated? My Laptop is a Fujitsu Lifebook T5010. A 231 GB HDD with 4 GB RAM. I have Windows 7 Enterprise 64 bit operating system installed. The original or current setup for my Ubuntu 11.10 on my VirtualBox system is: Base Memory: 700 MB (RAM? max is 4096) Storage: 40 GB (Fixed) Video Memory: 12 MB (max is 128) Monitor count is 1 Those are all the details I thought might be useful. I would really appreciate some guidance as to what you set yours up as or what you think might be the best to optimize performance? As a side note I'm really asking anyone in this thread what their opinion is? I plan is to look through this thread and see who else mentioned Linux and see if I can get input so I'm ready to go before I dive too deep into my development. Thanks to you and to everyone who has been very patient with me, given me so many tips, and stepped me through my setup! Much appreciation, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/DCFm0YJL_D8J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
Sam, I have set up VirtualBox with Python and Django. Things have gone flawlessly. Only thing I've noticed is it seems to be running a tad bit slow. I feel this way because I had a native installation before and it ran quite well. Before I go too far into writing code I was hoping to "perfect" my environment. I want to be able to donate enough resources such as RAM to the VM so that it runs well but at the same time maintain a steady local Windows boot. Would you mind helping get me situated? My Laptop is a Fujitsu Lifebook T5010. A 231 GB HDD with 4 GB RAM. I have Windows 7 Enterprise 64 bit operating system installed. The original or current setup for my Ubuntu 11.10 on my VirtualBox system is: Base Memory: 700 MB (RAM? max is 4096) Storage: 40 GB (Fixed) Video Memory: 12 MB (max is 128) Monitor count is 1 Those are all the details I thought might be useful. I would really appreciate some guidance as to what you set yours up as or what you think might be the best to optimize performance? As a side note I'm really asking anyone in this thread what their opinion is? I plan is to look through this thread and see who else mentioned Linux and see if I can get input so I'm ready to go before I dive too deep into my development. Thanks to you and to everyone who has been very patient with me, given me so many tips, and stepped me through my setup! Much appreciation, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/y689VFsrhDUJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
Jonathan, I have set up VirtualBox with Python and Django. Things have gone flawlessly. Only thing I've noticed is it seems to be running a tad bit slow. I feel this way because I had a native installation before and it ran quite well. Before I go too far into writing code I was hoping to "perfect" my environment. I want to be able to donate enough resources such as RAM to the VM so that it runs well but at the same time maintain a steady local Windows boot. Would you mind helping get me situated? My Laptop is a Fujitsu Lifebook T5010. A 231 GB HDD with 4 GB RAM. I have Windows 7 Enterprise 64 bit operating system installed. The original or current setup for my Ubuntu 11.10 on my VirtualBox system is: Base Memory: 700 MB (RAM? max is 4096) Storage: 40 GB (Fixed) Video Memory: 12 MB (max is 128) Monitor count is 1 Those are all the details I thought might be useful. I would really appreciate some guidance as to what you set yours up as or what you think might be the best to optimize performance? As a side note I'm really asking anyone in this thread what their opinion is? I plan is to look through this thread and see who else mentioned Linux and see if I can get input so I'm ready to go before I dive too deep into my development. Thanks to you and to everyone who has been very patient with me, given me so many tips, and stepped me through my setup! Much appreciation, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/npgPLwB8wYAJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
Steven, I have set up VirtualBox with Python and Django. Things have gone flawlessly. Only thing I've noticed is it seems to be running a tad bit slow. I feel this way because I had a native installation before and it ran quite well. Before I go too far into writing code I was hoping to "perfect" my environment. I want to be able to donate enough resources such as RAM to the VM so that it runs well but at the same time maintain a steady local Windows boot. Would you mind helping get me situated? My Laptop is a Fujitsu Lifebook T5010. A 231 GB HDD with 4 GB RAM. I have Windows 7 Enterprise 64 bit operating system installed. The original or current setup for my Ubuntu 11.10 on my VirtualBox system is: Base Memory: 700 MB (RAM? max is 4096) Storage: 40 GB (Fixed) Video Memory: 12 MB (max is 128) Monitor count is 1 Those are all the details I thought might be useful. I would really appreciate some guidance as to what you set yours up as or what you think might be the best to optimize performance? As a side note I'm really asking anyone in this thread what their opinion is? I plan is to look through this thread and see who else mentioned Linux and see if I can get input so I'm ready to go before I dive too deep into my development. Thanks to you and to everyone who has been very patient with me, given me so many tips, and stepped me through my setup! Much appreciation, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Vcst2yhhSWsJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
passing context data to inherited templates
In a project I'm working on I have a status bar at the top of the webpage that will render data using template tags. The status bar will be displayed on all of my views, so I want to put the html code in my base template. The base template is imported to all of templates using the 'extends' template tag. Now the base template needs a dictionary of data. My question is, how do I pass this data to the base template? I'm passing it in the context data of every view that renders a template, but it seems like there should be a better way - for example the base template calling out to a python function that can add data to the context before its rendered. Is there any other way to pass data to a base template? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/--MwzvAa-MQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Apps vs Project
This was hard for me when I started with Django about a year ago and I'm still learning, but I've found that I prefer to break things down into multiple small apps so that the models.py, admin.py, views.py, tests.py, etc. all are fairly small and easy to understand within a single app. The project settings.py can then just import them each as you would another external app. See my comments in the thread for the layout and a few tricks that I use: https://groups.google.com/forum/#!topic/django-users/gNvhuTADOiA Foreign keys work across app boundaries, you just need to have the apps on your python path and do: from django.db import models from crm_customer.models import Customer class PurchaseOrder(models.Model): customer = models.ForeignKey(Customer) ... Also, setting the app_label, you can make all the little applets appear in the same grouping on the admin page and essentially share a namespace for metadata like django-guardian permissions. class Meta: app_label = 'crm' Brian Schott bfsch...@gmail.com On Jan 12, 2012, at 10:31 AM, Grant Copley wrote: > Hey guys, > > I'm a 12 year ColdFusion guy learning Django and Python and had a > quick question. If this is the wrong place to post this question, I > apologize. > > I'm interested in converting a Customer relationship management (CRM) > system currently written in ColdFusion over to Python using Django, > however the concept of separate apps in a single Django project is > confusing to me. My CRM system currently manages customers, orders, > purchase orders, etc... and all of these separate pieces are related. > For example, > > * A customer has many orders > * A order can result in a purchase order being created > * etc > > My question is, if each piece (customers, orders, ...) ties together, > should all of this functionality be placed in a Django project with a > single app, or is it typical to break each piece into into a separate > app? If you separate them into different apps (an app for customers, > an app for orders)... then I'm confused how they tie together, > especially on the model layer. > > Thanks, > > Grant > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > smime.p7s Description: S/MIME cryptographic signature
Re: Adding first_name and last_name to django registration
I have tried to use this tutorial but I didn't have any luck. http://inka-labs.com/en-us/blog/2012/01/13/add-custom-backend-django-registration/ On Jan 28, 9:23 pm, Andres Reyes wrote: > The django.contrib.auth User model already contains first_name and > last_name fields so you don't need a UserProfile for that. > > Also the view that handles the registration takes a form_class that > parameter that you can pass in the urlconf, you would only need to > subclass the RegistrationForm, add your fields and then pass it to > django-registraion > > https://bitbucket.org/ubernostrum/django-registration/src/d073602dc10...https://bitbucket.org/ubernostrum/django-registration/src/d073602dc10... > > 2012/1/28 Jonathan Paugh : > > > > > > > > > > > contrib.auth.models.User has a get_profile() hook that allows you to add > > extra info to a user account from your own model; however, I don't see > > support for that in django-registration at first glance. > > > I'm looking at the code from > >https://bitbucket.org/ubernostrum/django-registration/ > > > On 01/28/2012 11:59 AM, Zach wrote: > >> I am new to Django and have implemented the django-registration app on > >> my website. I want users to input their first name and last name on > >> the registration page. However, the default setting only ask users for > >> their email address/username/password . Is there an easy way to > >> address this? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. > > -- > Andrés Reyes Monge > armo...@gmail.com > +(505)-8873-7217 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Adding first_name and last_name to django registration
The django.contrib.auth User model already contains first_name and last_name fields so you don't need a UserProfile for that. Also the view that handles the registration takes a form_class that parameter that you can pass in the urlconf, you would only need to subclass the RegistrationForm, add your fields and then pass it to django-registraion https://bitbucket.org/ubernostrum/django-registration/src/d073602dc103/registration/views.py#cl-76 https://bitbucket.org/ubernostrum/django-registration/src/d073602dc103/registration/forms.py#cl-21 2012/1/28 Jonathan Paugh : > contrib.auth.models.User has a get_profile() hook that allows you to add > extra info to a user account from your own model; however, I don't see > support for that in django-registration at first glance. > > I'm looking at the code from > https://bitbucket.org/ubernostrum/django-registration/ > > On 01/28/2012 11:59 AM, Zach wrote: >> I am new to Django and have implemented the django-registration app on >> my website. I want users to input their first name and last name on >> the registration page. However, the default setting only ask users for >> their email address/username/password . Is there an easy way to >> address this? >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Andrés Reyes Monge armo...@gmail.com +(505)-8873-7217 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Tutorial for dev version not working (Polls app): admin
Going through the tutorial using the latest trunk in a virtualenv. I am getting stuck in this section: https://docs.djangoproject.com/en/dev/intro/tutorial02/#s-customize-the-admin-form No matter how I rearrange the fields (even when I remove the "question" field), I cannot notice any difference in the poll admin screens. I have tried syncdb, and restarting the server. I've looked at the index screen (http://localhost:9400/admin/polls/poll/), the view screen (http://localhost:9400/admin/polls/poll/1/) and the add screen (http://localhost:9400/admin/polls/poll/add/). There are no differences in field order/display on any of these pages. I have followed the tutorial exactly, but the fields aren't being rearranged. Is there a different way of rearranging admin fields in Django 1.4? Thanks for helping me get this working, Alec Taylor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Adding first_name and last_name to django registration
contrib.auth.models.User has a get_profile() hook that allows you to add extra info to a user account from your own model; however, I don't see support for that in django-registration at first glance. I'm looking at the code from https://bitbucket.org/ubernostrum/django-registration/ On 01/28/2012 11:59 AM, Zach wrote: > I am new to Django and have implemented the django-registration app on > my website. I want users to input their first name and last name on > the registration page. However, the default setting only ask users for > their email address/username/password . Is there an easy way to > address this? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problems running subprocess inside django view
On Sat, Jan 28, 2012 at 12:05 AM, Mark Lancaster wrote: > I'm having problems running subprocess inside a django view using: > > result = subprocess.Popen([ , ], > stdout=subprocess.PIPE).communicate()[0] > > exactly the same method works perfectly inside a regular python > script. > > Should I be using a different method to initiate a script? You shouldn't be trying to initiate a script from within a view. The request-response cycle needs to be short lived. The responsiveness of the user's experience is directly tied to how long it takes for your server to complete executing a view; if you're invoking subprocesses (especially long lived subprocesses) as part of a view, then you aren't going to b "Oh, but my subprocess *will* be short lived!" you say? Well, you've still got a problem -- because your user can hit cancel at any time during a request, closing a connection, which can cause all sorts of interesting problems with managing dangling subprocesses. If you need to execute something long lived, you should break it down into parts: 1) A view that creates a "job". This doesn't need to be any more than writing a single entry in a database table. 2) A view that can be used to poll the status of the job. 3) A background task -- completely outside the request-response cycle -- that executes jobs, and reports the status back to the database table. This ensures that the expensive process is handled out of the request-response cycle, yielding a more responsive interface, and giving you better scalability, too (since your ability to handle background processes is decoupled from your ability to handle user requests for background processes). There are many ways to achieve the background task -- celery is one popular option, but you can organise an quick and nasty proof-of-concept using cron. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with new version of django
I suspect he means the latest stable version, in which it really is 1.3.1. To my knowledge 1.4.1 does not yet exist. As for the original question, I would suggest familiarizing yourself with the what's new documents for Django 1.2 and 1.3, and then tuning your code accordingly. Depending on what your application does, it may be quite painless. Alternatively, if you have good test coverage, you might just upgrade your Django version, test, and fix what's broken. Obviously, the first option is probably the better, but regardless, it will be quite difficult for anyone to give you specific advice based on the amount of information you provided. Aaron On 1/28/12, kenneth gonsalves wrote: > On Wed, 2012-01-25 at 17:25 -0800, itua ijagbone wrote: >> Hello, please i need help as to how to update my project to the >> lastest version of django 1.3.1. i have been using 1.1.1 to develop >> the project. Please how do i go about it, making my project conform to >> 1.3.1 > > latest is 1.4.1 > -- > regards > Kenneth Gonsalves > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ChoiceField Help
Hello, I've created a simple ChoiceField for my app with two items. I need to somehow query which choice was made from the user so I can pass the appropriate context to my template. What would be an example of how I can do such a thing? Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django Deploy - Some Questions regarding it
Hi there everyone, I'm trying to make my first deploy of a project, and encountered some problems. Here is the scenario: I read that to make uploaded files only accessible for the uploader(the user) was a better choice to use nginx(apparently more easy to configure). But after following a couple of tutorials(a lot of them actually) I still couldn't make it serve the media files, but them I got really confuse, and decided that I should review my concepts before trying any further. So here are my questions: Does Nginx serve the files that the user upload or just de static ones(css, admin_media and stuff)? If so: -- Could anyone give me an example of configuration for this? -- Should I remove the url conf that maps '^media/(?P.*)$' ? If not: -- Then how should I config my settings in production so that it serves my css and admin_media? -- How should Nginx be configured to serve me this? And also there are other matters, like: Should I configure django.sites to point to what? or I don't need this set? What is better: Copy admin/media to my media folder, or my static folder? or should I just make a symlink? And finally should I change the directory permissions to the nginx user:group? If so, then what directories? Just the media/static, or the hole project?(I'm leaving the media/static folder inside the project folder, is this a problem to deploy?) Thanks for the atention, any help is welcome since I've been for 4 days trying to make this work(in a virtualmachine, testing in lan) and still no media/static been served(but I could manage the site to run and appear, but no css in admin). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problems running subprocess inside django view
As the same user? Are you running with manage.py runserver? Generally it is a bad idea to call subprocess from a web process context. A blocking call you don't expect might time out the client and/or hang your server. Check out Django-celery. Create a tasks.py and have your view call a task. Sent from my iPhone On Jan 28, 2012, at 6:41 AM, Eugene Gavrish wrote: > You are not alone with this problem. But I haven't got any decision. > Maybe its django-specific with Popen?? > > I divided my task in two part: first cron-driven disk file generation. > Second - from django-view this file parsing. > It satisfied my goals, but question with Popen is still opened... > > > On 27 янв, 20:05, Mark Lancaster wrote: >> I'm having problems running subprocess inside a django view using: >> >> result = subprocess.Popen([ , ], >> stdout=subprocess.PIPE).communicate()[0] >> >> exactly the same method works perfectly inside a regular python >> script. >> >> Should I be using a different method to initiate a script? >> >> Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django ManyToManyField JSON Fixture
Hi - I'm working on my first Django project and am trying to set up the fixture data for my blog app using JSON. Everything works correctly until I try to set up 'tags' on a 'post' which is a ManyToManyField. When I run '>>> python manage.py sqlall blog' and check out the proposed SQL, the table 'blog_post_tags' is listed and defined correctly. However, when I try to run '>>>python manage.py syncdb' I am met with the error: 'DatabaseError: no such table: blog_post_tags'. model: class Tag(models.Model): title = models.CharField(max_length=30) date_created = models.DateField(auto_now_add=True) date_updated = models.DateField(auto_now=True) class Post(models.Model): ... tags = models.ManyToManyField(Tag) ... fixture: [{ "model": "blog.Post", "pk": 1, "fields": { "title": "Demo Post 1", "category": 3, "tags": [1], "body": "This is a sample body.", "is_published": "1", "date_created": "2012-01-28", "date_updated": "2012-01-28" } }] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Starting a new Python blog
Hello Everyone, For sometime now I have been itching to create a Python blog, and now the fruits of my labor have paid off. I am ready to release the blog to the public eyes. At the moment it has 2 main features, a blog portion, and a bookmark system. Both the blog and the bookmark system offer an RSS Atom feed. The bookmark system is fully compatible with "Live Bookmarks" to quickly access some of my top Python sites I visit or visited recently which caught my eye. The website is called "Python Diary", a rather unique take on a tech blog name. The site itself has a diary-like theme, and is for the most part very easily to navigate. The website was completely built using Python, the theme was taken from a wordpress theme website and formatted to work with the Django template system. The entire backend is written from scratch using a few reusable Django apps, namely, django-tagging, south, and cumulus. Now you might be saying, "Oh great, yet another Python blog". But wait... I plan on setting this blog apart from the thousands of other blogs in the world with some very unique features. Features normally found on commercial software blogs, movie and video game blogs is a thorough review system. I plan on going through many of the available Python packages out there in the wild and basically reviewing them like one would review anything else. I do not see a dedicated Python website which has reviews of many Python packages available in PyPi. I plan on stating the usual pros and cons of the package, and providing a score. For example of how this type of review is formatted, take a look at a CNET Review. My new blog can be found here: http://www.pythondiary.com/ Tell me what you think of the website in general, and the overall idea for this blog. If you would like to subscribe to the upcoming content, add this RSS feed to your favorite RSS reader: http://www.pythondiary.com/blog.xml -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django - filters
Hello all, In my django application, all the data of different clients are entered. Sometimes data of even same client is also entered. Now what I require is to get all the data of the client when it asked for. The views I used is: def old_client(request): if request.method == 'POST': form = OldClientadd(request.POST) if form.is_valid(): from TCC11_12.automation.functions import * cd = form.cleaned_data name_and_address = cd['name_and_address'] title = get_object_or_404(Variable, pk='1') sign = get_object_or_404(Variable, pk='3') from TCC11_12.automation.choices import * client = ClientJob.objects.filter(name_and_address=name_and_address) amount = Amount.objects.all() suspence = Suspence.objects.all() total_temp = Amount.objects.aggregate(Sum("total")) total = int(total_temp['total_sum']) net_total_temp = Amount.objects.aggregate(Sum('net_total')) net_total= int(net_total_temp['net_total__sum']) template ={'form':form, 'total':total,'title':title ,'sign':sign, 'net_total':net_total, 'client':client,'amount':amount,'suspence':suspence,'name_and_address':name_and_address ,} return render_to_response('automation/oldclient.html',locals(), context_instance=RequestContext(request)) else: form = OldClientadd() return render_to_response('automation/client.html', {'form': form}, context_instance=RequestContext(request)) Here I get filtered the data of the client I require, from amount and client table. But when I go for the sum, it add all the data in amount field without providing any filter. Is there any way to find aggregate sum of only those amounts that are previously filtered ? I cannot give filter on amount as name and address field is not there in Amounts table. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Getting started with Django: New Udemy Class, free for a limited time
Here is the link: http://www.udemy.com/getting-started-with-django2/ More info: I am starting a Udemy class called "Getting started with Django". This is supposed to be a fast paced introduction to Django, and is going to be useful to people from beginner to intermediate Django skills. Please join: http://www.udemy.com/getting-started-with-django2/ or forward to people who may be interested. I am keeping the course free for the first 100 people, and I am going to set the price to 149$ once we have the 100 people signed up. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Hierarchical Django Ajax Forms
I needed to build a form where the user can input a geographical location, with fields for country, state, city, neighborhood. I wanted the form to use AJAX, so that the only valid fields would appear as the user selected fields higher in the hierarchy. It sounded like a task that should be easy to automate, but I didn't find anything that quite did it online. A lot of examples on how to do it, that involved writing a bunch of handlers manually. Here's my attempt, it makes it pretty easy to apply to any set of hierarchical data. So if you want to apply this to a set of models for (Model Year, model, make, trim), or (kingdom, phylum, class, order, family, genus, species), it should be pretty simple. The steps to create the form would be: 1. Define a model representing your form. The model should contain foreign keys to models in your hierarchical data set. However, instead of using the django ForeignKey field, use hierform.fields.HierarchicalForeignKey. 2. Defined a form that uses your model, but inherit from hierform.fields.hierarchicalForm instead the django ModelForm. 3. Add a view to handle all the form requests. This view needs three sections. i. You need to handle POST request to handle form submission. This is the same as normal Django form submission. ii. For generating the form, instead of just using the form class to create the form, use a utility function from this package ajaxRequest(request.GET). In the usual case, request.GET is empty and this call instantiates a normal unbound instance of the form that you can render into a template to display. iii. If request.GET contains AJAX form submission fields from your hierarchical data set, ajaxRequest(request.GET) will generate a small HTML snippet that contains only the updated select fields. In this case, you want to deliver this snippet straight back to the web page, without the rest of your HTML template. 4. Add a view to deliver the Javascript to your form. Really all this does is inject the html tag location of your form, and the URL of your form into a template containing the javascript. Source for a demo, and a more descriptive readme are here: https://github.com/dragonx/django-hier-ajax-form I'm pretty new to python/django. If any experienced developer has time to take a look I'd love some feedback, especially if I'm using any poor coding practices for Django. This is also my first time contributing anything open source. If there's a better way to make this available, or if you use it and want to contribute an improvement, or want to set up a live demo for me, please let me know. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Adding first_name and last_name to django registration
I am new to Django and have implemented the django-registration app on my website. I want users to input their first name and last name on the registration page. However, the default setting only ask users for their email address/username/password . Is there an easy way to address this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Parsing HTML
Thanks, that's good to know. I'm just a few months into using Python (and weeks with Django), hence the familiarity with that one book and not real-world application just yet. On Jan 28, 9:45 am, Masklinn wrote: > On 2012-01-27, at 23:40 , jondbaker wrote: > > > Chapter 8 of Dive Into Python demonstrates what you're describing > > using sgmllib. > >http://www.diveintopython.net/ > > None of these libraries is very good at parsing "real-world" (broken) HTML > though, for that you'd better go with html5lib, lxml.html or BeautifulSoup > (in decreasing order of recommendation, lxml.html is probably the fastest but > I don't think it implements the HTML5 parsing rules) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Parsing HTML
On 2012-01-27, at 23:40 , jondbaker wrote: > Chapter 8 of Dive Into Python demonstrates what you're describing > using sgmllib. > http://www.diveintopython.net/ None of these libraries is very good at parsing "real-world" (broken) HTML though, for that you'd better go with html5lib, lxml.html or BeautifulSoup (in decreasing order of recommendation, lxml.html is probably the fastest but I don't think it implements the HTML5 parsing rules) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problems running subprocess inside django view
You are not alone with this problem. But I haven't got any decision. Maybe its django-specific with Popen?? I divided my task in two part: first cron-driven disk file generation. Second - from django-view this file parsing. It satisfied my goals, but question with Popen is still opened... On 27 янв, 20:05, Mark Lancaster wrote: > I'm having problems running subprocess inside a django view using: > > result = subprocess.Popen([ , ], > stdout=subprocess.PIPE).communicate()[0] > > exactly the same method works perfectly inside a regular python > script. > > Should I be using a different method to initiate a script? > > Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django vs. Ruby on Rails
> 3) Using one or the other for Geographic Information Systems work; I work at NASA/JPL and have been using Python for 1 year, and have been working in GIS for 3 years. GIS is built around 2 core languages, Java for back-end servers and largely due to the amazing GDAL library. The other dominate language is Python. I was working with the USGS on a project and every time something needed to be done outside the typical WMS, WCS or ESRI Arc(whatever) it was done with Python. Can't add much about the other items, but if GIS is a core decision point know that Python is heavily favored over Ruby. Good Luck, Cameron -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Parsing HTML
Chapter 8 of Dive Into Python demonstrates what you're describing using sgmllib. http://www.diveintopython.net/ On Jan 27, 3:31 pm, Dennis Lee Bieber wrote: > On Fri, 27 Jan 2012 13:35:42 +0700, ddtopgun wrote: > >i'am new to django and i want to try get the content of HTML. > >can help me how to get the content of html. > > > > Django is meant to generate HTML pages, not parse HTML content. > > >f=urllib.request.urlopen("http://site_name.com";) > >s=f.read() > >f.close() > > >but the code is display all code html. i want to just take the contents > >of tag html. > > You'll have to do better to define "contents". Only stuff inside > tags (and you then may have to worry about old HTML that doesn't > using closing tags)? Is an image reference ( src="somefile.name"> ) content or only the text between the tags? > > If the HTML is well-formed, you might be able to use ElementTree to > traverse the nodes. Or define callbacks for HTMLParser or htmllib (see > section 19 [for Python 2.7]: Structured Markup Processing in the > Standard Library reference manual) to capture the portion in which you > are interested. > . > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django vs. Ruby on Rails
On Thu, Jan 19, 2012 at 9:59 AM, Brian D wrote: > I'm wondering about diving into Ruby on Rails to qualify for a > position, or spending my time instead going deeper into a full bells > and whistles prototype Django site and betting on jobs opening up in > my field. This is really a GIS career professional question. > > Has anyone here crossed the fence over to Ruby on Rails? What do you > think when: I've used both Django and Rails extensively the past 5 or 6 years. For me it depends more on the project for which one I choose. If it's a really important project that I envision working on long term I go with Django. But if it's just a simple or fun project I might go with Rails. The Rails community loves change. There's no shortage of forked (incompatible) gems lying around. Instead of contributing changes and improvements back to the original project, developers often fork and ship their own custom version of a gem. I once found 5 different forks of Rcov while setting up a new Rails project. The original version of Rcov wasn't compatible with what was the new Ruby 1.9 at the time.. so everyone had an Rcov fork with their own take on the required fixes. Gem dependencies are sometimes very frustrating with Rails. I've never ran into such things using Django and Python. Another thing that erks me to no end about Rails is they assume you are using sudo. The new bundler gem is a total pain to deal with if you are on something like Debian where sudo isn't installed by default. I hate sudo. It's like permission to be irresponsible with root or something.. pretty lame. One thing I love about Rails is the speed of development. It does a lot for you. Lots of generators to whip up quick code when required. But that speed comes with the cost of introspection later. Rails doesn't know anything about your tables until it looks. Even if you go to all the trouble of writing database migrations, it doesn't even use them later, choosing introspection instead. Some will say you don't have to specify model fields in Rails like you do with Django, but that's exactly what a Rails migration is.. so you do do that on most non-toy projects. > 1) Comparing the framework to Django; You can accomplish the same things with either. > 2) The communities -- friendliness, support, etc.; Everyone seems about the same to me, but you should Google Zed Shaw's rant about leaving the Rails community. It's pretty funny. > 4) (I was going to leave this out but) Comparing Ruby to Python as > languages. I have not used Python 3 yet, but I can tell you, the latest Ruby 1.9 series is slower than the old 1.8 series. Last summer I built the same app twice using Django and Rails. Apache bench showed the Django app to be significantly faster. Python seems a bit faster than Ruby in general. > What concerns me about Django is that, outside of forums like this, > the chatter seems to have died down in the last couple of years from a > peak in 2008/2009. The strengths and weaknesses and features are all fairly well known at this point, so not much to discuss I imagine. > I did search the group and haven't seen any recent discussions on this > comparison. Rails seems risky to me. Django feels like a sure bet. Maybe I'm just old, but sometimes I get the feeling Rails is being built by some kids in someone's basement. -- Greg Donald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
On Fri, 2012-01-27 at 12:25 -0800, JJ Zolper wrote: > Thanks a lot I was thinking I would learn the Google Maps API. Have > you worked with OSM? > > Do you have any input if you have used OSM and if you have used Google > Maps what your comments are? google maps are proprietary. OSM in open source - end of discussion. -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
On Fri, 2012-01-27 at 12:24 -0800, JJ Zolper wrote: > That's really all I am trying to understand. From A to B. A being > where I am able to develop once I finally am able to make that > decision and B how smart I picked A so that the move from my local > computer to my server is smooth and simple. upgrade to linux and stop worrying -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
On Fri, 2012-01-27 at 12:18 -0800, JJ Zolper wrote: > Since I will be deploying my Python code on a server that is based on > Linux wouldn't it be smart that I develop my Python code on something > similar to my VM for Django? yes -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with new version of django
On Wed, 2012-01-25 at 17:25 -0800, itua ijagbone wrote: > Hello, please i need help as to how to update my project to the > lastest version of django 1.3.1. i have been using 1.1.1 to develop > the project. Please how do i go about it, making my project conform to > 1.3.1 latest is 1.4.1 -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
djangosnippets.org domain has expired
Heads-up to whoever is in charge of this domain - it has expired and is now redirecting to a GoDaddy domain parking page. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: User-specific sites
It's all in queries. You assign the user to all your tables as a foreign key and make sure that all your quiries have user in them as a filter. You can also extend the user and assign a slug to it so that you have unique urls for all users. You can generate a slug from the username upon user creation. That's really it. Cheers On 28/01/2012 12:35 PM, "Russell Keith-Magee" wrote: > On Wed, Jan 18, 2012 at 5:35 AM, Eryn Wells wrote: > > Hi all, > > > > This is my first post and it's a simple question... (I think) > > > > In my experience, it seems like Django allows users to log in to access > and modify the same content, like a blog with multiple authors or a CMS. > I'm trying to figure out how to do user-specific sites – something like a > blog site where every user has their own blog and they can log in to add, > remove, and edit their own posts (and no one else's). Each user has their > own preferences and the like as well. Is this something that Django's > built-in user framework can handle? Or could I maybe finagle the sites > module into doing something like this? Is it as simple as adding a > ForeignKey to all my models that points to the User that owns that > particular db row (seems like the brute force way of doing it...) or is > there a more elegant way? > > Hi Eryn, > > It sounds to me like a foreign key to User is the best way to handle > what you're describing. If you set up the auth infrastructure, a > logged-in user will attach the current user to the request object, so > if you want to find the Posts for that user, it's a very simple > filtered query. > > I'm not sure why you consider this to be "brute force"; you've pretty > much defined your requirements as "Show me all the blog posts for this > user", so that's what you encode in Django -- a view of blog posts, > filtered to those from the current user. > > If your objection is that you need to code everything from scratch -- > well, that's when you start looking for other people that have solved > the same problem, and use their code. There's a rich community of > reusable, open source Django applications, and unless you've got very > specific requirements, you'll probably find a "blog" package that will > meet those requirements. I'd suggest having a look around Django > Packages [1] to see if there is something that will meet your needs. > > If you're looking for a more complex, CMS-like solution -- there are > pre-built solutions for those, too (Django CMS, FeinCMS, Mezzanine, > and others). Which one works best for you will depend on your > requirements. > > [1] http://djangopackages.com/ > > Yours, > Russ Magee %-) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I need help with Python Tools for Visual Studio 2010 and Django
Developing on a Linux-based OS will give you indispensable understanding of your production environment. On the other hand, it will probably be very unfamiliar if you haven't worked on Linux before, and easy tasks will become very difficult again, for a while. You should ultimately develop your application on the platform that makes you the most productive---the portability of Python and Django gives you that luxury---you could even target the Java Virtual Machine. (And you won't know that without trying them all.) Definitely try out running a development websever './manage.py runserver is fine) on Linux, to get a feel for what your production environment might be like. You might decide you like working on Linux, and it make you more productive---or not. But---at least for Django/Python---that's largely a matter of taste. On 01/27/2012 03:18 PM, JJ Zolper wrote: > Since I will be deploying my Python code on a server that is based on Linux > wouldn't it be smart that I develop my Python code on something similar to > my VM for Django? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How do you pass dissimilar data from view to template?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think jQuery supports this sort of thing, (as I'm sure other Javascript libs do). Then again, learning Javascript + jQuery together seems at least as hard as learning Python + Django. On 01/27/2012 11:31 AM, BillB1951 wrote: > Thanks for the additional thought on this. It is a much > appreciated confirmation to me. Last night I was torturing my > brain over the logistics of what I had conceived, and by this > morning I had pretty much concluded that I would have to go the > route you are suggesting. Now I just have to find an existing > solution ... or learn Javascript. --Bill > > On Jan 27, 11:19 am, Dennis Lee Bieber > wrote: >> On Thu, 26 Jan 2012 14:01:50 -0800 (PST), BillB1951 >> wrote: >> >>> Brett, Thanks. That is what I needed. BillB1951 >> >> Just an aside: seems like a convoluted plan to keep >> round-tripping to the server/database each time you refine the >> filter. >> >> I'm presuming the initial data set being sent is the "full" list. >> If so, might it not be useful to somehow (Caveat: I'm /not/ >> skilled at this, only toyed with Javascript too many years ago) >> embed a Javascript action to count the categories, render the >> filter selections and, when one is picked, have the Javascript >> modify the page in-place to display only the filtered data? >> >> Granted, adding another language on top of Python, Django, and >> the template language, may be more than desirable. -- Wulfraed >> Dennis Lee Bieber AF6VN wlfr...@ix.netcom.com >> HTTP://wlfraed.home.netcom.com/ > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJPI8VQAAoJEH+72ZVdir1G7P4P/2RjG5MI1NivppUL2gZevkRI YblHMSwf/RMWX4YjxCbhJNnzAsprNDIwcqKCwfCQo2RCElgz4/r+FTgbA+NN/R81 D6NZAbKqOHWl3jvNKTpytCbMthxRMsE8Frj5gyr1iD4xxEFrYePByOd3Qwml1dCb 3b5aSVQ+4BX84b+vLy8juo/bZb8fQM4oqlu4lUhjqJRGNNSPruXQ9/iom0ugIkyO QnrAwFnsoJW1+3yGSI7X/p8InWTCznGyFQulOq9cYzmaakXnSjWdLEbg3LCwXqoU uKJmofVYGVcu5gMXfLhIulJPpCkPgTL+f+Zp91ii49sSgiv2PheqC8aAKv3vhSea TPF3RzQfkhaUuAA/E/nlagvbOIBfbeSTTy4SG/X5oRS4lD3Lp57BX6g7uiOEeVMV tgjTRgMq2GrtVxxhL3NSbYhChSWHooNfFN94i8CjZmp3KyjxbVDZuFaeo2PAYlo6 knrkjYWP49mcnM98MetBFe1YupAjJ8lsfMPChfa6Ot/ixGbB+DFk7gnRsnz4D8FU w7ZBorUiGOclwtwlVpKVOtfT7kb48kzQHf4fidqL3RHZJNusShT94X4fs5VcLOoO dpDJLwxluBMPpGb7xBMfkhDvdClVDZNnhKYQr0XndydYEDa01ne+4iwHZtsPieaH R7EFAOahr78c0f8Usj7Y =JYjK -END PGP SIGNATURE- -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Handling multiple parameters on URI via GET
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is the request.GET.get() method working properly? Does the test on query work? I suspect one of these places doesn't work as expected. I'd do similar to the following in my code. (It works on Django 1.3.1 for request.POST, anyway.) if 'page' in request.GET: # do pagination elif 'search in request.GET: # do search else: # do something else On 01/27/2012 01:47 AM, Darren Spruell wrote: > I've puzzled my way into a corner. Figuring this will be a > palm-to-forehead moment. > > I have a page on my site which is Paginator-ed for the object > list. I'm sticking to the vanilla setup from the docs so when it is > in effect I've got a URI query string of '?page=%d' processed via > GET. I've added a search form to the page and am passing the form > data via GET as well so when a search is in effect I have > '?search=%s' on the URI query. I'm incredibly creative (not) so > most of this is done very closely modeling the approach at > http://www.djangobook.com/en/1.0/chapter07/. I can do either of > them individually just fine, but I can't figure a clean way to > have both pagination and search parameters operate properly across > requests as the user selects next/previous, etc. in the page > navigation. It works if I manually append the missing query > parameter to the URI. > > How is this typically best handled in Django? I thought about > trying to determine uri query in template and dynamically build the > nav links to include parameters for search and pagination but I > didn't figure a way that wasn't a complete mess. > > > ## view > > def list_submissions(request): """ Present list of submission logs, > paginated. > > """ search_form = SubmissionLogSearchForm() query = > request.GET.get('search', '') if query: qset = ( > Q(file_name__icontains=query) | Q(file_md5=query) | > Q(file_sha1=query) | Q(submitter__username=query) ) > submissionlog_list = SubmissionLog.objects.filter(qset) else: > submissionlog_list = SubmissionLog.objects.all() > > paginator = Paginator(submissionlog_list, 15) # show N logs per > page > > # Make sure page request is an int. If not, deliver first page. > try: page = int(request.GET.get('page', '1')) except ValueError: > page = 1 > > # If page request () is out of range, deliver last page of > results. try: submissionlogs = paginator.page(page) except > (EmptyPage, InvalidPage): submissionlogs = > paginator.page(paginator.num_pages) > > return render_to_response('avsubmit/submissionlog_pages.html', { > 'submissionlogs': submissionlogs, 'search_form': search_form, }, > context_instance=RequestContext(request)) > > > ## template > > Showing {{ submissionlogs.object_list.count }} submission{{ > submissionlogs.object_list.count|pluralize }} of {{ > submissionlogs.paginator.count }} total > > {% if submissionlogs %} {{ search_form.as_p }} value="Search" /> > > File MD5File > NameSubmitterSubmission Date {% for > log in submissionlogs.object_list %} {% cycle 'row1' 'row2' as > rowcolors silent %} style="font-family: monospace; font-weight: bold; font-size: > 14px;">{{ log.file_md5 > }} {{ log.file_name }} {{ log.submitter > }} {{ log.date_submitted|date:"m/d/Y h:i A" }} > {% endfor %} {% endif %} > > {% if > submissionlogs.has_previous %} << {% endif %} > > Page {{ submissionlogs.number }} of {{ > submissionlogs.paginator.num_pages }} > > {% if submissionlogs.has_next %} >> {% endif %} > > > Thx, > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJPI8RSAAoJEH+72ZVdir1GW9AP/36bfx6HMDWdsB+AQevDW/ao ccHy2FzmqI+yEEREoIsuV2fRiVtVwdVoUAI3pkEz4zpspVmDj+f4MhOnPZc+t88l EBXtCuIpjlHlLK0irRq8AZ3Yw5FnWg8Pm3D7gDVgSSWvgmXem5wXwf8r3s3JjFAU ovRVWESamRR9sy8TjC/aGJ/5yT2Z5DcDRoTGn4/kCklKFCNvNxkrtO9tw10fjLCb IeMPGtEP8NkTjXM87//fCOsgJOuet2SwoUYPB9PvpVLQFa8b4yS+vBpCcfWNIwEv z7pIgksr0ka+xKV4wj1CAieAd7m7pNtWXLzfzWtHTEtQn+0V67Fv1TynE4cQdMM7 2BwZCw3nMMBfcH1XoHte/bqrYzjzqFqRp34H3mTRotrnP8OWc8T1DSeJnZ6CBTT5 zL7H2NSwyBl3JcMOWgyJ6MoHuy6Vv2uWr6OPQcp+P53a19ok5MKeRhnxem26uTV3 truAUUve4gb2MzyP77JGhmzjHzzKM/HD8Z362NVhuk4Bmp8FEyHHyAzSIuTCPfD2 9kb4X+ISxhxwXQLXQRmBTe4gLE8YlsXxiP3vAZnJRoYnJWRl5RrVezrofZLI+Z8o xtIYugGa+yMp3gBRVCTOxf6TLc9XhHGcLiqoSljYpSfGHEoGzVPJq7Bn8Jho8ite tbSmLYW73NaMLcBMFkzN =3Bbe -END PGP SIGNATURE- -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: what is the best IDE to use for Python / Django
I like using Pycharm . The 2.0.1 version has pretty good integration with bitbucket , github and other VCS/DVCS I also use emacs and have heard good things about sublime2 Hari On Mon, Jan 23, 2012 at 7:41 AM, Leandro Ostera Villalva wrote: > That's because PyCharm is an actual IDE while gedit, st2, emacs, vi and > forth are text editors. > > El 23 de enero de 2012 04:35, Mario Gudelj > escribió: > >> I've used gedit, sublime text 2, emacs, vi, but the best Django IDE by far >> is PyCharm. I'm seriously amazed at how awesome it is. It's worth every >> cent. >> >> >> On 23 January 2012 22:20, Sandro Dutra wrote: >>> >>> The best IDE is that you fell comfortable using it. >>> >>> 2012/1/21 goosfancito : >>> > El 21/01/12 08:52, kenneth gonsalves escribió: >>> > >>> >> On Sat, 2012-01-21 at 03:34 -0800, John Yeukhon Wong wrote: >>> >>> >>> >>> While it has been asked a trillion times already, let me say TRY UT >>> >>> YOURSELF. >>> >> >>> >> you were requested not to feed this thread. If the OP cannot search, >>> >> here it is: >>> >> >>> >> >>> >> http://duckduckgo.com/?q=site%3Agroups.google.com%2Fgroup%2Fdjango-users >>> >> +python+IDE >>> > >>> > i used gedit only. >>> > >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> > Groups >>> > "Django users" group. >>> > To post to this group, send email to django-users@googlegroups.com. >>> > To unsubscribe from this group, send email to >>> > django-users+unsubscr...@googlegroups.com. >>> > For more options, visit this group at >>> > http://groups.google.com/group/django-users?hl=en. >>> > >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To post to this group, send email to django-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. > > > > > -- > Regards, > > Leandro Ostera, > BLOG - Check what I'm doing now > EMAIL - Write me an email > SHOWCASE - Check my latest projects > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.