Re: bug in rendering non ascii characters in admin changelist

2007-10-14 Thread Malcolm Tredinnick

On Mon, 2007-10-15 at 00:10 -0500, Jeremy Dunck wrote:
> On 10/14/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> ...
> > class Sponsorship(models.Model):
> >  """ links child to sponsor, startdate enddate and comments"""
> >  sponsor = models.ForeignKey(Sponsor,verbose_name=_("Sponsor"))
> >  child = models.ForeignKey(Child,verbose_name=_("Child"))
> >  class Admin:
> >  pass
> >  def __unicode__(self):
> >  return "%s: %s" %(self.sponsor,self.child)
> 
> Maybe I'm silly, but shouldn't this:
>   def __unicode__(self):
>   return "%s: %s" %(self.sponsor,self.child)
> 
> be more like this:
>   def __unicode__(self):
>   return u"%s: %s" %(self.sponsor,self.child)

Technically, yes, but in practice it probably doesn't matter (although
it might be disguising some other problem). There are two things going
on here that usually save the day in this case.

Firstly, the result of '%s' % foo will be a unicode object if 'foo' is a
unicode object (but not necessarily if it is coercable to unicode -- if
it is also coercable to str, the result will be a str object). Your
preferred method -- u'%s' % foo -- forces things to unicode a bit more
directly and is a little safer in general, so a good habit to get into.

Secondly, no matter what you try to return from __unicode__, Python will
always force the result (at the C library level) into a unicode object.
So return 'apple' from __unicode__ will actuall result in u'apple'. This
usually isn't a problem and is actually the right thing. If the forcing
to a unicode object can't happen (because, say, you're trying to return
a dictionary), an TypeError is raised.

It's worth noting that this coercion does become a real problem when you
try to do the same from __str__ (Python will similarly force the result
to a str at the C level) and return a unicode object from __str__.
That's a common source of bugs. However, in the __unicode__ case, it
will result in corrupted displays, rather than encoding problems, as a
rule.

So, in the rare case where, say, self.sponsor is a UTF-8 string,
Kenneth's version might lead to trouble down the track -- but I would
have thought that trouble would be mis-displayed strings, rather than a
crash.

Still, it would be worth checking that self.sponsor and self.child
really are Unicode strings (and not bytestrings) in the case where a
crash occurs, Kenneth. Or at least working out what they *are* when the
crash occurs.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: bug in rendering non ascii characters in admin changelist

2007-10-14 Thread Jeremy Dunck

On 10/14/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
...
> class Sponsorship(models.Model):
>  """ links child to sponsor, startdate enddate and comments"""
>  sponsor = models.ForeignKey(Sponsor,verbose_name=_("Sponsor"))
>  child = models.ForeignKey(Child,verbose_name=_("Child"))
>  class Admin:
>  pass
>  def __unicode__(self):
>  return "%s: %s" %(self.sponsor,self.child)

Maybe I'm silly, but shouldn't this:
  def __unicode__(self):
  return "%s: %s" %(self.sponsor,self.child)

be more like this:
  def __unicode__(self):
  return u"%s: %s" %(self.sponsor,self.child)

(Taking care to use encoding declaration for the source file, of course...)

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: bug in rendering non ascii characters in admin changelist

2007-10-14 Thread Kenneth Gonsalves


On 08-Oct-07, at 7:36 AM, Malcolm Tredinnick wrote:

>> name = CharField of some some length and have
>> __unicode__() = "%s"  %(self.name)
>>
>> in admin enter a finnish word with special characters like: Asikainen
>> Päivi ja Jorma. On saving, or after saving, on trying to edit the
>> word I get this error:
>
> Using this exact example and the test text you give, I cannot repeat
> this error using either [6365] or current head ([6463]) with sqlite
> (python2.3, 2.4 or 2.5), mysql or postgresql  -- python 2.5, only, in
> both cases, since I'm not set up to test other Python versions with
> those database on my laptop.

I have now managed to replicate the error using latest django svn,  
python2.5 and postgres8.x. The postgres database is unicode. The test  
models.py is given as under. In the 'name' field for sponsor, enter  
something in finnish like 'jöökeän'. Then try to enter a sponsorship.  
For me this crashes when adding a sponsorship with unicode error. (to  
get finnish non-ascii characters, set the keyboard to finnish and  
type ''' or ';' (single quote or semi-colon)

from django.db import models

# Create your models here.

class Child(models.Model):
 code = models.IntegerField(_("Child Code Number"), unique=True)
 name = models.CharField(_("Child Name"),maxlength=80)
 class Admin:
 pass
 def __unicode__(self):
 return "%s: %s" %(self.code,self.name)

class Sponsor(models.Model):
 code = models.IntegerField(_("Sponsor Code Number"), unique=True)
 name = models.CharField(_("Sponsor Name"),maxlength=80)
 class Admin:
 pass
 def __unicode__(self):
 return "%s: %s" %(self.code,self.name)

class Sponsorship(models.Model):
 """ links child to sponsor, startdate enddate and comments"""
 sponsor = models.ForeignKey(Sponsor,verbose_name=_("Sponsor"))
 child = models.ForeignKey(Child,verbose_name=_("Child"))
 class Admin:
 pass
 def __unicode__(self):
 return "%s: %s" %(self.sponsor,self.child)


-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Greg

Malcolm,
I got it working.  Here it is:

if request['b_state'] == 'KS':
if request['seen_updates'] == '0':
a = theamount(request, 1.06)
data = request.POST.copy()
data['seen_updates'] = 1
f = ContactForm(data)
return render_to_response('checkout_form.htm', {'fo':
f, 'o': request.session['cart'], 'p': a, 'isitks': True})



Thanks for the help!

On Oct 14, 9:02 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-10-14 at 18:32 -0700, Greg wrote:
> > Malcolm,
> > I think I'm finally starting to get somewhere with this.  I assigned
> > my hidden field the initial 0 value
>
> > seen_updates = forms.IntegerField(widget=forms.HiddenInput, initial=0)
>
> > I was thinking that I could just do the following
> > 'request['seen_updates'] = '1'' in my view and just resend
> > ContactForm(request.POST).  However, I guess I can't assign a value to
> > a POST element.
>
> This is true. Quoting 
> fromhttp://www.djangoproject.com/documentation/request_response/#attributes:
>
> "All attributes except session should be considered read-only."
>
> (for an HttpRequest instance).
>
> >   So does that mean I need to create a data field that
> > populates my entire form again
>
> > data = {'seen_updates': 1'',
> > ... 'b_name': request['b_name'],
> > ... 'b_address': request['b_address'],
> > ... 'b_city': request['b_city']
> >  etc}
>
> data = request.POST.copy() is simpler. Then you can alter 'data' as it's
> just a dictionary (well, it's actually a QueryDict, as documented 
> athttp://www.djangoproject.com/documentation/request_response/#querydic...but 
> the difference is mostly academic for most uses).
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to find out if a string is contained within another string

2007-10-14 Thread Greg

Hello,
I'm wanting to select a record from my Discounter class that contains
a certain string from another string.  My Discounter class looks like
this:

class Discounter(models.Model):
code = models.CharField(maxlength=100)

In my view I get a variable called 'message'.  I want to search
through all my Discounter records and get the record (if any) that's
code field is within my message string.

For example let's say that that I have a Discounter record who's code
value is '123'.  And let's say that our 'message' variable contains
the string 'This is a test 123 This is a test'.  I would then want the
Discounter record whose code is '123' to be returned.  However I'm not
sure how to do this.  Here is my QuerySet:

Discounter.objects.get(code__####=message)

Using the contains or exact filters do not work, because my code
variable is not going to contain the entire message contents.  How do
i find out if my code string is within my message string?

I'm thinking that I might have to create a for loop, which loops
through every Discounter record and checks to see if the 'code'
variable is in the 'message variable.


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NoReverseMatch error

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 19:45 -0700, ashok.raavi wrote:
> Any body got this NoReverseMatch problem fixed?. If so please point me
> to that.

Which problem would that be? You have provided no context at all for
your question.

We are helpful people, but not mind readers.

Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



NoReverseMatch error

2007-10-14 Thread ashok.raavi

Any body got this NoReverseMatch problem fixed?. If so please point me
to that.

The patch over here 
http://code.djangoproject.com/attachment/ticket/4409/4409.patch
is also not working for me .

I am using the latest trunk from django repository.


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 18:32 -0700, Greg wrote:
> Malcolm,
> I think I'm finally starting to get somewhere with this.  I assigned
> my hidden field the initial 0 value
> 
> seen_updates = forms.IntegerField(widget=forms.HiddenInput, initial=0)
> 
> I was thinking that I could just do the following
> 'request['seen_updates'] = '1'' in my view and just resend
> ContactForm(request.POST).  However, I guess I can't assign a value to
> a POST element.

This is true. Quoting from
http://www.djangoproject.com/documentation/request_response/#attributes :

"All attributes except session should be considered read-only."

(for an HttpRequest instance).


>   So does that mean I need to create a data field that
> populates my entire form again
> 
> data = {'seen_updates': 1'',
> ... 'b_name': request['b_name'],
> ... 'b_address': request['b_address'],
> ... 'b_city': request['b_city']
>  etc}

data = request.POST.copy() is simpler. Then you can alter 'data' as it's
just a dictionary (well, it's actually a QueryDict, as documented at
http://www.djangoproject.com/documentation/request_response/#querydict-objects 
but the difference is mostly academic for most uses).

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Greg

Malcolm,
I think I'm finally starting to get somewhere with this.  I assigned
my hidden field the initial 0 value

seen_updates = forms.IntegerField(widget=forms.HiddenInput, initial=0)

I was thinking that I could just do the following
'request['seen_updates'] = '1'' in my view and just resend
ContactForm(request.POST).  However, I guess I can't assign a value to
a POST element.  So does that mean I need to create a data field that
populates my entire form again

data = {'seen_updates': 1'',
... 'b_name': request['b_name'],
... 'b_address': request['b_address'],
... 'b_city': request['b_city']
 etc}
f = ContactForm(data)
return render_to_response('checkout_form.htm', {'fo': f})

Thanks



On Oct 14, 7:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-10-14 at 17:35 -0700, Greg wrote:
> > Malcolm,
> > I've created a new form field:
>
> > seen_updates = forms.IntegerField(widget=forms.HiddenInput)
>
> > I've added the form field to my checkout page:
>
> > 
> >   {{ fo.seen_updates }}
>
> > How do I assign it a value of 0 for when the sales tax has not been
> > shown, and a 1 for when the sales tax message has been shown?
>
> You spend a bit of time reading the documentation, since a lot of these
> questions are answered there. In this case, if you're wondering how to
> assign an initial value to a field when rendering the form, you look in
> the newforms documentation and you see the section called "core field
> arguments" with a subheading of
> "initial" 
> (http://www.djangoproject.com/documentation/newforms/#core-field-argum...). 
> Looks like exactly what you want.
>
> Since the hidden value will be zero unless you have just processed their
> first submission, you can set it to zero initially and then, in the view
> that processes the form POST, set it to 1 before writing out the form
> the second time around.
>
> Spend a few minutes experimenting with this stuff. It's fairly well
> documented and the source isn't that hard to understand (and is well
> commented) if you need to look in there.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Urgent requirement for architect job

2007-10-14 Thread Kenneth Gonsalves


On 14-Oct-07, at 3:43 PM, Dan Filip wrote:

> WHY DOESN'T ANYONE BLOCK THESE STUPID ADS???

dont *do* this - you are just increasing the spam. Trust the list  
admins.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 17:35 -0700, Greg wrote:
> Malcolm,
> I've created a new form field:
> 
> seen_updates = forms.IntegerField(widget=forms.HiddenInput)
> 
> I've added the form field to my checkout page:
> 
> 
>   {{ fo.seen_updates }}
> 
> How do I assign it a value of 0 for when the sales tax has not been
> shown, and a 1 for when the sales tax message has been shown?

You spend a bit of time reading the documentation, since a lot of these
questions are answered there. In this case, if you're wondering how to
assign an initial value to a field when rendering the form, you look in
the newforms documentation and you see the section called "core field
arguments" with a subheading of
"initial" 
(http://www.djangoproject.com/documentation/newforms/#core-field-arguments ). 
Looks like exactly what you want.

Since the hidden value will be zero unless you have just processed their
first submission, you can set it to zero initially and then, in the view
that processes the form POST, set it to 1 before writing out the form
the second time around.

Spend a few minutes experimenting with this stuff. It's fairly well
documented and the source isn't that hard to understand (and is well
commented) if you need to look in there.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Object not callable

2007-10-14 Thread Cat

Hi Malcolm

Thanks for your reply. I have done a bit of reading/experimentation
since my post and thought what you have said might be the case. I will
have a look at your suggestions.

However, I think I may be on the wrong track. What I want to do is
create a custom form (ie SurveyForm) to both add new records and edit
existing records. I have a save method on Survey (in models.py) which
saves createdBy, createdDate, lastModifiedBy and lastModifiedDate -
these will not be in form. I have been modifiying my code as suggested
in a posting (Newforms practice (common situation) ) but obviously
don't quite understand the entire thing.

Is there a better way of doing this? There seem to be lots of
reference to creating custom forms being easy but I think I am missing
something basic.


Regards

Catriona

On Oct 15, 5:49 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-10-11 at 17:34 -0700, Cat wrote:
> > Hello
>
> > Can anyone tell me why when I get to the line - form =
> > InstanceForm(request.POST) in the following view (stepping through the
> > code), I get a Type Error SurveyForm object is not callable. My
> > understanding is that it should be as it subclasses Form
>
> > def addEditSurvey(request, id = None):
>
> >if id is not None:
> >instance = Survey.objects.get(id=id)
> >InstanceForm = SurveyForm(instance = instance)
> >else:
> >InstanceForm = SurveyForm()
>
> This line (and the similar one two lines earlier) creates an instance of
> the SurveyForm class. So InstanceForm isn't a class object, it's an
> instance of a class.
>
>
>
> >if request.method == 'POST':
> >form = InstanceForm(request.POST)
>
> This line would only make sense if either (a) InstanceForm had a
> __call__ method or (b) InstanceForm was a class object and so had a
> constructor. Neither of these is true. You are writing code as if
> InstanceForm was meant to be a class object -- and that is how the
> Django examples all look -- but it isn't (see above).
>
> If you want to create a class object that is based on things like the
> "instance" parameter, you need to look at Python meta-programming. This
> can be a fairly confusing area (because, by it's very nature, it's very
> abstract). However, for simple cases, it's not too bad. Have a look at
> django.newforms.models.form_for_model() for an example of creating a
> class object based on parametrised input.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 16:24 -0700, Greg wrote:
> Malcolm,
> Can you please show me how I would use hidden fields to let me know
> that the user has seen the updated price?

There's a newforms widget called HiddenInput. So if your form has a
field called, say, "seen_updates", make sure you create it with
widget=HiddenInput. Then the field won't be rendered visibly on the
form, but you'll still get back the value from it when the form is
submitted.

So, on the first presentation of the form, seen_updates might be 0 (if
you're using an integer field for it) and then the second time around,
it will be 1. That way, your form processing code only has to check this
one form variable to see if it needs to represent the form with the
sales tax added.

Does that clear things up a bit?

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Greg

Malcolm,
Can you please show me how I would use hidden fields to let me know
that the user has seen the updated price?

Thanks

On Oct 14, 5:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-10-14 at 15:18 -0700, Greg wrote:
> > Hello,
> > I have a submission form.  When the form gets submitted I need to
> > check to see if the b_state form variable is set to 'KS'. If so, then
> > I need to let the user know that a sales tax will be applied to their
> > order.  If they agree with the price increase then they can select
> > 'Submit' again and the order will be processed.
>
> [... code snipped ...]
>
> > As you can see I have problems.  Is there anyway that I can do this
> > without creating a session variable?  The only reason I have the
> > session variable is to know if the user has already seen the price
> > update.  That is how I know that I can go ahead and process the order.
>
> You're wanting to pass information between two forms. So you have two
> choices: either put the information in the session, or use a hidden
> field (or fields) in the form to pass the information.
>
> The advantage of using hidden fields in the form is that the processing
> flow is fairly uniform. The only thing to watch out for (and it's
> probably a non-issue in this use-case) is that the user can change the
> hidden field's value, so you can't trust the result. For an indicative
> thing, who cares? If the info is important, you'd have to encrypt it on
> before including it so that you can detect tampering.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Should I create a session variable for this?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 15:18 -0700, Greg wrote:
> Hello,
> I have a submission form.  When the form gets submitted I need to
> check to see if the b_state form variable is set to 'KS'. If so, then
> I need to let the user know that a sales tax will be applied to their
> order.  If they agree with the price increase then they can select
> 'Submit' again and the order will be processed.

[... code snipped ...]

> As you can see I have problems.  Is there anyway that I can do this
> without creating a session variable?  The only reason I have the
> session variable is to know if the user has already seen the price
> update.  That is how I know that I can go ahead and process the order.

You're wanting to pass information between two forms. So you have two
choices: either put the information in the session, or use a hidden
field (or fields) in the form to pass the information.

The advantage of using hidden fields in the form is that the processing
flow is fairly uniform. The only thing to watch out for (and it's
probably a non-issue in this use-case) is that the user can change the
hidden field's value, so you can't trust the result. For an indicative
thing, who cares? If the info is important, you'd have to encrypt it on
before including it so that you can detect tampering.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pydev code completion problem

2007-10-14 Thread lmierzej

I guess it all is just not possible in dynamically typed language...

On Oct 14, 3:07 pm, lmierzej <[EMAIL PROTECTED]> wrote:
> hi,
> in models.py I have Poll class...
>
> when in views.py I do:
> poll = Poll()
> then when typing 'poll.' (just after typing '.') I get full and proper
> code completion and that's just great...
>
> but when I have something like this in views.py:
> def poll(request, poll_id):
> poll = get_object_or_404(Poll, pk=poll_id)
> now when typing 'poll.' I get no code completion... :-(
>
> Why is that? In SPE Python IDE both examples work just fine...
> Does anyone use pydev and can check if he get proper code completion
> after using 'get_object_or_404'?
>
> Thank you advance!


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Should I create a session variable for this?

2007-10-14 Thread Greg

Hello,
I have a submission form.  When the form gets submitted I need to
check to see if the b_state form variable is set to 'KS'. If so, then
I need to let the user know that a sales tax will be applied to their
order.  If they agree with the price increase then they can select
'Submit' again and the order will be processed.

I currently have a setup that works...however I'm sure that it's not
the most efficient way of doing it.  So I'm posting my code in hope
that some of you django experts can help me make it better.  Here is
my function that gets called when the checkout page is displayed

def checkout(request):
if request.method == 'POST':
f = ContactForm(request.POST)
a = theamount(request)
if request['b_state'] == 'KS':
if request.session['kansas'] == []:
a = theamount(request, 1.06)
request.session['kansas'].append({'style': "adsf"})
request.session.modified = True
return render_to_response('checkout_form.htm', {'fo':
f, 'o': request.session['cart'], 'p': a, 'isitks': True})
if f.is_valid():
request.session['orderdetails'] = {
 'b_firstname': request['b_firstname'], }
return HttpResponseRedirect('/plush/cart/success')
else:
return render_to_response('checkout_form.htm', {'fo': f,
'o': request.session['cart'], 'p': theamount(request)})
else:
f = ContactForm(auto_id='%s')
return render_to_response('checkout_form.htm', {'fo': f, 'o':
request.session['cart'], 'p': theamount(request)})

/

As you can see I have problems.  Is there anyway that I can do this
without creating a session variable?  The only reason I have the
session variable is to know if the user has already seen the price
update.  That is how I know that I can go ahead and process the order.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {% spaceless %} doesn't work?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 20:54 +, Andrew wrote:
> Ah! Perfect! Good ol' .96!

It's actually a bug that we didn't put a note in the current docs that
the current behaviour is "new in development version". I'll try to
remember to fix that later today (working on something else right now,
though).

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cab issue

2007-10-14 Thread Nicolas Steinmetz

[EMAIL PROTECTED] a écrit :
> Exception Value:  Template u'base.html' cannot be extended, because it
> doesn't exist


It's a "convention" in django that your main template is named 
"base.html". It should be place in the root directory of your template 
directory.

Let's imagine :
/templates/
/templates/base.html
/templates/cab/
/templates/yourapp/
...


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cab issue

2007-10-14 Thread Jeremy Dunck

On 10/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> This obviously means that i have misunderstood somthing in the
> Templates section of the readme. Could someone provide some example
> templates or requirements and locations for the templates needed?
>

>From the ReadMe:

"The Subversion checkout will get you a set of example templates
matching those currently in use on djangosnippets.org, but they assume
the existence of base project-wide templates used by that site; you'll
need to either create templates with the same names to extend, or edit
the included templates to suit your site's layout."

Did you create a base.html template somewhere it can be found by a
template loader?

(If you're not sure what a template loader is, check these out:
http://www.djangoproject.com/documentation/settings/#template-loaders
http://www.djangoproject.com/documentation/templates_python/#loading-templates
)

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cab issue

2007-10-14 Thread [EMAIL PROTECTED]

I have problems getting the Cab (http://code.google.com/p/cab/)
application up and running. I have followed the instructions in the
readme, but it fails with:

Request Method: GET
Request URL:http://localhost:8000/snippets/
Exception Type: TemplateSyntaxError
Exception Value:Template u'base.html' cannot be extended, because it
doesn't exist
Exception Location: C:\Python24\Lib\site-packages\django\template
\loader_tags.py in get_parent, line 58
Python Executable:  C:\Python24\python.exe
Python Version: 2.4.1

This obviously means that i have misunderstood somthing in the
Templates section of the readme. Could someone provide some example
templates or requirements and locations for the templates needed?

Martin


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: do you use pydev for django development?

2007-10-14 Thread lmierzej

Thank you very much for your replay!

I understand it now... until get_object_or_404() is invoked how can
anyone know what would it return... am I thinking correct?

On Oct 14, 9:46 pm, Andrew <[EMAIL PROTECTED]> wrote:
> So much of models are generated on the fly, I usually count it as luck
> if I get any code completion at all. I don't think any other IDE will
> help you here.
>
> On Oct 14, 8:03 am, lmierzej <[EMAIL PROTECTED]> wrote:
>
> > hi,
> > I need advise...
> > i've started using pydev for django development
> > but it have some quirks...
>
> > for example if i retrieve my model's objects by invoking
> > get_object_or_404() function
> > code completion doesn't work on object retrieved with this function...
> > maybe it is just me or pydev shortcoming?...  Can anyone confirm or
> > deny this?
>
> > does anyone know other ide then pydev in which this would work?
>
> > Thank you for your time!


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {% spaceless %} doesn't work?

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 19:38 +, Andrew wrote:
> According to http://www.djangoproject.com/documentation/templates/#spaceless,
> {% spaceless %} should remove _all_ whitespace between tags, not
> insert a single space between them...
> 
> So why does http://dpaste.com/22430/ turn into http://dpaste.com/22431/

Which version of Django are you using? The behaviour of spaceless has
changed in the recent past. For example,
http://www.djangoproject.com/documentation/0.96/templates/#spaceless

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {% spaceless %} doesn't work?

2007-10-14 Thread James Bennett

On 10/14/07, Andrew <[EMAIL PROTECTED]> wrote:
> So why does http://dpaste.com/22430/ turn into http://dpaste.com/22431/
> ?

Quoth the documentation:

"Only space between tags is removed — not space between tags and text."

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: do you use pydev for django development?

2007-10-14 Thread Andrew

So much of models are generated on the fly, I usually count it as luck
if I get any code completion at all. I don't think any other IDE will
help you here.

On Oct 14, 8:03 am, lmierzej <[EMAIL PROTECTED]> wrote:
> hi,
> I need advise...
> i've started using pydev for django development
> but it have some quirks...
>
> for example if i retrieve my model's objects by invoking
> get_object_or_404() function
> code completion doesn't work on object retrieved with this function...
> maybe it is just me or pydev shortcoming?...  Can anyone confirm or
> deny this?
>
> does anyone know other ide then pydev in which this would work?
>
> Thank you for your time!


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



{% spaceless %} doesn't work?

2007-10-14 Thread Andrew

According to http://www.djangoproject.com/documentation/templates/#spaceless,
{% spaceless %} should remove _all_ whitespace between tags, not
insert a single space between them...

So why does http://dpaste.com/22430/ turn into http://dpaste.com/22431/
?


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Object not callable

2007-10-14 Thread Malcolm Tredinnick

On Thu, 2007-10-11 at 17:34 -0700, Cat wrote:
> Hello
> 
> Can anyone tell me why when I get to the line - form =
> InstanceForm(request.POST) in the following view (stepping through the
> code), I get a Type Error SurveyForm object is not callable. My
> understanding is that it should be as it subclasses Form
> 
> def addEditSurvey(request, id = None):
> 
>   if id is not None:
>   instance = Survey.objects.get(id=id)
>   InstanceForm = SurveyForm(instance = instance)
>   else:
>   InstanceForm = SurveyForm()

This line (and the similar one two lines earlier) creates an instance of
the SurveyForm class. So InstanceForm isn't a class object, it's an
instance of a class.

> 
>   if request.method == 'POST':
>   form = InstanceForm(request.POST)

This line would only make sense if either (a) InstanceForm had a
__call__ method or (b) InstanceForm was a class object and so had a
constructor. Neither of these is true. You are writing code as if
InstanceForm was meant to be a class object -- and that is how the
Django examples all look -- but it isn't (see above).

If you want to create a class object that is based on things like the
"instance" parameter, you need to look at Python meta-programming. This
can be a fairly confusing area (because, by it's very nature, it's very
abstract). However, for simple cases, it's not too bad. Have a look at
django.newforms.models.form_for_model() for an example of creating a
class object based on parametrised input.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UnicodeError in admin in latest django

2007-10-14 Thread Malcolm Tredinnick

On Fri, 2007-10-12 at 10:10 +0200, Michal Konvalinka wrote:
> Hi group,
> I have a problem with this variable in
> django.contrib.admin.templates.admin.change_form.html
> {{ original|truncatewords:"18"|escape }}
> 
> I'm getting this error:
> 
> UnicodeEncodeError at /admin/player/playerprofile/5/
> 'ascii' codec can't encode characters in position 3-4: ordinal not in 
> range(128)
> 
> Unicode error hint
> The string that could not be encoded/decoded was: Tomáš
> 
> Template error
> In template 
> /develop/projects/test/django/django/contrib/admin/templates/admin/change_form.html,
> error at line 14
> 
> When I comment the variable, it works.
> {# { original|truncatewords:"18"|escape } #}
> 
> Therefore I'm sure that problem is in the variable {{ original }}
> 
> Where can I get more information about this {{ original }} variable? I
> need to test it. There's no problem with it on my laptop running WinXP
> Python25 and latest django trunk. But there's a problem with it on
> FreeBSD, Python24 and latest django trunk.

Hmm .. Kenneth Gonsalves reported this a week or two ago, and he was
using Python 2.4, also. I wasn't able to repeat the problem with Python
2.4 on a recent Ubuntu, so it's up to people who are seeing it to help
debug further.

What would be good to know is what bytes are in the string "original"
and which part of that sequence of filters is raising the error (I would
guess truncatewords(), but let's confirm that). Then try to track down
where "original" came from and why it isn't a unicode object. You may
need to spend some time tracing it back, but what *should* be happening
is that as soon as the data is read from the database (note that the
database backend you are using might be significant here, so note
version numbers, etc) it should be converted into a Python unicode
object and never changed back until output time (which is the phase you
are in). So now try to find where that assumption breaks down.

This is an interesting problem, because now two unrelated people have
reported it *and* it's not universally repeatable. So if you can spend
some time poking around and trying to debug it, I'd appreciate it. I'm
laying money on a bug somewhere in the supporting pieces, rather than
Django, but it's something we have to work around, so we need to find
out the cause.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UnicodeError in admin in latest django

2007-10-14 Thread Malcolm Tredinnick

On Fri, 2007-10-12 at 10:29 +0200, Dirk Eschler wrote:
[...]
> i got around most of my unicode related problems by setting Pythons default 
> encoding to utf-8.
> 
> $ cat /usr/lib/python2.4/sitecustomize.py
> import sys
> sys.setdefaultencoding("utf-8")

Oh, no. That's a highly unrecommended solution, though.
setdefaultencoding() is not even meant to be in Python and there are
assumptions that the default encoding won't be changed. Please don't do
it (and I know that "Dive into Python" suggests this, but that's a bug
-- there are lots of threads on python-dev recommending against it).

Malcolm



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why HTML output in unicode?

2007-10-14 Thread Malcolm Tredinnick

On Fri, 2007-10-12 at 22:24 +0400, Ivan Sagalaev wrote:
> Ken wrote:
> > Sorry if this is a stupid question, but why do forms output HTML as
> > unicode strings?  Is this arbitrary or is there some grand convention
> > we are all supposed to be following?
> 
> The general convention is that all strings inside your project are 
> supposed to be unicode. 

Or UTF-8-encoded bytestrings. Django will always return you unicode
objects, though, so you need to be prepared to handle them.

This is all documented in unicode.txt in the source or online at 
http://www.djangoproject.com/documentation/unicode/ .

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: setup_environ(settings) fails

2007-10-14 Thread Malcolm Tredinnick

On Sun, 2007-10-14 at 11:52 +, faypy wrote:
> it's a simple test script:
> 
> from django.core.management import setup_environ
> import settings
> settings.DATABASE_NAME = '/home/me/mysite/libtest.sdb'
> print settings.DATABASE_NAME
> setup_environ(settings)
> 
> from ist.models import *
> from ist.tests import users
> 
> 
> the problem is it will change the default database
> '/home/me/mysite/lib.sdb'
> not
> '/home/me/mysite/libtest.sdb'
> 
> django mysteriously ignore
> settings.DATABASE_NAME = '/home/me/mysite/libtest.sdb'
> and do whatever it want?

Because of some internal implementation details, there is some code that
effectively reloads the settings module as part of setting up the
environment. So changes you made to your initial copy do not get
preserved.

If you want to do manual configuration, use settings.configure().

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Example for update_object

2007-10-14 Thread Florian Lindner

Hello,
I'm looking for an example on how to use the 
django.views.generic.create_update.update_object generic view.

Some of the concrete question I have:

Is object.get_absolute_url() a function I need to implement in my model?

The documentation of the view links to the manipulator and formfield 
documentation. There is mentioned that learning the stuff isn't worth anymore 
cause it's being replaced. Is this true also for this generic view? Where can 
I find an example on how to use the view with the newforms (I think it's this 
it's being replaced with). I'm using the svn version of Django.

Thanks,

Florian


http://www.djangoproject.com/documentation/generic_views/#django-views-generic-create-update-create-object

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



OT: How did you handle asynchronous tasks?

2007-10-14 Thread David Larlet

Hi all,

A bit off-topic but I wonder how did you handle asynchronous tasks
like emailing or crawling or put-here-your-secret-asynchronous-service
in your django projects? There are some solutions like django-mailer
but what about a more general (twisted?) queuing service? Any
thoughts?

Regards,
David

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help with Jinja Template

2007-10-14 Thread Brutus

Sorry for the push but can anyone drop me some hints or links?

I do: print tmpl.render({"playlist": playlist})

Well playlist is a dictionary containing the tag-value pairs, parsed
from the corresponding YAML file. In the template i want to itterate
over a list of allowed tags and if the tag is present in the context,
print it. What would be the best way to do this with Djangos template
system?

Because i found no way, how i could access the variables from the
template (well locals() shows them, dir() too, but i could'nt access
them) i wrapped them in a second dict with "playlist": playlist, so i
could do "if tag in playlist" and "playlist[tag]".


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[django 0.96] pydev code completion problem

2007-10-14 Thread lmierzej

hi,
in models.py I have Poll class...

when in views.py I do:
poll = Poll()
then when typing 'poll.' (just after typing '.') I get full and proper
code completion and that's just great...

but when I have something like this in views.py:
def poll(request, poll_id):
poll = get_object_or_404(Poll, pk=poll_id)
now when typing 'poll.' I get no code completion... :-(

Why is that? In SPE Python IDE both examples work just fine...
Does anyone use pydev and can check if he get proper code completion
after using 'get_object_or_404'?

Thank you advance!


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Adding permissions in a fixture

2007-10-14 Thread Russell Keith-Magee

On 10/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> On Aug 14, 7:06 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
> It's been a while since we had this discussion, but I would like to
> revisit it, if that's okay.
>
> We now have the testserver command that loads a fixture and lets you
> run the server to futz around. I think this represents a use case for
> what we were talking about --since you're not running any tests, you
> don't have a chance to put things in setUp and there's still the
> problem of how to deal with objects that might have different id
> numbers (specifically, content types and permissions, I think)
> depending on how the apps are loaded.
>
> Should I work up a patch or is this not something people see as
> necessary? I'm getting really annoyed about having to go into the
> shell to add permissions when I want to test them...

This is a slightly different idea to the one that we were talking
about before (or, at least, different to what I _thought_ you were
talking about). Adding active syntax (e.g., function calls) to
otherwise static fixtures isn't an appealing idea to me. However, what
you're describing is a lot closer to being an analog of the
management.py hooks - where you use the management.py trigger to load
initial data.

If you can come up with a good implementation, I'm not fundamentally
opposed to including Python fixtures of the kind you're describing.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



setup_environ(settings) fails

2007-10-14 Thread faypy

it's a simple test script:

from django.core.management import setup_environ
import settings
settings.DATABASE_NAME = '/home/me/mysite/libtest.sdb'
print settings.DATABASE_NAME
setup_environ(settings)

from ist.models import *
from ist.tests import users


the problem is it will change the default database
'/home/me/mysite/lib.sdb'
not
'/home/me/mysite/libtest.sdb'

django mysteriously ignore
settings.DATABASE_NAME = '/home/me/mysite/libtest.sdb'
and do whatever it want?

what's happening here?
thank u in advanced


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: TextField

2007-10-14 Thread Timothy Wu
On 10/14/07, Timothy Wu <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am using Django version 0.96. For some reason I cannot use TextField,
> it's giving me this error while I am validating:
>
> NameError: name 'TextField' is not defined
>
> Other fields which I have, CharField and IntegerField works just fine.
>
> What can I do?
>
> Timothy
>

Nevermind this post..must be tired, hee

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



TextField

2007-10-14 Thread Timothy Wu
Hi,

I am using Django version 0.96. For some reason I cannot use TextField, it's
giving me this error while I am validating:

NameError: name 'TextField' is not defined

Other fields which I have, CharField and IntegerField works just fine.

What can I do?

Timothy

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Urgent requirement for architect job

2007-10-14 Thread Dan Filip
WHY DOESN'T ANYONE BLOCK THESE STUPID ADS???

IS ANYBODY APPLYING FOR THIS?



On 10/14/07, kamini thakur <[EMAIL PROTECTED]> wrote:
>
> Urgent requirement for architect job
>
> ALL INDIA JOBBANK
>
> *Pls sends your CV in **www.allindiajobbank.com 
> *
> * website. It is fast and gives U positive response. Pls pass this message
> to Ur friend also because vacancies are waiting.*
>
> * * 
> *ARCHITECT ASSISTANT OR DRAFTMAN* 
>
> Should be able to handle Architecture & Interior Design projects from the
> Concept Stage to the Final Execution of the project, client meeting, site
> visit of the respective sites as per requirement.
> *Location:**Delhi* *.* *Salary:*  9- 15 . * Company:* * Geetanjali
> Construction** Job Type:* Full Time.*Exp.* 1-3
>
> * * 
> *P.R.O
> * 
>
> Lead the Design Team in development of innovative solutions to challenging
> sites and high land costs, without incurring costs overruns, innumerable
> change orders and knowledge of filling tender. * .*
> *Location:* *Delhi .* *Salary:*  9- 12 *.* * Company: * 
> *Geetanjali
> Construction** Job Type:* Full Time *. Exp:* 1-2 *.*
>
> * * 
> *ARCHITECT
> ASSISTANT * 
>
> S*hould be able to handle Architecture & Interior Design projects from the
> Concept Stage to the Final Execution of the project, client meeting, site
> visit of the respective sites as per requirement. .
> Location:Delhi  . Salary:  33- 57 .  Company: Geetanjali
> Construction Job Type: Full Time . Exp: 1-3 . *
>
> * * 
> *ARCHITECT* 
>
> We are a well known Architectural firm from South Delhi who are on the
> growth path and need well trained and qualified Architectural as well as
> Interior Design professionals *.*
> * Location:* *Delhi** .* *Salary:*  Not specified *.* * Company:* * Mahindra
> Associate **Job Type:* Full Time *. Exp:* 1-5 *.*
>
> * MARKETING EXECUTIVE* 
>
> Required marketing executives(min. graduate) for platform for employers
> and job seekers. with 0-5 yr experience. freshers can also apply. *.*
> *Location:*  *Delhi .* *Salary:*  8- 12 *.* * Company:* * all
> india job bank.com** Job Type:* Full Time *. Exp:* 1-5 *.*
>
> *For more information visit* 
> *www.allindiajobbank.com*
>
> *Pls sends your CV in **www.allindiajobbank.com*
> * website. It is fast and gives U
> positive response. Pls pass this message to Ur friend also because vacancies
> are waiting.*
>   *Thank Regards* *ALLINDIAJOBBANK TEAM   *
> 
> *011-41619668*
> *509, Nehru place-92*
> *New Delhi-19*
>
>
>
> >
>
>  Urgent requirement for architect job
>
> ALL INDIA JOBBANK
>
> Pls sends your CV in www.allindiajobbank.com website. It is fast and gives
> U positive response. Pls pass this message to Ur friend also because
> vacancies are waiting.
>
> * * 
> *ARCHITECT
> ASSISTANT OR DRAFTMAN* 
>
> Should be able to handle Architecture & Interior Design projects from the
> Concept Stage to the Final Execution of the project, client meeting, site
> visit of the respective sites as per requirement.
> *Location:*Delhi *.* *Salary:*  9- 15 . * Company:* Geetanjali
> Construction* Job Type:* Full Time.*Exp.* 1-3
>
> * * *
> P.R.O* 
>
> Lead the Design Team in development of innovative solutions to challenging
> sites and high land costs, without incurring costs overruns, innumerable
> change orders and knowledge of filling tender. *.*
> *Location:* *Delhi .* *Salary:*  9- 12 *.* * Company:* Geetanjali
> Construction* Job Type:* Full Time *. Exp:* 1-2 *.*
>
> * * 
> *ARCHITECT
> ASSISTANT* 
>
> Should be able to handle Architecture & Interior Design projects from the
> Concept Stage to the Final Execution of the project, client meeting, site
> visit of the respective sites as per requirement. .
> Location:Delhi  . Salary:  33- 57 .  Company: Geetanjali
> Construction Job Type: Full Time . Exp: 1-3 .
>
> * * *
> ARCHITECT* 
>
> We are a well known Architectural firm from South Delhi who are on the
> growth path and need well trained and qualified Architectural as well as
> Interior Design professionals 

Re: Switching between databases with same project/model

2007-10-14 Thread patrickk

I´m having a similar problem and I´m not sure if different settings-
files are the solution.

our project has one database. within our site, we have a lot of games,
where people can participate. the game-table has a lot of entries, so I
´d like to store old games in a second database (=archive) and make
them available for the editors through the admin-interface.

now, I could set up an entirely different project with an own settings-
file. that´s (probably) working.
but, is it also possible to use a model within my main-project and
tell (?) that model to use a different database? or do I have to use
the multi-db-branch for that?

thanks,
patrick

On Oct 14, 6:04 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 10/13/07, Brian DeGeeter <[EMAIL PROTECTED]> wrote:
>
>
>
> > So looks like there is no easy answer to my dynamic db settings.  I'd
> > be interested in the complex answer if anyone has one.  Specifically
> > for the command line tool we have.  Editing the settings.py with a sed
> > script seems so crude.
>
> It depends on exactly what you mean by 'dynamic'. If you mean 'changes
> during execution', then the answer will generally be no. However, your
> comment about using sed to modify settings.py suggests that you really
> mean something like 'changes depending upon the context in which it is
> accessed'.
>
> If the latter is what you mean, you should remember that :
> 1) Your settings file doesn't need to be called 'settings.py'. Django
> uses the DJANGO_SETTINGS_FILE environment variable and the --settings
> option on manage.py to load settings
>
> 2) Django settings files are just python files.
>
> As a result, the following setup:
>
> base_settings.py
> ---
>
> INSTALLED_APPS=(...)
>
> database1_settings.py
> 
>
> from base_settings import *
>
> DATABASE_BACKEND='sqlite3'
> DATABASE_NAME='foo'
>
> database2_settings.py
> 
>
> from base_settings import *
>
> DATABASE_BACKEND='sqlite3'
> DATABASE_NAME='bar'
>
> is entirely legal; there's no need to use sed - just factor out the
> common settings, and direct manage.py (or whatever other script you
> are using) to point at the appropriate settings file at time of
> execution.
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---