Re: django template variables

2010-07-11 Thread Syed Ali Saim
:)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to pass a GET param that contains multiple items

2010-07-11 Thread euan.godd...@googlemail.com
This is a standard encode/decode situation you are descibing. Django
automatically decodes the GET string the the browser encodes. If you
need spaces, then they wil be encoded and decoded appropriately, so
don't worry about that.

If you want to pass a list in the GET string, do:

url?var=1&var=2&var=3

Django will intepret this in it's multi-value dict implementation that
QueryDict uses. So if you do:

request.GET.getlist('var')

you will get:

['1', '2', '3']

Hope that helps, Euan


On 10 July, 23:40, Margie Roginski  wrote:
> I have a url in my app that needs to get info from a GET param.  For
> example, let's say my url is retrieving books by any of a set of
> authors, so the url might be this to get books authored by smith,
> johnson, or klein:
>
> www.example.com/books/?author=smith+johnson+klein
>
> I notice that when I look at request.GET.get('author') on the server,
> the '+' is gone and replaced by space:
>
> 
>
> Is this django doing this for me or is this some sort of general http
> protocal thing?
>
> My main question is just - what's the accepted way to pass in a get
> parameter that contains a bunch of times.  What if the parameter
> itself has spaces?  I've seen this '+' used - is that standard or just
> personal preference?
>
> Thanks,
> Margie

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: update least syntax?

2010-07-11 Thread euan.godd...@googlemail.com
Django doesn't support the query type you're trying to do. You've
already discovered F which is about as complicated as it gets, bt the
update syntax is pretty much limited to setting a field's value to a
consant.

Looping over the minimum set of things and calling save on each one if
your only option without resorting to custom SQL.

Euan

On 11 July, 07:44, Doug Warren  wrote:
> Can Django support an update by setting a field to the least of two args?
>
> I have a model that looks like:
>
> class Bar
>     maxval = models.FloatField()
>     rate = models.FloatField()
>
> class Foo(models.Model):
>     bar = models.ForeignKey(Bar)
>     current = models.FloatField()
>
> and i'd like to increase current up to max by rate for every case
> where it's not yet the max...
>
> IE: I'd like to do something like:
> Foo.objects.filter(current__lt=F('bar__maxval')).update(current=least(Q('cu­rrent')+Q('bar__rate'),Q('bar__maxval')))
>
> But that fails because you can't add 2 query sets together, can't join
> field referenecs in an update, and I don't see support for 'least'
> What I've done instead is rewritten it to iterate over bars each time
> filtering on foo like:
>
> set = foo.objects.filter(bar=bar).filter(current__lt=bar.max)
> and then compute the min amount of current to hit max this update, and
> update that, then iterate over what remains and update each one
> individually, ie:
>
> canreachfull = bar.max - bar.rate
> set.filter(current__gte=canreachfull).update(current=bar.rate)
> set = foo.objects.filter(bar=bar).filter(current__lt=bar.max)
> for record in set:
>     newcurrent = record.current + bar.max
>     record.update(current=newcurrent)
>
> Is there a better way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Testing custom inclusion tag

2010-07-11 Thread Julian
Hi,

I've written a custom inclusion tag for a project of mine. The problem
is: how can i test it? I've got a TestCase which has some methods:

def get_tagcloud_template(self, argument):
return """{%% load taggit_extras %%}
  {%% include_tagcloud %s %%}
""" % argument

My approach for testing template-tags was:

def test_taglist_project(self):
t = Template(self.get_taglist_template(""))
c = Context({})
t.render(c)

and then I tested the members of `c`, for example

self.assertEquals(c.get('tags'), ['somelist'])

But the template-variables exist only in the scope of the included
template, not in the template that contains the include-statement. How
do I test if everything's working? Do I have to read the file that
contains the include-statement and render it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Major Tech Start up – NYC –Python Developer - Dj ango/ Python Java/J2ee

2010-07-11 Thread Tech Scout
* Major Tech Start up – NYC –Python Developer - Django/ Python Java/J2ee FTE
opportunity *
*View, Refer or Apply confidentially here:
**http://bitURL.net/3df
*
*
*
* **Tech Scout
*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Testing many-to-many models on a legacy database

2010-07-11 Thread derek
On Jul 10, 4:40 pm, Rolando Espinoza La Fuente 
wrote:
> On Sat, Jul 10, 2010 at 9:31 AM, Derek  wrote:
> > Running Django 1.2.1 under Python 2.6.
> > I am obviously missing something cruccial, but I am just not sure where this
> > is...
> > I have a setup which includes a number of many-to-many models in a legacy
> > database.  For example:
>
> > class Grouping(models.Model):
> >     id = models.AutoField(primary_key=True, db_column='GroupingID')
> >     name = models.CharField(max_length=250, db_column='GroupingName',
> > unique=True)
> > class TaxAgreement(models.Model):
> >     id = models.AutoField(primary_key=True, db_column='TaxID')
> >     title = models.CharField(max_length=100, db_column='TaxTitle',
> > unique=True)
> >     groupings = models.ManyToManyField(Grouping,
> > db_table='taxagreementgrouping')
>
> Use through 
> keywordhttp://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
>
> groupings = models.ManyToManyField(Grouping, through='TaxAgreementGrouping')
>

Thanks, this fixes those problems.  Unfortunately, however, it also
introduces a new error. When I try and start the app,  I now get:

ImproperlyConfigured at /admin/
'TaxAgreementAdmin.fieldsets[6][1]['fields']' can't include the
ManyToManyField field 'groupings' because 'groupings' manually
specifies a 'through' model.

I need to be able to use the "many to many" box in order to create the
associations...

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Testing many-to-many models on a legacy database

2010-07-11 Thread derek
On Jul 11, 4:23 pm, derek  wrote:
> On Jul 10, 4:40 pm, Rolando Espinoza La Fuente 
> wrote:
>
>
>
> > On Sat, Jul 10, 2010 at 9:31 AM, Derek  wrote:
> > > Running Django 1.2.1 under Python 2.6.
> > > I am obviously missing something cruccial, but I am just not sure where 
> > > this
> > > is...
> > > I have a setup which includes a number of many-to-many models in a legacy
> > > database.  For example:
>
> > > class Grouping(models.Model):
> > >     id = models.AutoField(primary_key=True, db_column='GroupingID')
> > >     name = models.CharField(max_length=250, db_column='GroupingName',
> > > unique=True)
> > > class TaxAgreement(models.Model):
> > >     id = models.AutoField(primary_key=True, db_column='TaxID')
> > >     title = models.CharField(max_length=100, db_column='TaxTitle',
> > > unique=True)
> > >     groupings = models.ManyToManyField(Grouping,
> > > db_table='taxagreementgrouping')
>
> > Use through 
> > keywordhttp://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
>
> > groupings = models.ManyToManyField(Grouping, through='TaxAgreementGrouping')
>
> Thanks, this fixes those problems.  Unfortunately, however, it also
> introduces a new error. When I try and start the app,  I now get:
>
> ImproperlyConfigured at /admin/
> 'TaxAgreementAdmin.fieldsets[6][1]['fields']' can't include the
> ManyToManyField field 'groupings' because 'groupings' manually
> specifies a 'through' model.
>
> I need to be able to use the "many to many" box in order to create the
> associations...
>

As a follow-up, I see from the docs that the many to many widget
_cannot_ be used in a case where "through" is specified, because the
assumption is that extra fields will be added to the join model.  This
is _not_ the case for me, so this implies I should not have to use the
"through" option to solve my original problem.

[Sidebar:  Interestingly, it has been suggested that it _could_, in
future, be possible to do this...  (see
http://www.mail-archive.com/django-upda...@googlegroups.com/msg45249.html):

"The fancy solution would be to loosen this condition slightly and
allow an m2m field to be in the fields list (and therefore allow an
m2m widget be used) *iff* the through model is just 2 foreign keys
with a unique_together pairing (i.e., if the through model is exactly
the same as the m2m model that is be automatically generated for the
non-explicit through case)."]






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



cant get contact_form to send an email, fails silently every time

2010-07-11 Thread shofty
all,

im really struggling with django contact_form
http://bitbucket.org/ubernostrum/django-contact-form/overview/

it doesn't send the email. i've stepped through it locally and it hits
all the right lines of code. obviously it won't send it locally. but
on the server, it should send however it never actually does. i get
the success url page shown as if its sent ok.

has anyone on here got it to work on webfaction? ive checked my
settings with their support team, verified that its breaking down
inside the save method on the ContactForm model. basically, if i
replace the form.save with a send_mail then it will send a mail to an
address at that point, but once it goes into the models save and does
the whole build of the email it doesn;t send anything. and with it
being on server im not sure what i can do to troubleshoot it. which is
why i can't even supply an error message for this!!!

so i could use some suggestions on how to work this one through
please...

Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Forms.is_valid() Always return False

2010-07-11 Thread maroxe
Hi all,
I have a problem with django 1.2:
 is_valid returns always False, and form.errors is empty.
I use AuthentificationForm provided by django.
I have created a bound form:
form = AuthentificationForm(request.POST)

and this request.POST:


I believe it's a probleme related to django new securitiy system
against csrf attaks.

Any help pls?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: update least syntax?

2010-07-11 Thread Doug Warren
Just to be sure though, I don't need to call save on the instances
unless I need to emit the save events right?  Reading the manual:
Be aware that the update()  method is converted directly to an SQL
statement. It is a bulk operation for direct updates. It doesn't run
any save() methods on your models, or emit the pre_save or post_save
signals (which are a consequence of calling save()). If you want to
save every item in a QuerySet  and make sure that the save()  method
is called on each instance, you don't need any special function to
handle that. Just loop over them and call save():

It implies that it's running the UPDATE SQL command directly so the
data is getting changed regardless of if I invoke save() myself.
Correct?

On Sun, Jul 11, 2010 at 2:03 AM, euan.godd...@googlemail.com
 wrote:
> Django doesn't support the query type you're trying to do. You've
> already discovered F which is about as complicated as it gets, bt the
> update syntax is pretty much limited to setting a field's value to a
> consant.
>
> Looping over the minimum set of things and calling save on each one if
> your only option without resorting to custom SQL.
>
> Euan
>
> On 11 July, 07:44, Doug Warren  wrote:
>> Can Django support an update by setting a field to the least of two args?
>>
>> I have a model that looks like:
>>
>> class Bar
>>     maxval = models.FloatField()
>>     rate = models.FloatField()
>>
>> class Foo(models.Model):
>>     bar = models.ForeignKey(Bar)
>>     current = models.FloatField()
>>
>> and i'd like to increase current up to max by rate for every case
>> where it's not yet the max...
>>
>> IE: I'd like to do something like:
>> Foo.objects.filter(current__lt=F('bar__maxval')).update(current=least(Q('cu­rrent')+Q('bar__rate'),Q('bar__maxval')))
>>
>> But that fails because you can't add 2 query sets together, can't join
>> field referenecs in an update, and I don't see support for 'least'
>> What I've done instead is rewritten it to iterate over bars each time
>> filtering on foo like:
>>
>> set = foo.objects.filter(bar=bar).filter(current__lt=bar.max)
>> and then compute the min amount of current to hit max this update, and
>> update that, then iterate over what remains and update each one
>> individually, ie:
>>
>> canreachfull = bar.max - bar.rate
>> set.filter(current__gte=canreachfull).update(current=bar.rate)
>> set = foo.objects.filter(bar=bar).filter(current__lt=bar.max)
>> for record in set:
>>     newcurrent = record.current + bar.max
>>     record.update(current=newcurrent)
>>
>> Is there a better way to do this?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



python logging and multiple process issue?

2010-07-11 Thread ydjango
Python logging has know limitation with multiple processes logging to
same file.
(I am using rotatingfilehandler.)

Which in case of prefork MPM will always be an issue and can be an
issue for worker mpm as well?

Python doc recommends logging to sockets.

What workarounds  are you using and can recommend ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Major Tech Start up – NYC –Python Developer - Django/ Python Java/J2ee

2010-07-11 Thread John Handelaar
On 11 July 2010 14:17, Tech Scout  wrote:
>  Major Tech Start up – NYC –Python Developer - Django/ Python Java/J2ee FTE
> opportunity
> View, Refer or Apply confidentially here: http://bitURL.net/3df
> Tech Scout

Why you just got spam filtered:

1) Posting in HTML
2) No name
3) No phone number
4) No company email address
5) Massive OverUse Of CapitalIZation
6) Concealed URL
7) Nonsensical spraying of Java terms you don't understand in a post
to python devs.

Not bad for two lines.

Please go away now.

jh

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Forms.is_valid() Always return False

2010-07-11 Thread maroxe
The problem occurs only when using AuthenticationForm!

On Jul 11, 4:14 pm, maroxe  wrote:
> Hi all,
> I have a problem with django 1.2:
>  is_valid returns always False, and form.errors is empty.
> I use AuthentificationForm provided by django.
> I have created a bound form:
> form = AuthentificationForm(request.POST)
>
> and this request.POST:
>  [u'f871257kikf70a95e1197c8af01597eb'], u'password': [u'mypass']}>
>
> I believe it's a probleme related to django new securitiy system
> against csrf attaks.
>
> Any help pls?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New tutorial added to Django by Example

2010-07-11 Thread Rainy


On Jul 9, 9:41 pm, John M  wrote:
> WOW, this is very cool, you should see if you can add it to the main
> django tutorial someway?

Thanks! I don't think it will be added to main tutorial but I added
the
link to the list of tutorials on Django Wiki. -ak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Major Tech Start up – NYC –Python Devel oper - Django/ Python Java/J2ee

2010-07-11 Thread CLIFFORD ILKAY

On 07/11/2010 12:36 PM, John Handelaar wrote:

On 11 July 2010 14:17, Tech Scout  wrote:

  Major Tech Start up – NYC –Python Developer - Django/ Python Java/J2ee FTE
opportunity
View, Refer or Apply confidentially here: http://bitURL.net/3df
Tech Scout


Why you just got spam filtered:


Apparently, this message wasn't spam filtered because you were able to 
read it, as was I.



1) Posting in HTML


Gmail encourages it. It's not the end of the world.


2) No name
3) No phone number
4) No company email address


Where is your contact information then? Is this is a case of "do as I 
say but not as I do" or are you afraid that your blatherings would be 
indexed and come back to haunt you later?


While I would think that a recruiting firm would want this information 
indexed, there may be a legitimate reason for a recruiter not to want 
this information archived and indexed, too. It's also possible that the 
poster isn't particularly tech-savvy and doesn't understand the 
importance of providing this information so rather than give the 
original poster a tongue lashing, it would have been more appropriate to 
inform him or her (nicely) that providing full contact information would 
be in their best interests.



5) Massive OverUse Of CapitalIZation


"Massive"? You're being awfully picky! NYC - New York City, FTE - Full 
Time Employee. Both are commonly used acronyms.



6) Concealed URL


The hosted talent portal that the recruiting firm uses has ugly and long 
URLs. It's understandable that they might want to shorten it.



7) Nonsensical spraying of Java terms you don't understand in a post
to python devs.


How can you tell that it's "nonsensical" and that the poster doesn't 
understand them? What if this is what the client wants and needs? The 
only nonsense I read was your response.



Not bad for two lines.


I could say the same thing about your inane response.


Please go away now.


This is rude, completely uncalled for, and unacceptable to me (and I 
suspect for many others). The way you wrote this, it sounds like you're 
speaking on behalf of others and you can rest assured that you don't 
speak on my behalf at least.


I've noticed this a couple of times in the last few weeks where someone 
posts a job ad here and some crank immediately responds inappropriately. 
Those who seem to feel the need to verbally lynch people for posting job 
offers here need to look within themselves to understand why they react 
in such a negative fashion.

--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: mod_wsgi problem with installation

2010-07-11 Thread John Griessen

tazimk wrote:

hi,


Trying to figure out why make gives following errors .
What is wrong with installation ?


Saw similar with buildout when a package could not be found.

How are you installing?

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Admin site not formatted

2010-07-11 Thread Darren
I have had that happen a long time ago. I think my problem was that apache 
didn't gave permission to the CSS. I know that's not much to go on. But, maybe 
it will help. 

Darren

On Jul 10, 2010, at 12:50 PM, octopusgrabbus  wrote:

> Using Apache and not the built-in Django web server, I can reach the
> admin site, but it's not formatted well, as it is with the built-in
> web server.
> 
> Any ideas on what to do?
> 
> Here's the location directive in apache
> 
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE chapter4.settings
> PythonOption django.root /home/amr/web/django/chapter4
> PythonPath "['/home/amr/web/django/'] + ['/home/amr/web/django/
> favorites/'] + sys.path
> "
> PythonDebug On
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to access help_text attribute of model field

2010-07-11 Thread Sells, Fred
I would like to access the help_text attribute of my model fields when
responding with XML like this

 

class A(MDSSection):

A0100A= models.CharField(max_length=10, help_text='''National
Provider Identifier (NPI)''') 

A0100B= models.CharField(max_length=12, help_text='''CMS
Certification Number (CCN)''') 

A0100C= models.CharField(max_length=15, help_text='''State
provider number''') 

 

And I want to render xml similar to this



   

   ...



 

 

I'm nut using Django forms but responding to Flex with XML.  There must
be some way to access this information, but I've been through the docus
and google with no luck.

 

Does anyone know how to access the help_text of the fields, once I have
the model instance object?

 

Thanks,

Fred.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to access help_text attribute of model field

2010-07-11 Thread Daniel Roseman
On Jul 11, 9:58 pm, "Sells, Fred" 
wrote:
> I would like to access the help_text attribute of my model fields when
> responding with XML like this


>
> I'm nut using Django forms but responding to Flex with XML.  There must
> be some way to access this information, but I've been through the docus
> and google with no luck.
>
> Does anyone know how to access the help_text of the fields, once I have
> the model instance object?
>
> Thanks,
>
> Fred.

MyModel._meta.get_field_by_name('fieldname')[0].help_text

Although I must say that the examples you give look like they would be
better as verbose_name, rather than help_text.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Admin site not formatted

2010-07-11 Thread John Griessen

Darren wrote:
I have had that happen a long time ago. I think my problem was that apache didn't gave permission to the CSS. I know that's not much to go on. But, maybe it will help. 

Or it can be lack of an alias in the apache2 config.

John

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: How to access help_text attribute of model field

2010-07-11 Thread Sells, Fred
> I would like to access the help_text attribute of my model fields when
> responding with XML like this


>
> I'm nut using Django forms but responding to Flex with XML.  There must
> be some way to access this information, but I've been through the docus
> and google with no luck.
>
> Does anyone know how to access the help_text of the fields, once I have
> the model instance object?
>
> Thanks,
>
> Fred.

MyModel._meta.get_field_by_name('fieldname')[0].help_text

Although I must say that the examples you give look like they would be
better as verbose_name, rather than help_text.  

Thanks; that's a life saver :)

I don't intend to use these names as column names but as content of a column, 
used for debugging as much as anything else. I'm new to Django, so I had not 
thought of verbose name.  I really had not anticipated using the help_text at 
all when I defined my models, but a situation came up where I needed to do a

Name --- value  description type of table.

is there an advantage of verbosename over helptext in my scenario?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



debugging CSRF trouble

2010-07-11 Thread John Griessen

I'm using a package django-page-cms that uses CSRF and can't
follow the docs for CSRF for django 1.2.

They say I should add these lines to MIDDLEWARE_CLASSES,

'django.middleware.csrf.CsrfViewMiddleware'
'django.middleware.csrf.CsrfResponseMiddleware'

but when I do, I get an error:

File 
"/var/web/industromatic.com_bld/parts/django/django/core/handlers/base.py", 
line 42, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' 
% (mw_module, e))
ImproperlyConfigured: Error importing middleware 
django.middleware.csrf.CsrfViewMiddlewaredjango.middleware.csrf:
"No module named CsrfViewMiddlewaredjango.middleware.csrf"

The funny thing is the above path seems good, and in with that same
django source is the file with the module.  The error reports the name all
run together several times.  Any ideas what is happening?

settings with   MIDDLEWARE_CLASSES that cause error:  http://dpaste.com/217074/
error traceback:  http://dpaste.com/217075/

John

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: debugging CSRF trouble

2010-07-11 Thread Karen Tracey
On Sun, Jul 11, 2010 at 7:11 PM, John Griessen wrote:

> I'm using a package django-page-cms that uses CSRF and can't
> follow the docs for CSRF for django 1.2.
>
> They say I should add these lines to MIDDLEWARE_CLASSES,
>
>'django.middleware.csrf.CsrfViewMiddleware'
>'django.middleware.csrf.CsrfResponseMiddleware'
>
> but when I do, I get an error:
>
> File
> "/var/web/industromatic.com_bld/parts/django/django/core/handlers/base.py",
> line 42, in load_middleware
>raise exceptions.ImproperlyConfigured('Error importing middleware %s:
> "%s"' % (mw_module, e))
> ImproperlyConfigured: Error importing middleware
> django.middleware.csrf.CsrfViewMiddlewaredjango.middleware.csrf:
> "No module named CsrfViewMiddlewaredjango.middleware.csrf"
>
> The funny thing is the above path seems good, and in with that same
> django source is the file with the module.  The error reports the name all
> run together several times.  Any ideas what is happening?
>

There needs to be a comma on the end of the first line. Without it Python
concatenates the two strings into a single one.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to commit ManyToManyField with ModelForm

2010-07-11 Thread yugori
I tried to recreate tables, and it's done.
But it makes no change to my plobrem.

Please help me out (;_;)

On 7月9日, 午後7:59, Sævar Öfjörð  wrote:
> Have you tried resetting your database and syncing it again?
> If there are columns missing it sounds like you added them after you
> did a manage.py syncdb
> Django will not alter your tables after they have been created. More
> info on this 
> here:http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs#s...
>
> So I would try:
>
> python manage.py reset appname
> python manage.py syncdb
>
> Just keep in mind that you'll lose your previously stored data.
>
> -Sævar
>
> On Jul 9, 8:10 am, yugori  wrote:
>
> > Hi, I'm beginner of Django&Py.
> > Now I try to make Product Management Tool with Django.
> > So I wrote some code.
>
> > models.py
> > //---
> > from django import forms
> > from django.db import models
>
> > # ex('ie8','InternetExplorer8')
> > class Browser(models.Model):
> >   id=model.CharField('id',primary_key=True)
> >   name=model.CharField('name')
>
> >   def __unicode__(self):
> >     return self.name
>
> > # ex('iphone3','iPhoneOS3')
> > class Device(models.Model):
> >   id=model.CharField('id',primary_key=True)
> >   name=model.CharField('name')
>
> >   def __unicode__(self):
> >     return self.name
>
> > # ex('site01','MySite','browser[]','device[]')
> > class Product(models.Model):
> >   id = models.CharField('id', primary_key=True)
> >   name = models.CharField('name')
> >   support_browser = models.ManyToManyField(Browser)
> >   support_device = models.ManyToManyField(Device)
>
> >   def __unicode__(self):
> >     return self.name
>
> > class ProductForm(forms.ModelForm):
> >   class Meta:
> >     model = Product
> > ---//
>
> > 
> > view.py
> > //---
> > def create(request):
> >     if request.method == 'POST':
> >         form = ProductForm(request.POST)
> >         if form.is_valid():
> >             form.save()
> >             return HttpResponseRedirect('/product/detail/'+form.id
> > +'/')
> >         else:
> >             print form.errors
> >             errors = form.errors
> >             return render_to_response('Product/create.html',{'errors':
> > errors,'form':form})
>
> >     else:
> >         form = ProductForm()
>
> >     return render_to_response('Product/create.html',{'form':form})
> > ---//
>
> > 
> > create.html
> > //---
> > 
> > create
> > 
> > 
> > {{ form.errors }}
> > 
> >   ID{{form.id}}
> > 
> > 
> >   NAME{{form.name}}
> > 
> > 
> >   Support Browser
> >   {{form.support_browser}}
> > 
> > 
> >   Support Device
> >   {{form.support_device}}
> > 
> >   
> > 
> > 
> > 
>
> > ---//
> > 
>
> > 1.Access to /product/create/ - it works good!
> > 2.Complete form and submit - it works good!
> > 3.Watch table 'product' - it works good? There's no column
> > 'support_browser' and 'support_device'.
> > 4.Watch intermidieval table 'product_browser'(autogenerated) - it has
> > no rows...
>
> > What's wrong?
> > Please tell me..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Free (legal) jQuery book, from Novice to Ninja for 24 hours.

2010-07-11 Thread Shawn Milochik
Yes, this is slightly off-topic, but all the Django developers I know use 
jQuery in their projects.

The publisher is giving away the e-book as promotional stunt related to the 
World Cup.

http://sale.sitepoint.com/

The download includes PDF, .mobi, and .epub versions!

Shawn

Disclaimer: None. I have no association with this publisher or book, other than 
having the book in my Amazon shopping cart and no longer having to pay for it. 
^_^



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



A simple use-case for adding Celery to a Django project without RabbitMQ.

2010-07-11 Thread Shawn Milochik
Here's a little blog post I just wrote. It provides instructions for what I 
think is the simplest possible way to add Celery to your Django project.

Feedback (including critical) is always welcome.

http://shawnmilo.blogspot.com/2010/07/simple-celery-with-django-how-to.html

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.