using newforms

2008-01-12 Thread ocgstyles
Hi, I using the newforms library to create a form. I need to know who the current user is so I know which values to display in a dropdown control. So I have this so far: from django import newforms as forms class MyForm(forms.Form): GROUP_CHOICES = [] field1 =

lincoln

2008-01-12 Thread Yanni
http://www.lincoln.cba.pl --~--~-~--~~~---~--~~ 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 [EMAIL

Custom ForeignKey field validation

2008-01-12 Thread David Grant
I have a simple category model. They will eventually be chapters in a book and I only want entries to go into child categories, not the roots. Here's the models: class Category(models.Model): name = models.CharField(max_length=120, blank=True) parent = models.ForeignKey('self', null=True,

Re: Middleware for checking client info and many other queries

2008-01-12 Thread Ravi Kumar
thanks UDI, this is waht I needed to some extent. On Jan 9, 2008 3:16 PM, Udi <[EMAIL PROTECTED]> wrote: > > Re: #2 > > I wouldn't worry about it. > http://aspn.activestate.com/ASPN/Mail/Message/python-list/998253 > > Re: #4 > > http://www.djangosnippets.org/snippets/358/ >

Re: using newforms

2008-01-12 Thread shabda
Instead of this def __init__(self, user): profile = user.get_profile() for g in profile.groups.all(): self.GROUP_CHOICES += (g.id, g.name) super(MyForm, self) Should it not be, def __init__(self, user, *args, **kwargs): profile = user.get_profile()

displaying errors after form validation

2008-01-12 Thread cesco
Hi, I'm a bit puzzled by the following behaviour of newforms. I have a field in the form called 'seller'. In the form validation I have a clean_seller method which if a certain condition is verified will do the following: self.errors.update(seller = ErrorList([u"message1: the indicated seller

Working with object paginator

2008-01-12 Thread shabda
Ove of my view function is, def recently_featured (request): featured = FeaturedPage.objects.all().order_by('-ordering') paged_featured = ObjectPaginator(featured, djikikisettings.details_per_page) try: page_num = request.GET['page'] page_num = int(page_num) except:

Re: Manually Inserting Non Field Errors in a newform

2008-01-12 Thread shabda
Override __init__ for the Form, passing it the request object and store it. Access it in .clean method. On Jan 12, 10:45 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I also just realized that the reason clean() wouldn't work when I > tried to pass it the request as an argument is simply

Integrating TinyMCE in django.contrib.flatpages

2008-01-12 Thread Christoph Egger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hi I'm trying to use TinyMCE within flatpages. I followed the instructions given on code.djangoproject.com http://code.djangoproject.com/wiki/AddWYSIWYGEditor but TinyMCE won't show up (Tested with Opera + Konqueror + Iceweasel(Firefox)).

Inserting a date into DateField

2008-01-12 Thread Darthmahon
Hi, I'm trying to insert a simple date (2002-01-12) from a form I have created into a DateField but I keep getting this error: 'str' object has no attribute 'strftime' This is how the DateField is setup in my models.py file: birthday = models.DateField(blank=True) This is how I am trying to

Re: Inserting a date into DateField

2008-01-12 Thread l5x
On Jan 12, 1:49 pm, Darthmahon <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to insert a simple date (2002-01-12) from a form I have > created into a DateField but I keep getting this error: > > 'str' object has no attribute 'strftime' > > This is how the DateField is setup in my models.py

Re: Inserting a date into DateField

2008-01-12 Thread shabda
_dob = request.POST['dob'] gets the string representation of dob, and so python complains as it can't find the strftime method. You need to change your code to, _dob = form_name.cleaned_data['date_attribute_name'] form.cleaned_data, gets you the canonical representation for the data type

Re: Inserting a date into DateField

2008-01-12 Thread Darthmahon
Hmm ok, so there is no easy way to do this without using newforms? On Jan 12, 12:56 pm, shabda <[EMAIL PROTECTED]> wrote: > _dob = request.POST['dob']  gets the string representation of dob, and > so python complains as it can't find the strftime method. > You need to change your code to, > _dob

Media path when sharing virtual host for two projects

2008-01-12 Thread Marc Garcia
Hi! I've many Django projects that doesn't have any relation. In production I use different domains, so I have different virtual hosts for them, and everything is ok. In development I want to have just one domain, and access all my projects from it. Something like:

Re: using newforms

2008-01-12 Thread Kenneth Gonsalves
On 12-Jan-08, at 2:48 PM, ocgstyles wrote: > def __init__(self, user): you need a super line here > profile = user.get_profile() -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common man: http://registration.fossconf.in/web/

Re: WSGI session

2008-01-12 Thread Karen Tracey
On Jan 12, 2008 2:47 AM, kbochert <[EMAIL PROTECTED]> wrote: > > mod_fastcgi installation > > The error is: > 'WSGIRequest' object has no attribute 'session' > > any ideas? > Do you have 'django.contrib.sessions.middleware.SessionMiddleware' listed in MIDDLEWARE_CLASSES in settings.py? If I add

Re: Custom ForeignKey field validation

2008-01-12 Thread Karen Tracey
On Jan 12, 2008 5:28 AM, David Grant <[EMAIL PROTECTED]> wrote: > I have a simple category model. They will eventually be chapters in a book > and I only want entries to go into child categories, not the roots. Here's > the models: > > class Category(models.Model): > name = models.CharField

Re: displaying errors after form validation

2008-01-12 Thread Karen Tracey
On Jan 12, 2008 6:26 AM, cesco <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm a bit puzzled by the following behaviour of newforms. > > I have a field in the form called 'seller'. > > In the form validation I have a clean_seller method which if a certain > condition is verified will do the following:

How to see if current item is in a list

2008-01-12 Thread Darthmahon
Hey, I want to check if the current item I am printing in one list is also available in another list. Basically I have a list of books and I want to check if the user already has a particular book in their profile so that instead of it saying "Add Book", it says "Remove Book". At the moment I

Re: using newforms

2008-01-12 Thread ocgstyles
Great. That works. Only problem now, though, is that GROUP_CHOICES is still [] after the object is instantiated. From a shell I can do this: f = ReferralForm(User.objects.get(username='keith')) f.fields['field1'].choices = f.GROUP_CHOICES And that will populate the field with the right data.

Re: How to see if current item is in a list

2008-01-12 Thread Karen Tracey
On Jan 12, 2008 10:59 AM, Darthmahon <[EMAIL PROTECTED]> wrote: > > Hey, > > I want to check if the current item I am printing in one list is also > available in another list. Basically I have a list of books and I want > to check if the user already has a particular book in their profile so >

remove ^M: project moved from window to linux

2008-01-12 Thread crybaby
What is the fastest way to remove ^M from every files in main project folder and apps folders. Doing it by hand seems time consuming. Is there a simple script take care of this? if I just leave the ^M in python code, would it cause problems?

Re: remove ^M: project moved from window to linux

2008-01-12 Thread Lars Stavholm
crybaby wrote: > What is the fastest way to remove ^M from every files in main project > folder and apps folders. Doing it by hand seems time consuming. Is > there a simple script take care of this? if I just leave the ^M in > python code, would it cause problems? If you're on a Linux box

Re: How to see if current item is in a list

2008-01-12 Thread Darthmahon
Doh! Yup I forgot that...cheers! :) On Jan 12, 4:17 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Jan 12, 2008 10:59 AM, Darthmahon <[EMAIL PROTECTED]> wrote: > > > > > > > Hey, > > > I want to check if the current item I am printing in one list is also > > available in another list.

Re: remove ^M: project moved from window to linux

2008-01-12 Thread Brett Parker
On 12 Jan 17:47, Lars Stavholm wrote: > > crybaby wrote: > > What is the fastest way to remove ^M from every files in main project > > folder and apps folders. Doing it by hand seems time consuming. Is > > there a simple script take care of this? if I just leave the ^M in > > python code,

Re: using newforms

2008-01-12 Thread ocgstyles
Figured it out. Just like Kenneth said above, I need a super line where he said. I was also appending the values incorrectly. It should have been GROUP_CHOICES += ((g.id, g.name),) Thanks for the help everyone. On Jan 12, 11:14 am, ocgstyles <[EMAIL PROTECTED]> wrote: > Great. That works.

Why the default Django transaction way doesn't work?

2008-01-12 Thread pength
At first, I tried to search in this group, but only got an un-answered question similar to mine: http://groups.google.com/group/django-users/browse_thread/thread/767716b62a244b33/85b8203990407a6c?lnk=gst=transaction+default#85b8203990407a6c in my settings.py, i am using TransactionMiddleware.

Model validation basics

2008-01-12 Thread Ian J Cottee
I've actually written a couple of basic apps in Django but today I thought I'd play around with doc tests and realised I didn't know as much as I thought I did. This is all done with latest trunk. Let's take a model definition that has just the following: class PartType(models.Model):

Re: WSGI session

2008-01-12 Thread kbochert
I talked to the host and they said it was 'scripting-related' and they couldn't help. In desperation, I installed lighttpd, and with their debug mode, and the ability to reconfigure at will, I had it running in 3 hrs! Conclusion: if the host doesn't know how to set up apache for django/ fastcgi,

Re: URL Method

2008-01-12 Thread [EMAIL PROTECTED]
This is a fairly recent addition to the development trunk, it allows for named URL patterns. It is explained in detail at http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns In terms of whether you should start writing your url expressions like that, it's up to you. If

Re: Model validation basics

2008-01-12 Thread Karen Tracey
On Jan 12, 2008 1:17 PM, Ian J Cottee <[EMAIL PROTECTED]> wrote: > > I've actually written a couple of basic apps in Django but today I > thought I'd play around with doc tests and realised I didn't know as > much as I thought I did. This is all done with latest trunk. > > Let's take a model

URL Method

2008-01-12 Thread Chris
HI I was tinkering around with this django app called basic blog (http://code.google.com/p/django-basic-blog/) and I noticed that the author uses a method called URL() to define his URL patterns, views, and template objects. Should I start writing my url expressions like this? Is it a new

Re: Why the default Django transaction way doesn't work?

2008-01-12 Thread Alex Koshelev
Transaction behaviour depends on database backend. What backend do you use and have you setup transaction support for it? On 12 янв, 20:45, pength <[EMAIL PROTECTED]> wrote: > At first, I tried to search in this group, but only got an un-answered > question similar to >

Re: Model validation basics

2008-01-12 Thread zobbo
On Jan 12, 6:36 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > Did you miss the "This is an experimental feature!" note at the top of: > > http://www.djangoproject.com/documentation/models/validation/ > > ? > > Last I recall seeing it mentioned here, model validation is still a work in >

Re: Integrating TinyMCE in django.contrib.flatpages

2008-01-12 Thread Christoph Egger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Christoph Egger wrote: > Hi > > I'm trying to use TinyMCE within flatpages. I followed the instructions > given on code.djangoproject.com > > http://code.djangoproject.com/wiki/AddWYSIWYGEditor > > but TinyMCE won't show up (Tested with Opera +

Django won't create foreign keys

2008-01-12 Thread apramanik
Hi all, I'm trying out the Django development version and have been going through the tutorial, but the models aren't creating foreign keys. When I run 'python manage.py sql polls' I get: BEGIN; CREATE TABLE `polls_poll` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `question`

Re: Django won't create foreign keys

2008-01-12 Thread [EMAIL PROTECTED]
Do manage.py sqlall polls instead, it will show all the sql, not just the tables, On Jan 12, 3:41 pm, apramanik <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying out the Django development version and have been going > through the tutorial, but the models aren't creating foreign keys. > > When

Re: Django won't create foreign keys

2008-01-12 Thread apramanik
Well inserting rows with invalid poll_id's works, until i enter the ALTER TABLE by hand, so the foreign key constraints are definitely not there. Anyways, here's what it outputs: BEGIN; CREATE TABLE `polls_poll` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `question` varchar(200)

user.get_profile() attribute error

2008-01-12 Thread [EMAIL PROTECTED]
I'm trying to catch any exceptions from user.get_profile() during account creation in order to create the profile I create the user, authenticate them, log them in, and then try to get_profile. To start out, the user name is the email and I'm setting the password to a random string newUser =

Re: user.get_profile() attribute error

2008-01-12 Thread Alex Koshelev
Do you create a profile model and set right value in settings.py file? http://www.djangoproject.com/documentation/authentication/#storing-additional-information-about-users And User.get_pofile() does not require logged in user. Note that profile instance per user you must create manually. On 13

Earn 5000 $ Per Month with Gooooooooooooogle

2008-01-12 Thread [EMAIL PROTECTED]
http://www.GetRealCash.com Earn 5000 $ Per Month Earn With Google Easy ways to Earn While Sitting At home http://www.GetRealCash.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: user.get_profile() attribute error

2008-01-12 Thread [EMAIL PROTECTED]
I had the settings.py configured with the wrong Model name. useraccount instead of userprofile. Whoops. Thanks! Though the documentation might be wrong, in that DoesNotExist doesn't seem to be a real exception. ObejctDoesNotExist, as defined in django/ core/exceptions.py, is the correct

Re: user.get_profile() attribute error

2008-01-12 Thread Alex Koshelev
get_profile() uses default profile model manager. So if you profile model is Profile - exception is Profile.DoesNotExist that is subclass of ObjectDoesNotExist On 13 янв, 02:45, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I had the settings.py configured with the wrong Model name. >

Re: Multilingual text in db

2008-01-12 Thread Russell Keith-Magee
On Jan 12, 2008 11:04 PM, Grupo Django <[EMAIL PROTECTED]> wrote: > > IMHO Internationalization is useless if there is no support for > multilingual translations in the database. I've seen different > approaches like Django Multilingual ( > http://code.google.com/p/django-multilingual/ > ) and

صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق

2008-01-12 Thread [EMAIL PROTECTED]
صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق تحميل برامج العاب كومبيوتر اسلاميات دينى كتب افلام اغانى فيديو كليب بلوتوث نغمات فن تعارف شات زواج فضائح فنانين ممثلات نانسى هيفاء روبى مصر الامارات الكويت السعودية لبنان توظيف احلام طبخ اسرة روايات قطر كورة اهلى زمالك ابوتريكة جنس سكس عربى

صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق

2008-01-12 Thread [EMAIL PROTECTED]
صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق تحميل برامج العاب كومبيوتر اسلاميات دينى كتب افلام اغانى فيديو كليب بلوتوث نغمات فن تعارف شات زواج فضائح فنانين ممثلات نانسى هيفاء روبى مصر الامارات الكويت السعودية لبنان توظيف احلام طبخ اسرة روايات قطر كورة اهلى زمالك ابوتريكة جنس سكس عربى

Re: remove ^M: project moved from window to linux

2008-01-12 Thread Kenneth Gonsalves
On 12-Jan-08, at 10:12 PM, crybaby wrote: > What is the fastest way to remove ^M from every files in main project > folder and apps folders. Doing it by hand seems time consuming. Is > there a simple script take care of this? if I just leave the ^M in > python code, would it cause problems?

تحميل برامج العاب كومبيوتر اسلاميات دينى كتب افلام اغانى فيديو كليب بلوتوث نغمات فن تعارف شات زواج فضائح فنانين ممثلات نانسى هيفاء روبى مصر الامارات الكويت السعودية لبنان توظيف احلام طبخ اسرة روايات

2008-01-12 Thread [EMAIL PROTECTED]
تحميل برامج العاب كومبيوتر اسلاميات دينى كتب افلام اغانى فيديو كليب بلوتوث نغمات فن تعارف شات زواج فضائح فنانين ممثلات نانسى هيفاء روبى مصر الامارات الكويت السعودية لبنان توظيف احلام طبخ اسرة روايات قطر كورة اهلى زمالك ابوتريكة جنس سكس عربى صور افلام جنسية مقاطع جوال اغتصاب قصص جنسية نيك سحاق

Re: remove ^M: project moved from window to linux

2008-01-12 Thread ocgstyles
I need to do that often at work when Windows files are moved over to AIX. I just use vi. The key sequence is: :%s/^M// To create the ^M character, press Ctrl+V, then M. I'm not sure what that character is (never bothered to look), but I think may be that extra control character that Windows

Re: ManyToManyField -- help with view?

2008-01-12 Thread matimba
SOLVED my problem - Problem was in TEMPLATE {% for x in department.persons.all %} {% endfor %} [EMAIL PROTECTED] wrote: > I need some help with ManytoManyField > > > Here is simplified version of my models > > > class Person(models.Model): > name = models.CharField(maxlength=20) > >

Re: Why the default Django transaction way doesn't work?

2008-01-12 Thread pength
Thanks for your reply. I am using MySQL 5.0.24, with InnoDB engine. Actually I am not familiar with MySQL settings, but as far as I understand, as when I use the decorator @transaction.commit_on_success, the transaction works well, does that means my database backend has no problem in support