Re: Problem with django book in Forms chapter 7

2011-08-07 Thread Rafael Durán Castañeda
I had the same problem as you, since the book was written using an older django version and there was some changes on csrf for django version 1.2. Looking at django docs https://docs.djangoproject.com/en/1.3/ref/contrib/csrf/#how-to-use-it you can read recommended way to use this On 06/08/11

Re: how to use "{% url *** %}" in django template file?

2011-08-07 Thread Subhranath Chunder
On Sun, Aug 7, 2011 at 10:35 AM, Jimmy wrote: > Hi, > > I got the error "Caught ImportError while rendering: No module named > urls" when using: > > {% url 'card.views.create_card' %} in the template file > For django 1.2 and earlier versions you should use the syntax {% url card.views.create_car

Seperate Image Model

2011-08-07 Thread Josh
I'm only working a few weeks with Django and I want some advice about handling images. Conceptual I have to remind myself that Django is pure python, so that makes me complicate things sometimes. Also I still have some conceptual difficulties with templates and template_tags. Also I'm not real

How to use django-tables with Paginator

2011-08-07 Thread Kayode Odeyemi
This question is related to django-tables. I hope I am allowed to post here. I will appreciate some help on how to use Django Paginator with django-tables. Below is what I have been working with: report.py import django_tables as tables from webapp.models import Transaction class T

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Shawn Milochik
Are you saying that you want to show some form inputs conditionally based upon configuration, for example for each user? If that's your goal then it's very easy to do by adding the logic in the form's __init__. Add/remove fields there and (possibly) override save() if you have to take any addi

How to test form values in a template? (simplified)

2011-08-07 Thread Joshua Russo
I realize that I went from too little information, to too much information in the previous post, so this is an attempt to find a middle ground. What I'm building is the ability to have a list of checkable options, and depending on the setup for a give option it may have a text field to enter ad

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Joshua Russo
It's more that I want to have different ways of displaying the same form field. I want the text field to be on the same line as the checkbox when it's an input field and below it when it's displayed as a textarea. There's also the point of changing the required setting of the same field based on

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Shawn Milochik
The validation is easy. Override the form's clean() method to do any validation which needs to check the value of more than one field. For example, if you want a text box to be required sometimes, define it as not required in the form, then check the boolean in clean() and raise a forms.Validat

Why isnt this simple import working??

2011-08-07 Thread Hayyan Rafiq
While trying to construct an example from the django book chapter7. I used the following import code in my views.py from mysite.form.forms import ContactForm now ContactForm is a class in forms.py located in "D:\Django-1.3\django\bin\mysite\form" where mysite=dir form=dir forms= python file Con

Problems with prepopulated_fields JS

2011-08-07 Thread MeME
Python 2.6.1 Django (1, 3, 0, 'final', 0) hello I've added Category model to apps models class Category(models.Model): app_label = _('News') title = models.CharField(max_length=50) slug= models.SlugField(unique=True) description = models.TextField() In a

RE: Why isnt this simple import working??

2011-08-07 Thread Hayyan Rafiq
I think i know why this isnt working becuase the form folder does not have an init.py init.py init. So my qustion is how do u import a class from a python file in a random folder? From: hayya...@hotmail.com To: django-users@googlegroups.com Subject: Why isnt this simple import working?? Date:

RE: Why isnt this simple import working??

2011-08-07 Thread Hayyan Rafiq
Got it working just inserted a init.py file init. so it got recognized as a python directory From: hayya...@hotmail.com To: django-users@googlegroups.com Subject: RE: Why isnt this simple import working?? Date: Sun, 7 Aug 2011 19:48:03 + I think i know why this isnt working becuase

Re: Why isnt this simple import working??

2011-08-07 Thread Rafael Durán Castañeda
I think if you should read http://docs.python.org/tutorial/modules.html, specially packages part On 07/08/11 21:51, Hayyan Rafiq wrote: Got it working just inserted a init.py file init. so it got recognized as a python directory -

RE: Problem with django book in Forms chapter 7

2011-08-07 Thread Hayyan Rafiq
Hi just started facing the same problem which you did in chapter 7 . I tried using def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): cd = form.cleaned_data send_mail( cd['subject'],

RE: Problem with django book in Forms chapter 7

2011-08-07 Thread Hayyan Rafiq
Here is how i did it @csrf_exempt def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): cd = form.cleaned_data send_mail( cd['subject'], cd['message'], cd.g

Re: Seperate Image Model

2011-08-07 Thread Gmail - neonmark
consider http://code.google.com/p/django-photologue/ On 8/7/2011 11:33 PM, Josh wrote: I'm only working a few weeks with Django and I want some advice about handling images.  Conceptual I have to remind myself that Django i

Re: Seperate Image Model

2011-08-07 Thread Gmail - neonmark
Perhaps one of these: http://schbank.wordpress.com/2010/09/28/django-application-a-simple-gallery/ http://djangopackages.com/grids/g/gallery/ http://gitorious.org/django-simple-gallery/django-simple-gallery/trees/master On 8/7/2011 11:33 PM, Josh wrote: I

Re: Problem with django book in Forms chapter 7

2011-08-07 Thread Gmail - neonmark
Check the comments on LHS of the Book page. In there is a simple method that works and does not need to remove the middleware. Specifically (as there are loads of comments) Frank Kruchio's comment in the comment section next to this text Try running this locally. Loa

Re: Seperate Image Model

2011-08-07 Thread Josh
The images and creation of thumbnails aren't the problem. I'll look into the 1th and 3rd. I've looked at a lot of image apps that might give a solution to my problem, but none fitted my requirements. I'm not sure how to get the images in the content. There might be no image at all, but also on

Re: Seperate Image Model

2011-08-07 Thread Josh
Maybe I should add I don't want to manually assign the images, but script this as much as possible. It involves 1000s of images. -- 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

Re: how to use "{% url *** %}" in django template file?

2011-08-07 Thread muhdazwa
You can add name to the url in the urlpatterns: urlpatterns = patterns('', url(r'card/create$', 'card.views.create_card', name='card_create_card'), ) and call it in the template: {% url card_create_card %} On Aug 7, 1:05 pm, Jimmy wrote: > Hi, > > I got the error "Caught ImportError while r