Re: how to use django.db module out of django views?

2007-11-23 Thread [EMAIL PROTECTED]
it is ok, need to import settings On Nov 23, 3:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > i have file named dump.py at the root folder of django project,i want > to connect database using django settings.py, so here is my code: > > from django.db import connection, transaction > curs

Re: newforms - How to add class attribute for the text field.

2007-11-23 Thread Nicholas Ding
oh, i see: forms.CharField(widget=forms.TextInput(attrs={'class':'special'})) Thanks! On 11/23/07, James Bennett <[EMAIL PROTECTED]> wrote: > > > On 11/23/07, Nicholas Ding <[EMAIL PROTECTED]> wrote: > > Any ideas? > > http://www.djangoproject.com/documentation/newforms/#widgets > > > -- > "Burea

dynamic translation depending on request parameter

2007-11-23 Thread mike
I need to load different translations in one site. Exact language for translations is the same, but there are differences between messages. Structure of locale looks like that: ./locale |-- en | `-- LC_MESSAGES | |-- django.mo | |-- django.po | `-- django.po~ |-- en_gb_rentals

Re: newforms - How to add class attribute for the text field.

2007-11-23 Thread James Bennett
On 11/23/07, Nicholas Ding <[EMAIL PROTECTED]> wrote: > Any ideas? http://www.djangoproject.com/documentation/newforms/#widgets -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message beca

*******Free sex and vids. downloads********

2007-11-23 Thread pujz
***Free sex and vids. downloads http://Earnfre.blogspot.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 unsu

Imitating "edit_inline" in a view

2007-11-23 Thread James Mulholland
This question is related to this one I asked a couple of months ago: http://decenturl.com/groups.google/djangomultipleforms I'd like to use something similar to the "edit_inline" option, but in a view. My test models look like this: class Person(models.Model): person_name = models.CharField

INTERNAL_IPS and netmask/CIDR notation

2007-11-23 Thread Tim Chase
I don't know whether this would be better done by replacing the INTERNAL_IPS functionality, or adding a second similar means, but for my app, it's helpful to know if the user is "internal" or "external" as defined by several netmasks/CIDR addresses. Rather than adding every address in the network

Fixture "Duplicate entry" strange problem

2007-11-23 Thread Nadia
Hi, I am running django svn, and have created a fixture called initial_data.json, it was working just fine. Lately I added a new model, after the new model addition every time I run syncdb I get this error: Problem installing fixture 'initial_data.json': (1062, "Duplicate entry 'pw-application' f

Win XP Installation

2007-11-23 Thread dineshv
Hi! Django 0.96.1 doesn't install on my XP machine. Here is what happens when the setup.py file is run: C:\Python25\Django-0.96.1>setup.py install running install running build running build_py error: package directory '\django' does not exist I also tried by moving the tarred/unzipped file t

Re: Django's doctest clashes with coverage.py

2007-11-23 Thread Russell Keith-Magee
On 11/23/07, Marcin Kaszynski <[EMAIL PROTECTED]> wrote: > > Hi, > > I tried to file this as a ticket, but trac kept rejecting it as spam > even after I removed all the links and changed contents. I'm posting > it here because others might find it useful too. Have you tried creating a login: ht

My Oops ! Video..

2007-11-23 Thread Gianny
Hi!! Oops video! http://www.mactanque.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 e

Cuztomizing the admin interface.

2007-11-23 Thread Shriphani
Hello all, I am just starting out with django and I have stuck a roadblock on this web app I am trying to create. I want to have something like this: The cast of this play: "Shane" as "Jeremy" ## I want to place two input boxes in my admin interface as follows: as Can someone tell me how I ca

Re: Win XP Installation

2007-11-23 Thread dineshv
Okay, found the problem. It should say: C: \Python25\Django-0.96.1>python setup.py install Btw, the instruction at point 4. for Windows at http://www.djangoproject.com/documentation/install/ is incorrect. Dinesh On Nov 23, 5:23 pm, dineshv <[EMAIL PROTECTED]> wrote: > Hi! Django 0.96.1 doesn

Re: Passing the max_length from the Model into the Form

2007-11-23 Thread Mark Green
On Fri, 2007-11-23 at 14:59 -0800, leotr wrote: > Yes, not only it's dirty but it's ineffective as well! And your idea violates DRY. > Declare a constant somewhere and use it in both model and form. And where would that "somewhere" be? Custom constants on the model? I see no point in adding in

csrfmiddleware problem

2007-11-23 Thread [EMAIL PROTECTED]
I have a problem with the csrfmiddleware - I'm trying to put up a form to edit django templates, and if the template being edited has a element the csrf thing inserts itself into the form input. I'm wondering if there is a way to disable it for part of a page. --~--~-~--~~

Re: Passing the max_length from the Model into the Form

2007-11-23 Thread leotr
Yes, not only it's dirty but it's ineffective as well! Declare a constant somewhere and use it in both model and form. max_link_url_len = 80 class Link(models.Model): url = bla_bla_field(max_length = max_link_url_len) class myForm(forms.Form): url = forms.URLField( max_length=m

Re: Cuztomizing the admin interface.

2007-11-23 Thread Kenneth Gonsalves
On 24-Nov-07, at 11:03 AM, Shriphani wrote: > "Shane" as "Jeremy" > ## > > I want to place two input boxes in my admin interface as follows: > as > Can someone tell me how I can achieve this ? you will have to hack admin for this - it is better not to do this as admin is going to change ver

Re: Imitating "edit_inline" in a view

2007-11-23 Thread leotr
Didn't you look at html code which was generated by admin? you will need to generate a form which has such fieldnames: car.. like and then react on post method in view --~--~-~--~~~---~--~~ You received this message because y

Re: ImageField file naming

2007-11-23 Thread Chris Hoeppner
El mar, 20-11-2007 a las 15:41 -0500, Marty Alchin escribió: > On Nov 20, 2007 3:33 PM, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > It would be nice to be able to include this in the upload_to parameter. > > Something like > > 'upload/%(model_name)s/%(instance_id)s.%(mimetype_extension)s' perhap

Re: Detecting Object with Empty Relation Ship

2007-11-23 Thread Empty
I'm not sure I follow you completely, but I think my blog post on the subject of finding lookup items that are not being used may get you going in the right direction. http://blog.michaeltrier.com/2007/8/12/finding-lookup-items-that-are-not-used I hope it helps. Michael On Nov 23, 2007 5:54 AM

New Program Send Big File Fast and Easy Apply For FREE!!!

2007-11-23 Thread peter borman
WHO WE ARE YouSendIt is the No. 1 digital file delivery company serving business and individuals businesses who want a easy, secured, reliable and faster way to SEND, RECEIVE and TRACK DIGITAL FILES. YOUSENDIT SOLUTION We replace the hassles of dealing with unreliable FTP servers, eliminate the fr

Re: INTERNAL_IPS and netmask/CIDR notation

2007-11-23 Thread Jeremy Dunck
On Nov 23, 2007 10:57 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > > Hmm...your code seems to reference an "ipv4" module I don't have > here on either of my Debian boxes, or my Win32 box at work. That > could have been handy to have, rather than trying to reinvent the > wheel. The closest I could

Re: INTERNAL_IPS and netmask/CIDR notation

2007-11-23 Thread Jeremy Dunck
On Nov 23, 2007 10:32 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > > I don't know whether this would be better done by replacing the > INTERNAL_IPS functionality, or adding a second similar means, but > for my app, it's helpful to know if the user is "internal" or > "external" as defined by several

Re: validating fields with newforms - part 2

2007-11-23 Thread Jonathan Buchanan
On Nov 23, 2007 9:42 AM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > On Nov 23, 2007 3:28 PM, James Bennett <[EMAIL PROTECTED]> wrote: > > > > On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > > looks cleaner in my eyes. opinions please! > > > > In my opinion, you're asking for a lo

Re: Custom ManyToManyField widget in admin

2007-11-23 Thread kamil
congrats. interesting solution. Lately I've switched to newforms admin too. On Nov 22, 11:50 am, Julien <[EMAIL PROTECTED]> wrote: > Hi Kamil and all, > > I have finally found what I was looking for by using the branch > newforms-admin. > It could be tidied up a bit, but at least it works! > Hope

Re: validating fields with newforms - part 2

2007-11-23 Thread Todd O'Bryan
How do you clean a field that's supposed to be a date or a number, for example, if the user doesn't provide a legal date or number? If you're not allowed to throw validation errors during cleaning, you could find yourself in a situation where your later cleaning code makes assumptions that aren't

Re: validating fields with newforms - part 2

2007-11-23 Thread James Bennett
On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > looks cleaner in my eyes. opinions please! In my opinion, you're asking for a lot of custom behavior from a default field type, and the fact that you have to do some custom coding to support that custom behavior is not a bug ;) -- "Bu

Django's doctest clashes with coverage.py

2007-11-23 Thread Marcin Kaszynski
Hi, I tried to file this as a ticket, but trac kept rejecting it as spam even after I removed all the links and changed contents. I'm posting it here because others might find it useful too. When you use coverage.py in "manage.py test" it incorrectly reports some statements as not executed. Th

Foreign keys with null=True and QuerySet.exclude

2007-11-23 Thread Andrew McMurry
I have models something like this: class Attribute (Model): name = CharField(maxlength=32) private = BooleanField(default=False) class Object (Model): ... attr = ForeignKey(Attribute, null=True, blank=True) now I want to exclude Objects containing a private Attri

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
this has two drawbacks: 1) the URL is validated in the "wrong" place (in clean() instead of clean_url()) 2) the error, if one occurs, is not assigned to the errors['url'] but errors['__all__'] fixing 2) would also be hackish imho wolfram On Nov 23, 2007 2:28 PM, Matthias Kestenholz <[EMAIL P

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
On Nov 23, 2007 2:41 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote: > > > On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote: > > :-) yep we also discussed that here > > still it seems "wrong" that it needs to be done with such a hacky way around > > > > I don't think that's hacky at al

Re: validating fields with newforms - part 2

2007-11-23 Thread Matthias Kestenholz
On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote: > :-) yep we also discussed that here > still it seems "wrong" that it needs to be done with such a hacky way around > I don't think that's hacky at all, really. If you want an URLField, you get a field that guarantees that it really co

Re: validating fields with newforms - part 2

2007-11-23 Thread Manakel
Maybe you can remove the logic from the Field cleanMethod and add it to the Form CleanMethod. because i understand you want a validation based on the content of several fields ? I would try something like this: - in Field "clean" method: validate data nature ie mail address is really a mail adres

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
this is what i currently have to do :( if the clean_() function would get all the form-data that would no be necessary!! def __init__(self, *args, **kwargs): data = len(args) and args[0] or kwargs['data'] # Copy the data first, so we can modify them, copied = dict([(k,

Forms and .META

2007-11-23 Thread Matt Davies
Hello everyone I've got a views.py in my forms application that emails form data off to another department. It's a bookign form for events that appears on the events details page. www.bongo.com/events/EVENTSLUG The form is displayed in a template and is on our web site, works a treat. I've als

Oracle usage

2007-11-23 Thread anthony
Hi, I am trying to setup a django v0.96 with oracle 10g but keep getting this error: cx_Oracle.DatabaseError: ORA-00911: invalid character Would like to ask here... which version or branch of django should I use to get oracle working fine. --~--~-~--~~~---~--~

Re: Custom model validator

2007-11-23 Thread BitBlazer
Then what is the use of specifying callback in `validator_list`? Also, what can I do to make the above custom validator work? I am using form but don't know what to do to invoke the validator. On Nov 23, 2:56 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 11/23/07, Bit Blazer <[EMAIL PROTEC

Re: Custom model validator

2007-11-23 Thread James Bennett
On 11/23/07, Bit Blazer <[EMAIL PROTECTED]> wrote: > When I am trying to test this model from shell, it's just saving the > data without any error messages when it is invalid. I don't know whats > wrong in the code above. Any suggestions how can I fix this? Validation is not (at the moment) perfo

Custom model validator

2007-11-23 Thread Bit Blazer
Hi, I have created a generic model class with a custom field validator to which I have defined in the model as: class MyModel(models.Model): snum = models.CharField(max_length=5, validator_list=[is_valid_snum]) The function `is_valid_snum` has been defined as a global function outside class

I have been banned from this group. Why?

2007-11-23 Thread Jantawan Piyawat
Hello, My name is Thawatchai Piyawat, a programmer from Thailand that uses Django to create LightLex.com. I just found out that I have been banned from this group. I believe there must be some misunderstandings, or something might be wrong. Please advice. Thank you, Thawatchai PS: I use my wi

www.200836.com---2008beijing Olympic games---anyone,anywhere,whenver can buy Olympic souvenirs

2007-11-23 Thread allen
The website www.200836.com was aimed at that all the people in the world can buy Olympic souvenirs anywhere anytime The website www.200836.com was exclusively authorized by BOCOG to sell licensed products of the Beijing Olympics if you want to know any information about 2008 beijing Olympic games

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
On Nov 23, 2007 3:29 PM, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > How do you clean a field that's supposed to be a date or a number, for > example, if the user doesn't provide a legal date or number? If you're > not allowed to throw validation errors during cleaning, you could find > yourself i

Re: validating fields with newforms - part 2

2007-11-23 Thread Matthias Kestenholz
On Fri, 2007-11-23 at 14:45 +0100, Wolfram Kriesing wrote: > On Nov 23, 2007 2:41 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote: > > > > > > On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote: > > > :-) yep we also discussed that here > > > still it seems "wrong" that it needs to be do

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
But the problem is that the clean() method of the field already throws a validationError, though i actually dont need to validate this field. And that method simply comes first, no way around using the various clean methods :-( wolfram On Nov 23, 2007 2:32 PM, Manakel <[EMAIL PROTECTED]> wrote:

Re: validating fields with newforms - part 2

2007-11-23 Thread Matthias Kestenholz
Hi Wolfram, On Fri, 2007-11-23 at 14:05 +0100, Wolfram Kriesing wrote: > I got an alike problem, I ran through the docs, mailing lists, etc. > but no solution. > > I got: > > class LinkForm(forms.Form): > TYPE_CHOICES = ( > ('user', _('User link')), > ('url', _('Web link')),

validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
I got an alike problem, I ran through the docs, mailing lists, etc. but no solution. I got: class LinkForm(forms.Form): TYPE_CHOICES = ( ('user', _('User link')), ('url', _('Web link')), ) type = forms.ChoiceField(choices=TYPE_CHOICES) user = forms.IntegerField(re

Re: I have been banned from this group. Why?

2007-11-23 Thread Kenneth Gonsalves
On 24-Nov-07, at 11:34 AM, Jantawan Piyawat wrote: > I believe there must be some misunderstandings, or something might be > wrong. Please advice. was your mailbox bouncing mail? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common man: ht

Detecting Object with Empty Relation Ship

2007-11-23 Thread Manakel
Hello Dear All, I have the following models A --is linked via A-LINKS-- to B --is linked via B-LINKS to C. where A,B,C are models (ie Requirement, Test,Defect) and A-LINKS is a N-N relationship between A & B using a third party object. (intermediate table) and B-LINKS is a N-N relationship betw

Re: Oracle usage

2007-11-23 Thread Ben Ford
Some of the more oracle oriented people on the list will be able to give you an answer with more depth, however: there was a branch (and a sprint) solely given to improving oracle support. This is now merged into trunk, so it may be worth your while upgrading! Ben On 23/11/2007, anthony <[EMAIL PR

Re: Forms and .META

2007-11-23 Thread Christian Joergensen
Matt Davies wrote: > Hello everyone > > I've got a views.py in my forms application that emails form data off to > another department. > > It's a bookign form for events that appears on the events details page. > > www.bongo.com/events/EVENTSLUG > > The form is displayed in a template and is o

Passing the max_length from the Model into the Form

2007-11-23 Thread Wolfram Kriesing
What I am doing currently is: class myForm(forms.Form): url = forms.URLField( max_length=Link._meta.get_field('url').maxlength ) is this really the django-way to pass the maxlength into the form, when i build the form by hand? looks pretty dirty -- cu Wolfram --~--~-~--~-

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
:-) yep we also discussed that here still it seems "wrong" that it needs to be done with such a hacky way around wolfram On Nov 23, 2007 2:28 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote: > > Hi Wolfram, > > > On Fri, 2007-11-23 at 14:05 +0100, Wolfram Kriesing wrote: > > I got an alike pro

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
We discussed this here again, and it looks like newforms currently mixes cleaning and validating data in a not so ideal way. Actually the clean and validation process should be separated, there should be clean-methods and validate-methods. The process should work in the following way, to allow fu

Re: I have been banned from this group. Why?

2007-11-23 Thread Jantawan Piyawat
I just see that all 'digest' mails from django-users go to 'spam' in my Gmail account. That may be the reason. FYI, I never send an email to this group ever! I just read (via search) the conversations. BTW: my Gmail account is 'thawatchai' Thanks, Thawatchai On Nov 24, 1:04 pm, Jantawan Piya

Re: Foreign keys with null=True and QuerySet.exclude

2007-11-23 Thread Michael Radziej
On Fri, Nov 23, Andrew McMurry wrote: > > I have models something like this: > > class Attribute (Model): > name = CharField(maxlength=32) > private = BooleanField(default=False) > > class Object (Model): > ... > attr = ForeignKey(Attribute, null=True, blank=True) > >

Re: validating fields with newforms - part 2

2007-11-23 Thread Wolfram Kriesing
On Nov 23, 2007 3:28 PM, James Bennett <[EMAIL PROTECTED]> wrote: > > On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > looks cleaner in my eyes. opinions please! > > In my opinion, you're asking for a lot of custom behavior from a > default field type, and the fact that you have to do

Re: INTERNAL_IPS and netmask/CIDR notation

2007-11-23 Thread Tim Chase
>> I don't know whether this would be better done by replacing the >> INTERNAL_IPS functionality, or adding a second similar means, but >> for my app, it's helpful to know if the user is "internal" or >> "external" as defined by several netmasks/CIDR addresses. Rather >> than adding every address

Re: I have been banned from this group. Why?

2007-11-23 Thread Kenneth Gonsalves
On 24-Nov-07, at 11:48 AM, Jantawan Piyawat wrote: > I just see that all 'digest' mails from django-users go to 'spam' in > my Gmail account. That may be the reason. if you brand us as 'spam' - why blame us for reciprocating ;-) -- regards kg http://lawgon.livejournal.com http://nrcfosshelpl

Re: Passing the max_length from the Model into the Form

2007-11-23 Thread Wolfram Kriesing
really good idea. I will add constants to the model-classes and refer to them via the model.FIELD_MAX_LENGTH thx Wolfram On Nov 23, 2007 11:59 PM, leotr <[EMAIL PROTECTED]> wrote: > > Yes, not only it's dirty but it's ineffective as well! > > Declare a constant somewhere and use it in bot

Re: I have been banned from this group. Why?

2007-11-23 Thread Jantawan Piyawat
I don't flag the mails myself. The too-smart Gmail has done it for me (without my consent, obviously). I've just found this out a minute ago. That's why I've never seen an email from this group in my inbox. Thawatchai On Nov 24, 1:25 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 24-Nov-

complex query in limit_choices_to

2007-11-23 Thread Kenneth Gonsalves
hi, I have two models called Child and Sponsor. There is a model called Sponsorship which has foreign keys to Child and Sponsor. For the foreign key to Child, I want to limit choices to all those children who are *not* already a foreign key to sponsorship and who are active. This is the q