Re: method being called twice?

2011-02-03 Thread Burhan
Thank you all for your comments. Perhaps I should clarify:

1. I'm not really interested in what is in the querystring, I'm only 
interested in what is being sent as part of the POST request.

2. The method's full body is posted here: http://dpaste.com/380708; the 
method "breaks"  at line 8 with the KeyError, when the POST QueryDict is 
true, and when its requested via GET (for example, when I copy and paste the 
URL in a new browser window), the GET QueryDict is empty as well.

3. In the POST QueryDict, the key is 'paymentid'.

4. After some troubleshooting it seems that the method is called twice, once 
with a POST body, and once without (as verified by the server logs).

5. There is only one URL entry that points to the method, and it is always 
requested via HTTPS and always from a third party (that's why there is 
@csrf_exempt)

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



Re: method being called twice?

2011-02-03 Thread Burhan
The log entries for a session are here: http://dpaste.com/380749

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



different length queries

2011-02-03 Thread gintare
Hello,

Could you please advice if it is possible and where i could read OR at
least that keywords should search for the following question.

Is there a way to submit List =  [Q(word__starts='search_input'),
Q(date='search_input') ,]
to model.objects.filter (List).
How i have to formulate such list?

My query may contain from 1 to tens of restrictions
i.e. query with  1 item:
object. all.filter(Q(word__starts='search_input'))
versus query with 3 items:
object. all.filter( Q(word__starts='search_input')  ,
Q(date='search_input')  ,  Q( smth_else='search_input')   )

I know only programming basics and in order to execute selected
queries i have to write many if sentences.
i.e. query with  1 item:
if (word):  object. all.filter(Q(word__starts='search_input'))

versus query with 3 items:
if (word & date & smth_else ): object.
all.filter( Q(word__starts='search_input')  ,
Q(date='search_input')  ,  Q( smth_else='search_input')   )

Number of combination is very huge. Is there a way to submit a List
containing [Q(word__starts='search_input'),
Q(date='search_input') ,]
How i have to formulate such list?


P.s. In sqlite3 i can make a string in for cycle:

##for key in DSearch.keys():
##str2=str2+' ( '+str(key)+' LIKE '+item+')
AND'
## instead of LIKE i use one more if-elif cycle for search_method
starts, contains, ends, equal
##if (str2!=''):
##str3=str2[:-4]+' );'
##cursor.execute(st3);
##transaction.commit_unless_managed()
##ans=cursor.fetchall()

I would like to use Django.

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



Re: different length queries

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 9:10 AM, gintare  wrote:
> Hello,
>
> Could you please advice if it is possible and where i could read OR at
> least that keywords should search for the following question.
>
> Is there a way to submit List =  [Q(word__starts='search_input'),
> Q(date='search_input') ,]
> to model.objects.filter (List).
> How i have to formulate such list?
>
> My query may contain from 1 to tens of restrictions
> i.e. query with  1 item:
> object. all.filter(Q(word__starts='search_input'))
> versus query with 3 items:
> object. all.filter( Q(word__starts='search_input')  ,
> Q(date='search_input')  ,  Q( smth_else='search_input')   )
>
> I know only programming basics and in order to execute selected
> queries i have to write many if sentences.
> i.e. query with  1 item:
> if (word):  object. all.filter(Q(word__starts='search_input'))
>
> versus query with 3 items:
> if (word & date & smth_else ): object.
> all.filter( Q(word__starts='search_input')  ,
> Q(date='search_input')  ,  Q( smth_else='search_input')   )
>
> Number of combination is very huge. Is there a way to submit a List
> containing [Q(word__starts='search_input'),
> Q(date='search_input') ,]
> How i have to formulate such list?
>
>
> P.s. In sqlite3 i can make a string in for cycle:
>
> ##    for key in DSearch.keys():
> ##                str2=str2+' ( '+str(key)+' LIKE '+item+')
> AND'
> ## instead of LIKE i use one more if-elif cycle for search_method
> starts, contains, ends, equal
> ##    if (str2!=''):
> ##        str3=str2[:-4]+' );'
> ##        cursor.execute(st3);
> ##        transaction.commit_unless_managed()
> ##        ans=cursor.fetchall()
>
> I would like to use Django.
>

You're using Q objects, did you not read any of the documentation on
them? This is clearly explained[1] in the docs.

qfilter = Q(my_field__contains=search_term)
if search_date:
  qfilter |= Q(date_field=search_term)
# etc.
queryset = MyObject.objects.filter(qfilter)


Cheers

Tom

[1] 
http://docs.djangoproject.com/en/1.2/topics/db/queries/#complex-lookups-with-q-objects

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



Re: different length queries

2011-02-03 Thread Jani Tiainen
On Thursday 03 February 2011 11:10:51 gintare wrote:
> Hello,
> 
> Could you please advice if it is possible and where i could read OR at
> least that keywords should search for the following question.
> 
> Is there a way to submit List =  [Q(word__starts='search_input'),
> Q(date='search_input') ,]
> to model.objects.filter (List).
> How i have to formulate such list?
> 
> My query may contain from 1 to tens of restrictions
> i.e. query with  1 item:
> object. all.filter(Q(word__starts='search_input'))
> versus query with 3 items:
> object. all.filter( Q(word__starts='search_input')  ,
> Q(date='search_input')  ,  Q( smth_else='search_input')   )
> 
> I know only programming basics and in order to execute selected
> queries i have to write many if sentences.
> i.e. query with  1 item:
> if (word):  object. all.filter(Q(word__starts='search_input'))
> 
> versus query with 3 items:
> if (word & date & smth_else ): object.
> all.filter( Q(word__starts='search_input')  ,
> Q(date='search_input')  ,  Q( smth_else='search_input')   )
> 
> Number of combination is very huge. Is there a way to submit a List
> containing [Q(word__starts='search_input'),
> Q(date='search_input') ,]
> How i have to formulate such list?

You can pass kwargs to filter:

query_kwargs = {
   'something__startswith' : 'foobar',
   'somethingelse__gte': 123
}

qs = MyModel.objects.filter(**query_kwargs)

You can pass a sequence:

q_list = [
  Q(foo_bar__icontains='bar'),
  Q(bar_baz=123),
]

qs = MyModel.objects.filter(q_list)

Both creates AND queries. If you need something more complex you can chain Q 
queries:

q_query = Q() # Initialize empty query
q_query &= Q(foobar__icontains='foobar') # AND part
q_query |= Q(baz=123) # OR part

qs = MyModel.objects.filter(q_query)

-- 

Jani Tiainen

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



different length queries

2011-02-03 Thread gintare

answer to my previous question about different length queries
http://docs.djangoproject.com/en/dev/topics/db/sql/
#for p in Person.objects.raw('SELECT * FROM myapp_person')

Is it possible to post all the question which i send immediately?
Sometimes i find answer by myself.

I also soon would like to be able to delete all my posts and put
instead one summary post with main issues i met during self learning
from manuals.

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



Re: different length queries

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 9:51 AM, gintare  wrote:
>
> answer to my previous question about different length queries
> http://docs.djangoproject.com/en/dev/topics/db/sql/
> #for p in Person.objects.raw('SELECT * FROM myapp_person')
>
> Is it possible to post all the question which i send immediately?
> Sometimes i find answer by myself.
>
> I also soon would like to be able to delete all my posts and put
> instead one summary post with main issues i met during self learning
> from manuals.
>

Typically people look for the answer first, before asking for help, so
as to avoid that kind of situation. Once you've sent an email to a
mailing list, and it is delivered, there is no recalling - that sucker
will be archived in thousands of places for eternity - so try not to
look like a fool!

Cheers

Tom

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



Override admin popup default url

2011-02-03 Thread Marc Aymerich
Hi,

I need to pass some extra parameters in some admin popups. For
example, this is the default URL for an arbitrary popup:
http://localhost:8081/admin/web/systemgroup/add/?_popup=1

What I want is add a new element on the dict queryset:
http://localhost:8081/admin/web/systemgroup/add/?_popup=1&contact_id=1

Where is the right place to handle that?

Thanks!!!
-- 
Marc

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



Re: Modifying form values before redirect

2011-02-03 Thread Daniel Roseman
On Thursday, February 3, 2011 2:09:56 AM UTC, Osiaq wrote:
>
> Hi all! 
> I'm receiving the form from index.html and redirecting to order.html 
> I would like to change "customer" value before redirection. 
> When I try to modify it, Im getting "object does not support item 
> assignment" 
> How can I change "customer" value posted from index.html ? 
> Thank you! 
>
> --- models.py - 
> class Order(models.Model): 
> customer = models.CharField(max_length=20) 
> email = models.EmailField() 
> def __str__(self): 
> return self.customer 
>
> class OrderForm(ModelForm): 
> class Meta: 
> model=Order 
>
> --- views.py - 
> def order(request): 
> form = OrderForm(request.POST) 
> return render_to_response('order.html', {'form':form}) 
>

Why didn't you show the code that does the modifying and causes the error? 
--
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-users@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: Modifying form values before redirect

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 2:09 AM, Osiaq  wrote:
> Hi all!
> I'm receiving the form from index.html and redirecting to order.html
> I would like to change "customer" value before redirection.
> When I try to modify it, Im getting "object does not support item
> assignment"
> How can I change "customer" value posted from index.html ?
> Thank you!
>
> --- models.py -
> class Order(models.Model):
>        customer = models.CharField(max_length=20)
>        email = models.EmailField()
>        def __str__(self):
>                return self.customer
>
> class OrderForm(ModelForm):
>        class Meta:
>                model=Order
>
> --- views.py -
> def order(request):
>    form = OrderForm(request.POST)
>    return render_to_response('order.html', {'form':form})
>

request.POST and request.GET are read-only MultiDicts, so if you want
to alter the contents, you would need to duplicate them, and replace
them with read-write copies:

request.POST = request.POST.copy()
request.POST['foo'] = ''bar'

Cheers

Tom

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



Why django not found static files?

2011-02-03 Thread Marc Aymerich
Hi,
I just installed the django-admin-tools app but my django installation
doesn't load the css, js and other static files.

in settings.py I have:
STATIC_ROOT = '/home/ucp/trunk/static/'
STATIC_URL = '/static/'

and when i try to load
http://localhost:8081/static/admin_tools/css/dashboard.css I get a
"page not found" error :(

but this file seems to be in the right directory and have read
permisons for my user!
/home/ucp/trunk/static/admin_tools/css/dashboard.css

what I'm missing?

Thanks!
-- 
Marc

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



Memcache configured, but not used !?

2011-02-03 Thread Ivo Brodien
I did the following to enable memcache:

1 ) install memcache and it is running with default values: /usr/bin/memcached 
-m 64 -p 11211 -u nobody -l 127.0.0.1

2) put a decorator over my view @cache_page(60 * 2)

3) enable cache panel in debug toolbar

The Problem is, that the edebug panel says 0 for all the cache values, so I 
suppose it is not used.

How can I debug this problem further?

I did not put any CacheMiddleware in settings.py cause I think this is not 
necessary with the per-view cache?

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



Re: Django SQL Query does not stop

2011-02-03 Thread Ivo Brodien
Hi Chris,

thanks for the info. My tables won’t have many rows and I don’t have the time 
for optimazation, especially if it is not necessary, but I will keep your words 
in mind!

Cheers
Ivo


On 02.02.2011, at 06:10, Chris Matthews wrote:

> Hi Ivo,
> 
> SQL is like regular expressions. You can go complex (with one mega 
> query/expression) but it could create a maintenance nightmare. See if you 
> cannot simplify the query into multiple queries and a bit of code (for loops 
> and using the joining columns) to lash them together. The code sequence 
> should be such that you limit access to a huge amount of rows; so you filter 
> the data accessed. It is usually easier to debug as well. And using Tom's 
> advice (EXPLAIN SELECT ...) on smaller join queries is often more useful 
> (than the explain on a mega join query).
> 
> In my experience it often runs way faster if the query is simplified.
> 
> Regards
> Chris
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Ivo Brodien
> Sent: 01 February 2011 23:49
> To: django-users@googlegroups.com
> Subject: Re: Django SQL Query does not stop
> 
> I found a solution be changing the MySQL server setting 
> optimizer_search_depth to 3 (default 62)
> 
> http://dev.mysql.com/doc/refman/5.0/en/controlling-optimizer.html
> http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_optimizer_search_depth
> 
> My query had over 20 INNER JOINTS and it made the optimizer search a long 
> process.
> 
> So at the moment a value of 3 is fine.
> 
> On 01.02.2011, at 21:20, Ivo Brodien wrote:
> 
>> The Change List that I am calling is a Intermediate Table if that is of any 
>> interest.
>> 
>> Is it possible that there is some sort of circular inner joints or something?
>> 
>> 
> 
> -- 
> 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 
> 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-users@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-users@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.



Development Server 404 when I POST file

2011-02-03 Thread el-milligano
Hi,

I am using the django development server to locally develop my web
app. I currently have an issue whereby if I POST a file to the webapp
the view that it relates to isn't hit. The reason the view isn't being
matched is that the POST request (reported in the debug output of the
dev web server) still has the hostname attached i.e.

POST http://localhost/mylink

whereas all other requests when they are processed by the web server
are of the form:

GET /mylink

The web server returns a 404 error due to finding a matching view. If
I run my django project under Apache then all is fine.

What am I missing?

Thanks,

Gordon.



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



Re: Memcache configured, but not used !?

2011-02-03 Thread Xavier Ordoquy

Le 3 févr. 2011 à 12:55, Ivo Brodien a écrit :

> I did the following to enable memcache:
> 
> 1 ) install memcache and it is running with default values: 
> /usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1
> 
> 2) put a decorator over my view @cache_page(60 * 2)
> 
> 3) enable cache panel in debug toolbar
> 
> The Problem is, that the edebug panel says 0 for all the cache values, so I 
> suppose it is not used.
> 
> How can I debug this problem further?
> 
> I did not put any CacheMiddleware in settings.py cause I think this is not 
> necessary with the per-view cache?
> 
> Thanks!

Hi,

I assume you configured the cache backend to point to memcache, didn't you ?
Note that it is different from enabling the cache panel.

Regards,
Xavier.

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



Re: Why django not found static files?

2011-02-03 Thread Marc Aymerich
On Thu, Feb 3, 2011 at 12:51 PM, Marc Aymerich  wrote:
> Hi,
> I just installed the django-admin-tools app but my django installation
> doesn't load the css, js and other static files.
>
> in settings.py I have:
> STATIC_ROOT = '/home/ucp/trunk/static/'
> STATIC_URL = '/static/'
>
> and when i try to load
> http://localhost:8081/static/admin_tools/css/dashboard.css I get a
> "page not found" error :(
>
> but this file seems to be in the right directory and have read
> permisons for my user!
> /home/ucp/trunk/static/admin_tools/css/dashboard.css
>
> what I'm missing?


I solve it setting staticfiles_dirs var:

STATICFILES_DIRS = ('/home/ucp/trunk/static/',)


-- 
Marc

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



Attention: Web application developers! Exciting event on Feb 26th in Pune (WebApps 2011)

2011-02-03 Thread arun

Hello,

SiliconIndia is organizing WebApps 2011 at Pune on Feb 26th,
2011.Drawing well-renowned thought-leaders, contributors,
influencer's, and organizations in the Web Development space, the
conference offers insight to develop industry-leading Web Development
projects. The conference brings together web developers, web designers
technology enthusiasts, innovators, vendors, and users to experience
the future of Web Applications.

Web-based applications are revolutionizing both the features that can
be delivered and the technologies for developing and deploying
applications. They also involve a diverse collection of issues and
technologies.We have lined up some of the best speakers and the
sessions & networking will be of the highest order.Get hands-on
technical training and gain new skills. WebApps 2011 guarantees
perfect networking and exciting learning success in workshops,
sessions, discussion panels & fascinating keynotes.

TOPICS:
5 New Skills that Every Web Designer Needs to Know
Progressive CSS3 Design
How to Build a HTML5 Website - Live Demo
Accessibility in Web Design
Icon Design

Who should attend: Web Application Developers, Application Managers,
Web Architects, Web and Graphic Designers, Web Development Managers,
Web Strategists, Web Technologists, Business Strategists, E-commerce
Managers, Product Managers, Technologists and Entrepreneurs and Others

DATE: Feb 26, 2011 (Saturday)
TIME: 8.00 AM to 5.30 PM
VENUE: Pune

We have limited Seats. Registration for this game-changing Symposium
is by invitation only. Attendance is limited to maintain an intimate
setting and foster dialogue among all participants.

To request an invitation, please visit:
http://www.siliconindia.com/events/siliconindia_events/index.php?eid=WebAppPune2011
and complete the  form .

And also you can NOMINATE your colleagues and friends who ever is
interested in attending this event.

We will review your submission and let you know. Once we qualify you,
there will be a registration fee of Rs 500 only. This is towards:
Access to Sessions, Tea/ Coffee & Refreshments and Lunch.

Here's your chance to meet tech leaders and get expert instruction and
hands-on tutorials to create the best web applications, tools, and
software.

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



Re: Memcache configured, but not used !?

2011-02-03 Thread Ivo Brodien
Hi!

> I assume you configured the cache backend to point to memcache, didn't you ?

yes :)

in my settings.py I have



   CACHES = {
   'default': {
   'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
   }
   }


try:
   from local_settings import *
except ImportError:
   pass

and in local_settings.py:

CACHES = {
   'default': {
   'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
   'LOCATION': '127.0.0.1:11211',
   }
}

Which should override the dummycache setting.

However I just checked using ./manage.py shell:

from django.core.cache import cache
print cache


In the shell it is using the locmem which I haven’t configured anywhere... 
strange!

Bye
Ivo

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



Re: Memcache configured, but not used !?

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 12:26 PM, Ivo Brodien  wrote:
> Hi!
>
>> I assume you configured the cache backend to point to memcache, didn't you ?
>
> yes :)
>
> in my settings.py I have
>
>
>
>   CACHES = {
>       'default': {
>           'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
>       }
>   }
>
>
> try:
>   from local_settings import *
> except ImportError:
>   pass
>
> and in local_settings.py:
>
> CACHES = {
>   'default': {
>       'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
>       'LOCATION': '127.0.0.1:11211',
>   }
> }
>
> Which should override the dummycache setting.
>
> However I just checked using ./manage.py shell:
>
> from django.core.cache import cache
> print cache
> 
>
> In the shell it is using the locmem which I haven’t configured anywhere... 
> strange!
>
> Bye
> Ivo
>

You don't specify what version of django you are using. I suspect you
are referring to the trunk/1.3 docs, and using 1.2. In 1.2, the cache
is controlled by settings.CACHE_BACKEND, which defaults to locmem if
omitted.

Cheers

Tom

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



Re: Memcache configured, but not used !?

2011-02-03 Thread Xavier Ordoquy
> from django.core.cache import cache
> print cache
> 
> 
> In the shell it is using the locmem which I haven’t configured anywhere... 
> strange!

I'm not sure it is.
Can you make sure you are using django 1.3 ?
in the shell do:
import django
print django.VERSION

If it says 1, 2, whatever, your configuration isn't correct as CACHES is for 1.3

Xavier.

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



Re: Memcache configured, but not used !?

2011-02-03 Thread Ivo Brodien

On 03.02.2011, at 13:39, Xavier Ordoquy wrote:

> I'm not sure it is.
> Can you make sure you are using django 1.3 ?
> in the shell do:
> import django
> print django.VERSION
> 
> If it says 1, 2, whatever, your configuration isn't correct as CACHES is for 
> 1.3
> 
> Xavier.

ahh! ok. I was looking at the 1.3 docs but using 1.2.4

I will try using : CACHE_BACKEND = 'memcached://127.0.0.1:11211/‘

Thanks a lot!

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



checkbox, how to return state back to html

2011-02-03 Thread gintare
views.py  "if statements" recognize that the box was checked.
I am not able to return the checkbox state back to web.html

I would like to see the last checkbox choices in my page.


web.html

 


views.py
def xxx(request):
cbSMWord  = request.POST.get('cbSMWord ','')
if (cbSMWord): print 'view recognized that checkbox was checked'
#this works

   print 'cbSMWord=', cbSMWord #this gives empty string, why?

   return render_to_response('c:/Python27/Scripts/Spokas/web.html',
{'cbSMWord':cbSMWord}, context_instance = RequestContext(request) )

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



Re: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
i've got that added in and ran a syncdb and i'm stuck on this err:

django.core.exceptions.ImproperlyConfigured:
InventoryAdmin.readonly_fields[0], 'BarCode' is not a callable or an
attribute of 'InventoryAdmin' or found in the model 'Inventory'.

but I'm not seeing anything wrong with my readonly list a in my code.

On Feb 3, 12:31 am, Karl Bowden  wrote:
> On 3 February 2011 16:14, Bobby Roberts  wrote:
>
>
>
> > considering this model:
>
> > class Inventory (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        Barcode = models.BigIntegerField(blank=False)
> >        Location = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Sku = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Quantity = models.DecimalField (blank=False, max_digits=7,
> > default=0,decimal_places=2,help_text='Quanity on barcode')
> >        LastAction = models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('Last Action'), related_name='LastAction',blank=False,
> > null=False)
> >        LastTouchedBy = models.ForeignKey(User, unique=False,
> > db_index=True, blank=False)
> >        LastUpdated = models.DateTimeField
> > (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
> > class InventoryAdmin(admin.ModelAdmin):
> >        list_display =
> > ('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
> >        search_fields = ['Barcode','Location','Sku','LastTouchedBy']
> >        readonly_fields =
>
> > ['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
> > admin.site.register(Inventory,InventoryAdmin)
>
> > two questions.
>
> > 1) LastTouchedBy is the userid - what do i need to do to print out the
> > firstname+lastname of the user in the list_display. (ie instead of
> > printing out userid 123, I want to print out the user's full name,
> > "john doe"
>
> 2) LastAction - I'm importing AppSettings model further up the page,> how can 
> I print out the text value of
> > (AppSettings.InventoryOption.name) in place of the numerical value
> > stored in LastAction
>
> Hi Bobby,
> You might be able to do this with python property decorators for both these
> questions.
>
> Ie:
> class Inventory(models.Model):
>     @property
>     def touched_by_name(self):
>         return self.LastTouchedBy.get_full_name()
>
>     @property
>     def inventory_option_name(self):
>         return self.AppSettings.InventoryOption.name
>
> class InventoryAdmin(admin.ModelAdmin):
>     list_display
> = 
> ('Barcode','Sku','Location','LastAction','inventory_option_name','LastUpdated','touched_by_name',)
>
> - Karl
>
>
>
> > rapid help greatly appreciated.
>
> > --
> > 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
> > 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-users@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: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
nevermind... it was a case issue... you know if python knows there's
an error with case  it would just say "hey check the case here"




On Feb 3, 12:31 am, Karl Bowden  wrote:
> On 3 February 2011 16:14, Bobby Roberts  wrote:
>
>
>
> > considering this model:
>
> > class Inventory (models.Model):
> >        id = models.AutoField (primary_key=True)
> >        Barcode = models.BigIntegerField(blank=False)
> >        Location = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Sku = models.CharField (max_length=25,blank=False,
> > db_index=True)
> >        Quantity = models.DecimalField (blank=False, max_digits=7,
> > default=0,decimal_places=2,help_text='Quanity on barcode')
> >        LastAction = models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('Last Action'), related_name='LastAction',blank=False,
> > null=False)
> >        LastTouchedBy = models.ForeignKey(User, unique=False,
> > db_index=True, blank=False)
> >        LastUpdated = models.DateTimeField
> > (auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
>
> > class InventoryAdmin(admin.ModelAdmin):
> >        list_display =
> > ('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
> >        search_fields = ['Barcode','Location','Sku','LastTouchedBy']
> >        readonly_fields =
>
> > ['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
> > admin.site.register(Inventory,InventoryAdmin)
>
> > two questions.
>
> > 1) LastTouchedBy is the userid - what do i need to do to print out the
> > firstname+lastname of the user in the list_display. (ie instead of
> > printing out userid 123, I want to print out the user's full name,
> > "john doe"
>
> 2) LastAction - I'm importing AppSettings model further up the page,> how can 
> I print out the text value of
> > (AppSettings.InventoryOption.name) in place of the numerical value
> > stored in LastAction
>
> Hi Bobby,
> You might be able to do this with python property decorators for both these
> questions.
>
> Ie:
> class Inventory(models.Model):
>     @property
>     def touched_by_name(self):
>         return self.LastTouchedBy.get_full_name()
>
>     @property
>     def inventory_option_name(self):
>         return self.AppSettings.InventoryOption.name
>
> class InventoryAdmin(admin.ModelAdmin):
>     list_display
> = 
> ('Barcode','Sku','Location','LastAction','inventory_option_name','LastUpdated','touched_by_name',)
>
> - Karl
>
>
>
> > rapid help greatly appreciated.
>
> > --
> > 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
> > 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-users@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: Memcache configured, but not used !?

2011-02-03 Thread Ivo Brodien

On 03.02.2011, at 13:38, Tom Evans wrote:

> You don't specify what version of django you are using. I suspect you
> are referring to the trunk/1.3 docs, and using 1.2. In 1.2, the cache
> is controlled by settings.CACHE_BACKEND, which defaults to locmem if
> omitted.

You are right I am using 1.2.4 (see my previous answer).

Now it seems, that the cach is working although the cache-debug-panel shows 
every values as being 0, but I can tell by the SQL query panel that the 
datebase wasn’t hit.

Just saw that the caches debug panel is not really working:
http://code.google.com/p/django-debug-toolbar/issues/detail?id=13

thanks for helping me out!

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



foreign key issue

2011-02-03 Thread Bobby Roberts
I'm setting up a foreignkey field in my model as follows:

InventoryFunction =
models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('InvFunction'), related_name='InvFunction',blank=False,
null=False)

result from syncdb:


scanning.inventory: Accessor for field 'InventoryFunction' clashes
with related field 'InventoryOption.InvFunction'. Add a related_name
argument to the definition for 'InventoryFunction'.
scanning.inventory: Reverse query name for field 'InventoryFunction'
clashes with related field 'InventoryOption.InvFunction'. Add a
related_name argument to the definition for 'InventoryFunction'.
scanning.inventoryhistory: Accessor for field 'InventoryFunction'
clashes with related field 'InventoryOption.InvFunction'. Add a
related_name argument to the definition for 'InventoryFunction'.
scanning.inventoryhistory: Reverse query name for field
'InventoryFunction' clashes with related field
'InventoryOption.InvFunction'. Add a related_name argument to the
definition for 'InventoryFunction'.


why am i getting these errors when i do have related_name argument
setup?

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



Re: method being called twice?

2011-02-03 Thread Karen Tracey
It's hard to provide useful help when we see only part of the story, and
that story changes over time (e.g. the line of code you identify in the
dpaste posting as being where the error occurs does not match the line of
code seen in the first traceback you posted).

Since you are dealing with a 3rd party system that is calling you, your
method should be coded defensively in order to make sure it doesn't blow up
if called incorrectly. Your method assumes that the caller is always going
to call it properly and supply every bit of post data you are looking for.
One possibility here is that the 3rd party is misbehaving and that is what
is causing the error.

Another possibility is that something your code is doing is causing the 3rd
party to misbehave and sometimes POST with no data to your view.

What's not really a possibility (I would be astonished to hear this
resolution) is that something in Django is taking a single client-generated
POST request and turning it into two: one with the client-provided post data
and one without. That's just not likely to be what's happening here.

I do recall people posting similar problems where their single page fetch
was somehow morphing into multiple calls to their view. One way this can
happen is if there is something (e.g. embedded image with incorrect src
spec) in the HTML that is returned that would cause a client to fetch the
same page again. I notice you are not using RequestContexts when you render
the response, so if there is anything in your templates that relies on
variables set by context processors, that might be causing a problem.

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-users@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: Why django not found static files?

2011-02-03 Thread Brian Neal
On Feb 3, 6:04 am, Marc Aymerich  wrote:
> On Thu, Feb 3, 2011 at 12:51 PM, Marc Aymerich  wrote:
> > Hi,
> > I just installed the django-admin-tools app but my django installation
> > doesn't load the css, js and other static files.
>
> > in settings.py I have:
> > STATIC_ROOT = '/home/ucp/trunk/static/'
> > STATIC_URL = '/static/'
>
> > and when i try to load
> >http://localhost:8081/static/admin_tools/css/dashboard.cssI get a
> > "page not found" error :(
>
> > but this file seems to be in the right directory and have read
> > permisons for my user!
> > /home/ucp/trunk/static/admin_tools/css/dashboard.css
>
> > what I'm missing?
>
> I solve it setting staticfiles_dirs var:
>
> STATICFILES_DIRS = ('/home/ucp/trunk/static/',)
>

STATIC_ROOT is the location of where the management command is going
to place all the static files it collects. So normally (?) I think
you'll want STATIC_ROOT to be a different directory than what you put
in STATICFILES_DIRS. Think of it this way: your non-app specific
static files will appear in a directory that is listed in
STATICFILES_DIRS, your app-specifc files typically would appear under
your_app/static, and all of the static files will be copied to
STATIC_ROOT after running the management command. In production, you'd
likely configure your server to serve files out of STATIC_ROOT.

Hope that helps,

BN

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



Re: foreign key issue

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 1:32 PM, Bobby Roberts  wrote:
> I'm setting up a foreignkey field in my model as follows:
>
>        InventoryFunction =
> models.ForeignKey('AppSettings.InventoryOption',
> verbose_name=_('InvFunction'), related_name='InvFunction',blank=False,
> null=False)
>
> result from syncdb:
>
>
> scanning.inventory: Accessor for field 'InventoryFunction' clashes
> with related field 'InventoryOption.InvFunction'. Add a related_name
> argument to the definition for 'InventoryFunction'.
> scanning.inventory: Reverse query name for field 'InventoryFunction'
> clashes with related field 'InventoryOption.InvFunction'. Add a
> related_name argument to the definition for 'InventoryFunction'.
> scanning.inventoryhistory: Accessor for field 'InventoryFunction'
> clashes with related field 'InventoryOption.InvFunction'. Add a
> related_name argument to the definition for 'InventoryFunction'.
> scanning.inventoryhistory: Reverse query name for field
> 'InventoryFunction' clashes with related field
> 'InventoryOption.InvFunction'. Add a related_name argument to the
> definition for 'InventoryFunction'.
>
>
> why am i getting these errors when i do have related_name argument
> setup?
>

Impossible to tell, since you have omitted half the story. Where is
the definition of InventoryOption, which apparently already has a
field called InvFunction?

Cheers

Tom

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



Re: foreign key issue

2011-02-03 Thread Bobby Roberts
here ya go:


class InventoryOption (models.Model):
id = models.AutoField (primary_key=True)
name = models.CharField (max_length=50, blank=False,
db_index=True)
active = models.IntegerField(blank=False,
choices=active_choices)
order = models.IntegerField(blank=True, default=0)
class InventoryOptionAdmin(admin.ModelAdmin):
list_display = ('name','active','order',)
search_fields = ['name']
admin.site.register(InventoryOption,InventoryOptionAdmin)


class Inventory (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.IntegerField(blank=False)
Location = models.CharField (max_length=25,blank=False,
db_index=True)
Sku = models.CharField (max_length=25,blank=False,
db_index=True)
Quantity = models.DecimalField (blank=False, max_digits=7,
default=0,decimal_places=2,help_text='Quanity on barcode')
InventoryFunction =
models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('InvFunction'),
related_name='inv_function',blank=False, null=False)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')

@property
def touched_by_name(self):
return self.LastTouchedBy.get_full_name()

@property
def inventory_option_name(self):
return self.AppSettings.InventoryOption.name

class InventoryAdmin(admin.ModelAdmin):
list_display =
('Barcode','Sku','Location','inventory_option_name','LastUpdated','touched_by_name',)
search_fields = ['Barcode','Location','Sku','LastTouchedBy']
readonly_fields =
['Barcode','Location','Sku','Quantity','InventoryFunction','LastTouchedBy','LastUpdated']
admin.site.register(Inventory,InventoryAdmin)






On Feb 3, 8:59 am, Tom Evans  wrote:
> On Thu, Feb 3, 2011 at 1:32 PM, Bobby Roberts  wrote:
> > I'm setting up a foreignkey field in my model as follows:
>
> >        InventoryFunction =
> > models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('InvFunction'), related_name='InvFunction',blank=False,
> > null=False)
>
> > result from syncdb:
>
> > scanning.inventory: Accessor for field 'InventoryFunction' clashes
> > with related field 'InventoryOption.InvFunction'. Add a related_name
> > argument to the definition for 'InventoryFunction'.
> > scanning.inventory: Reverse query name for field 'InventoryFunction'
> > clashes with related field 'InventoryOption.InvFunction'. Add a
> > related_name argument to the definition for 'InventoryFunction'.
> > scanning.inventoryhistory: Accessor for field 'InventoryFunction'
> > clashes with related field 'InventoryOption.InvFunction'. Add a
> > related_name argument to the definition for 'InventoryFunction'.
> > scanning.inventoryhistory: Reverse query name for field
> > 'InventoryFunction' clashes with related field
> > 'InventoryOption.InvFunction'. Add a related_name argument to the
> > definition for 'InventoryFunction'.
>
> > why am i getting these errors when i do have related_name argument
> > setup?
>
> Impossible to tell, since you have omitted half the story. Where is
> the definition of InventoryOption, which apparently already has a
> field called InvFunction?
>
> Cheers
>
> Tom

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



store superuser permamently

2011-02-03 Thread Jaroslav Dobrek
Hello,

I often use

manage.py dumpdata --indent 2 > initial_data.json

and then manipulate initial_data.json.

When I remove my database file and run manage.py syncdb almost all
data from inital_data.json are installed. (Many errors only go away
when the database file is removed.) But manage.py asks me each time:

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no):

And then I have to type "yes", type the superuser's name, email
adress ...

When you say "no", the data is correctly installed, but you can't log
in to the admin interface. (I thought a system without a superuser
would not be password protected. What point is there in being able to
not define a superuser, if the system cannot be used without one?)

What do I have to do to avoid having to define a superuser each time?

Jaroslav

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



Re: Why django not found static files?

2011-02-03 Thread Marc Aymerich
On Thu, Feb 3, 2011 at 2:58 PM, Brian Neal  wrote:
> On Feb 3, 6:04 am, Marc Aymerich  wrote:
>> On Thu, Feb 3, 2011 at 12:51 PM, Marc Aymerich  wrote:
>> > Hi,
>> > I just installed the django-admin-tools app but my django installation
>> > doesn't load the css, js and other static files.
>>
>> > in settings.py I have:
>> > STATIC_ROOT = '/home/ucp/trunk/static/'
>> > STATIC_URL = '/static/'
>>
>> > and when i try to load
>> >http://localhost:8081/static/admin_tools/css/dashboard.cssI get a
>> > "page not found" error :(
>>
>> > but this file seems to be in the right directory and have read
>> > permisons for my user!
>> > /home/ucp/trunk/static/admin_tools/css/dashboard.css
>>
>> > what I'm missing?
>>
>> I solve it setting staticfiles_dirs var:
>>
>> STATICFILES_DIRS = ('/home/ucp/trunk/static/',)
>>
>
> STATIC_ROOT is the location of where the management command is going
> to place all the static files it collects. So normally (?) I think
> you'll want STATIC_ROOT to be a different directory than what you put
> in STATICFILES_DIRS. Think of it this way: your non-app specific
> static files will appear in a directory that is listed in
> STATICFILES_DIRS, your app-specifc files typically would appear under
> your_app/static, and all of the static files will be copied to
> STATIC_ROOT after running the management command. In production, you'd
> likely configure your server to serve files out of STATIC_ROOT.
>
> Hope that helps,

Thanks Brian, now I understand what is STATIC_ROOT and STATICFILES_DIRS :)

-- 
Marc

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



Re: foreign key issue

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 2:05 PM, Bobby Roberts  wrote:
> here ya go:
>
>
>...
> models.ForeignKey('AppSettings.InventoryOption',
> verbose_name=_('InvFunction'),
> related_name='inv_function',blank=False, null=False)

So you already changed it?

I can't reproduce this, even when I change the related_name to how you
had it before.

Cheers

Tom

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



Re: store superuser permamently

2011-02-03 Thread Ivo Brodien

> What do I have to do to avoid having to define a superuser each time?

you can dump the data of the auth app and than load it again.

s.th. like this:

./manage.py dumpdata --indent=4 auth  > fixtures/auth.json
./manage.py dumpdata --indent=4 sessions >  fixtures/sessions.json

you can do a manage.py syncdb —noinput so you will not be asked, if you want a 
superuser or not.

If you dump the sessions too you will stay logged in.

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



Re: foreign key issue

2011-02-03 Thread Bobby Roberts
yeah i changed the related name to see if that would make any
difference... the error baffles me.

On Feb 3, 9:18 am, Tom Evans  wrote:
> On Thu, Feb 3, 2011 at 2:05 PM, Bobby Roberts  wrote:
> > here ya go:
>
> >...
> > models.ForeignKey('AppSettings.InventoryOption',
> > verbose_name=_('InvFunction'),
> > related_name='inv_function',blank=False, null=False)
>
> So you already changed it?
>
> I can't reproduce this, even when I change the related_name to how you
> had it before.
>
> Cheers
>
> Tom

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



Re: Django SQL Query does not stop

2011-02-03 Thread Sergiy
Circular joins are indeed a very likely reason which usually points to
a poor model design. In fact I ran into the same problem just
yesterday. I hooked Django admin to a legacy app that had a related
field to table A and related field to table B that was also related to
A. And that created an ever running query from the admin. As changing
db structure was not feasible I had to remove those fields from my
list_display to make it useable.

Also when you have a query hanging like that, inside MySQL shell you
can run `show processlist` and then `kill ` to get
rid of the offending query.

Cheers
Sergiy

On Feb 3, 6:59 am, Ivo Brodien  wrote:
> Hi Chris,
>
> thanks for the info. My tables won’t have many rows and I don’t have the time 
> for optimazation, especially if it is not necessary, but I will keep your 
> words in mind!
>
> Cheers
> Ivo
>
> On 02.02.2011, at 06:10, Chris Matthews wrote:
>
>
>
>
>
>
>
> > Hi Ivo,
>
> > SQL is like regular expressions. You can go complex (with one mega 
> > query/expression) but it could create a maintenance nightmare. See if you 
> > cannot simplify the query into multiple queries and a bit of code (for 
> > loops and using the joining columns) to lash them together. The code 
> > sequence should be such that you limit access to a huge amount of rows; so 
> > you filter the data accessed. It is usually easier to debug as well. And 
> > using Tom's advice (EXPLAIN SELECT ...) on smaller join queries is often 
> > more useful (than the explain on a mega join query).
>
> > In my experience it often runs way faster if the query is simplified.
>
> > Regards
> > Chris
> > -Original Message-
> > From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] 
> > On Behalf Of Ivo Brodien
> > Sent: 01 February 2011 23:49
> > To: django-users@googlegroups.com
> > Subject: Re: Django SQL Query does not stop
>
> > I found a solution be changing the MySQL server setting 
> > optimizer_search_depth to 3 (default 62)
>
> >http://dev.mysql.com/doc/refman/5.0/en/controlling-optimizer.html
> >http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#s...
>
> > My query had over 20 INNER JOINTS and it made the optimizer search a long 
> > process.
>
> > So at the moment a value of 3 is fine.
>
> > On 01.02.2011, at 21:20, Ivo Brodien wrote:
>
> >> The Change List that I am calling is a Intermediate Table if that is of 
> >> any interest.
>
> >> Is it possible that there is some sort of circular inner joints or 
> >> something?
>
> > --
> > 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 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-users@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.



LibGeos in Windows XP

2011-02-03 Thread Norecces
Hi!

Using geodjango at home on ubuntu everything is ok.
but im trying to install it on winXP on my work
and have some problems with lib geos.
Ive installed PostGis.I wrote some code like this:

from django.conf import settings
settings.configure(GEOS_LIBRARY_PATH=r'c:\Python27\DLLs
\libgeos-3-2-2.dll')

where i define my geos path and i have an error:

Traceback (most recent call last):
  File "C:\Documents and Settings\workspace\DjProj\src\DjProj\way
\views.py", line 5, in 
from django.contrib.gis.geos import fromstr, fromfile
  File "C:\Python27\lib\site-packages\django\contrib\gis\geos
\__init__.py", line 6, in 
from django.contrib.gis.geos.geometry import GEOSGeometry,
wkt_regex, hex_regex
  File "C:\Python27\lib\site-packages\django\contrib\gis\geos
\geometry.py", line 14, in 
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
  File "C:\Python27\lib\site-packages\django\contrib\gis\geos
\coordseq.py", line 9, in 
from django.contrib.gis.geos.libgeos import CS_PTR
  File "C:\Python27\lib\site-packages\django\contrib\gis\geos
\libgeos.py", line 97, in 
geos_version = lgeos.GEOSversion
  File "C:\Python27\lib\ctypes\__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'GEOSversion' not found

i do undersand that it is the problem with ctypes but how can i export
this function?
libgeos_c-1.dll  is in the same folder

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



Re: Modifying form values before redirect

2011-02-03 Thread Osiaq
Thank you :)

On Feb 3, 1:41 pm, Tom Evans  wrote:
> On Thu, Feb 3, 2011 at 2:09 AM, Osiaq  wrote:
> > Hi all!
> > I'm receiving the form from index.html and redirecting to order.html
> > I would like to change "customer" value before redirection.
> > When I try to modify it, Im getting "object does not support item
> > assignment"
> > How can I change "customer" value posted from index.html ?
> > Thank you!
>
> > --- models.py -
> > class Order(models.Model):
> >        customer = models.CharField(max_length=20)
> >        email = models.EmailField()
> >        def __str__(self):
> >                return self.customer
>
> > class OrderForm(ModelForm):
> >        class Meta:
> >                model=Order
>
> > --- views.py -
> > def order(request):
> >    form = OrderForm(request.POST)
> >    return render_to_response('order.html', {'form':form})
>
> request.POST and request.GET are read-only MultiDicts, so if you want
> to alter the contents, you would need to duplicate them, and replace
> them with read-write copies:
>
> request.POST = request.POST.copy()
> request.POST['foo'] = ''bar'
>
> Cheers
>
> Tom

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



Re: Modifying form values before redirect

2011-02-03 Thread Osiaq
My bad, sorry! That was simple

form['customer']='modified_customer_name'


On Feb 3, 1:23 pm, Daniel Roseman  wrote:
> On Thursday, February 3, 2011 2:09:56 AM UTC, Osiaq wrote:
>
> > Hi all!
> > I'm receiving the form from index.html and redirecting to order.html
> > I would like to change "customer" value before redirection.
> > When I try to modify it, Im getting "object does not support item
> > assignment"
> > How can I change "customer" value posted from index.html ?
> > Thank you!
>
> > --- models.py -
> > class Order(models.Model):
> > customer = models.CharField(max_length=20)
> > email = models.EmailField()
> > def __str__(self):
> > return self.customer
>
> > class OrderForm(ModelForm):
> > class Meta:
> > model=Order
>
> > --- views.py -
> > def order(request):
> >     form = OrderForm(request.POST)
> >     return render_to_response('order.html', {'form':form})
>
> Why didn't you show the code that does the modifying and causes the error?
> --
> 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-users@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.



help understanding mptt/treebeard

2011-02-03 Thread Tim
hi,
I think mptt or treebeard may be a good fit for my project, but I'm
not sure. Currently I have the project setup in a conventional way
with no explicit tree structure, just a pattern of ForeignKey usage.
It works, but I'm beginning to get into some complexity.

The project is for building (compiling) a large set of documentation.
A 'Library' contains 'Books'; A 'Book' contains 'Chapters';' Chapters'
are made up of 'Files' and 'Files' refer to external 'Images'. Each of
these elements has its own set of configuration parameters.

I'm trying to write an interface for writers to configure 'Books' and/
or 'Chapters', which could mean setting particular configuration
fields for the element, or removing/adding elements into the overall
hierarchy at specific points (maybe a chapter needs to be added as the
13th chapter in a Book, for example).

I have the merest grasp of tree traversal and the associated
mathematics, but from reading the mptt docs, I think that the
application might be the perfect fit for my project.

Can someone confirm or point me to some other documentation to help me
figure this out?
thanks,
--Tim Arnold

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



Re: checkbox, how to return state back to html

2011-02-03 Thread Andy McKay

On 2011-02-03, at 4:46 AM, gintare wrote:
> 

You don't have " around cbSMWord so the full variable name is 'cbSMWord'.

>cbSMWord  = request.POST.get('cbSMWord ','')

You have a space on the end of the variable here. 'cbSMWord ' is not equal to 
'cbSMWord'

>   return render_to_response('c:/Python27/Scripts/Spokas/web.html',
> {'cbSMWord':cbSMWord}, context_instance = RequestContext(request) )

Also, you should not be specifying the full path to templates, let the template 
loader do that for you.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Admin: how to change the default filtering options ?

2011-02-03 Thread Jorge Vargas
Hello,
I'm having the following situation.
I got a model "signup" which has a status field (todo, done,
processing, etc.) I have an admin view for it which should show all
signups and I have a filter that will let me do filter by status.
Therefore the person processing the sigups will just click the "todo"
link and start working. I will like to eliminate this step and just
give me todo signups
This is what I have tired/discarded

1- Overrride the queryset this seems the obvious solution but the same
view should give us access to all signups. To look at the history.
2- Override the ChangeList.get_query_set() however I couldn't see a
proper place to do this
3- Modifying the links to the page provide the right QS (won't work if
people go directly to the URL and they do that a lot)
4- Some really ugly stuff like "clicking" the filter link with JS


The only decent solution I have found to this will be to modify the
queryset to add a "order by status=todo" to the SQL in the backend.
However I will really like for the ChangeList to start with a default
filter that is different from "all".

Any other suggestions?

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



Re: Amazing work

2011-02-03 Thread Jon J
KG,

I've been a PHP developer for years and haven't reached outside of PHP
pretty much ever. After writing the same code over and over and
over and over and over again and always dealing with the same issues
(tweaking the database through a database manager, writing admin
interfaces, not having a broad enough codebase such as what Python
offers, solving the same problem over and over again, etc). I'm a very
disorganized person (it comes with the territory for programmers, I
imagine) and I don't have time to continually categorize and maintain
a personal common code base for every app I write. I love Django
because it cuts out all of the repetitive boring crap from the start
of a project. I'm sure that frameworks are available in PHP that are
similar, but to be honest I like Python a lot better than PHP because
it "feels" like a real programming language, and while PHP has its
virtues, I find myself using Python as often as possible to solve real
problems. Django literally forces me to abstract my code from
templating, which has traditionally been a problem when I've
collaborated with others on projects; designers assume they can code
and end up breaking the entire site. Now, I can delegate template
design entirely to the web designers and they can focus on their job
and I can do mine.


On Wed, Feb 2, 2011 at 10:15 PM, km  wrote:
>
>
> On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves 
> wrote:
>>
>> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
>> > I just stumbled upon django when looking for a good way to use Python
>> > in web programming,
>>
>> welcome to the club - btw, how did you manage to avoid stumbling over
>> django all these years?
>> --
>> regards
>> KG
>> http://lawgon.livejournal.com
>> Coimbatore LUG rox
>> http://ilugcbe.techstud.org
>
> Hi KG,
>
> Pls dont drag the post unnecessarily. This is not your ilugc mailing list.
>
> KM
>>
>> 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
>> 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-users@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-users@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 Why CSS File Will Not Load

2011-02-03 Thread octopusgrabbus
Firebug shows the page, and the page changes to the color I set, if I
click on sections in the Firebug window. Not sure what is going on
with that.

On Feb 2, 5:31 pm, Jon J  wrote:
> Firebug is a great tool for diagnosing problems like this, and
> Chromium has even better functionality built in!
>
> This problem is being caused by an improper configuration setting, IMO.
>
> Also, the preferred method of deployment is to use the same virtual
> host and create an Alias directive for /media
>
> On Wed, Feb 2, 2011 at 1:21 PM, Eric Chamberlain  wrote:
> > Your port numbers don't match.
>
> > What does Firebug or some other html debug tool say about the file?
>
> > On Feb 2, 2011, at 10:55 AM, octopusgrabbus wrote:
>
> >> I am trying to load static content (one css file) from the same apache
> >> server, using a different virtual host. I have no errors, but the css
> >> file appears not to load. How can I debug this further?
>
> >> The load shows up in /var/log/apache2/other_vhosts_access.log:
>
> >> Here are settings from httpd.conf.
>
> >> Listen 12345
> >> 
>
> >> DocumentRoot /usr/local/www/documents/static
>
> >> 
>
> >> I am loading the PageStyle.css file from a template. The css file  is
> >> in the static directory:
>
> >> Here is base.html that loads PageStyle.css
>
> >>  
> >>        {% block title %}Town of Arlington Water Department AMR
> >> System{% endblock %} 
> >>        
>
> >>   
>
> >> and the appropriate lines from settings.py
>
> >> # URL that handles the media served from MEDIA_ROOT
> >> MEDIA_URL = 'http://steamboy:8082'
>
> >> PageStyle.css is set to display Windows Gray 0x808080.
>
> >> other_vhosts_access.log
>
> >> --
> >> 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 
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group 
> >> athttp://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-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-users@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.



matching a domain name in urls.py

2011-02-03 Thread mike171562
I am building an app that passes a domain name to urls.py like so   "/
sites/domain.com/'

but I cannot get my urls.py to match the 'domain.com'  it only seems
to match if i just use domain without the dot

I have tried

(r'^zones/^[^/]+/', get_domain),
(r'^zones/(?P\w+)/', get_domain),
(r'^zones/(?P\w+)$', get_domain),

and none seem to be able to catch 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-users@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: matching a domain name in urls.py

2011-02-03 Thread mike171562
I think i got it now with

(r'^zones/(?P[.\w]+)/$', get_domain)


On Feb 3, 10:44 am, mike171562  wrote:
> I am building an app that passes a domain name to urls.py like so   "/
> sites/domain.com/'
>
> but I cannot get my urls.py to match the 'domain.com'  it only seems
> to match if i just use domain without the dot
>
> I have tried
>
>     (r'^zones/^[^/]+/', get_domain),
>     (r'^zones/(?P\w+)/', get_domain),
>     (r'^zones/(?P\w+)$', get_domain),
>
> and none seem to be able to catch 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-users@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: Model Forms Customization

2011-02-03 Thread hank23
Thanks. I'll take a look at the articles.

On Feb 2, 3:42 am, Derek  wrote:
> The same question was asked on 
> stackoverflow:http://stackoverflow.com/questions/2303268/djangos-forms-form-vs-form...
> Its a good explanation - I liked the bit at the end:
> "The similarities are that they both generate sets of form inputs
> using widgets, and both validate data sent by the browser. The
> differences are that ModelForm gets its field definition from a
> specified model class, and so has methods that deal with saving of the
> underlying model to the database."
>
> If you want to know *why* it was created, this post has some of the
> history:http://mirobetm.blogspot.com/2008/03/django-modelform-replacement-for...
> (and there a number of others from other folk along the same lines)
>
> And, yes, reading more documentation (which, in the case of Django, is
> actually enjoyable) is a Good Thing.
>
> On Jan 31, 7:37 pm, hank23  wrote:
>
>
>
> > I think I've read most of the documentation on Model Forms, but I
> > haven't seen much on how to customize them, other than changing the
> > order in which fields are displayed, or not displaying some fields at
> > all. The one ModelForm which I've done so far does not look very good
> > as it is automatically generated. If they can't be customized very
> > easily or very much then I'm not sure I see any big advantage in using
> > them as opposed to just using regular forms, that I can more easily
> > customize. Am I missing something or have I not read enough of the
> > documentation?- Hide quoted text -
>
> - Show quoted text -

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



Re: matching a domain name in urls.py

2011-02-03 Thread Jirka Vejrazka
> I am building an app that passes a domain name to urls.py like so   "/
> sites/domain.com/'
>
> but I cannot get my urls.py to match the 'domain.com'  it only seems
> to match if i just use domain without the dot
>
> I have tried
>
>    (r'^zones/^[^/]+/', get_domain),
>    (r'^zones/(?P\w+)/', get_domain),
>    (r'^zones/(?P\w+)$', get_domain),
>
> and none seem to be able to catch it


Just curious - did you notice that you have "sites" in the question,
but "zones" in the urls.py?

And the obvious question - did you know that dot has a special meaning
in regular expressions so you probably want to write "\."
(backslash-dot).

  Just my 2 cents

Jirka

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



Re: matching a domain name in urls.py

2011-02-03 Thread Tom Evans
On Thu, Feb 3, 2011 at 4:50 PM, mike171562  wrote:
> I think i got it now with
>
> (r'^zones/(?P[.\w]+)/$', get_domain)
>
>

. matches any character, not just dot. Your class '[.\w]+' will
actually match anything and everything. I think you want '[\.\w]'.

Cheers

Tom

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



Re: Debugging Why CSS File Will Not Load

2011-02-03 Thread Andres Lucena
On Wed, Feb 2, 2011 at 7:55 PM, octopusgrabbus
 wrote:
> I am trying to load static content (one css file) from the same apache
> server, using a different virtual host. I have no errors, but the css
> file appears not to load. How can I debug this further?
>
> The load shows up in /var/log/apache2/other_vhosts_access.log:
>
> Here are settings from httpd.conf.
>
> Listen 12345
> 
>
> DocumentRoot /usr/local/www/documents/static
>
> 
>
> I am loading the PageStyle.css file from a template. The css file  is
> in the static directory:
>
> Here is base.html that loads PageStyle.css
>
>  
>        {% block title %}Town of Arlington Water Department AMR
> System{% endblock %} 
>        
>
>   
>
> and the appropriate lines from settings.py
>
>
> # URL that handles the media served from MEDIA_ROOT
> MEDIA_URL = 'http://steamboy:8082'
>


First, I'd check if the apache is working, if you go to

http://steamboy:8082/PageStyle.css

Do you see the CSS?

Also, what you see when you see the HTML source code? Is that URL?

See you,
Andres


>
> PageStyle.css is set to display Windows Gray 0x808080.
>
>
>
>
> other_vhosts_access.log
>
> --
> 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 
> 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-users@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: Amazing work

2011-02-03 Thread Cal Leeming [Simplicity Media Ltd]
You know, even if PHP had a framework like Django, I wouldn't use it. PHP is
clunky, has horrible code syntax, piss poor exception handling, awful
garbage collection, weirdly named functions, and just feels 'wrong'. And
don't even get me started on performance!

On Thu, Feb 3, 2011 at 4:13 PM, Jon J  wrote:

> KG,
>
> I've been a PHP developer for years and haven't reached outside of PHP
> pretty much ever. After writing the same code over and over and
> over and over and over again and always dealing with the same issues
> (tweaking the database through a database manager, writing admin
> interfaces, not having a broad enough codebase such as what Python
> offers, solving the same problem over and over again, etc). I'm a very
> disorganized person (it comes with the territory for programmers, I
> imagine) and I don't have time to continually categorize and maintain
> a personal common code base for every app I write. I love Django
> because it cuts out all of the repetitive boring crap from the start
> of a project. I'm sure that frameworks are available in PHP that are
> similar, but to be honest I like Python a lot better than PHP because
> it "feels" like a real programming language, and while PHP has its
> virtues, I find myself using Python as often as possible to solve real
> problems. Django literally forces me to abstract my code from
> templating, which has traditionally been a problem when I've
> collaborated with others on projects; designers assume they can code
> and end up breaking the entire site. Now, I can delegate template
> design entirely to the web designers and they can focus on their job
> and I can do mine.
>
>
> On Wed, Feb 2, 2011 at 10:15 PM, km  wrote:
> >
> >
> > On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves <
> law...@thenilgiris.com>
> > wrote:
> >>
> >> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
> >> > I just stumbled upon django when looking for a good way to use Python
> >> > in web programming,
> >>
> >> welcome to the club - btw, how did you manage to avoid stumbling over
> >> django all these years?
> >> --
> >> regards
> >> KG
> >> http://lawgon.livejournal.com
> >> Coimbatore LUG rox
> >> http://ilugcbe.techstud.org
> >
> > Hi KG,
> >
> > Pls dont drag the post unnecessarily. This is not your ilugc mailing
> list.
> >
> > KM
> >>
> >> 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
> >> 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-users@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-users@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-users@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: matching a domain name in urls.py

2011-02-03 Thread Cal Leeming [Simplicity Media Ltd]
Hi Mike,

May I suggest RegexBuddy for anything regex related in the future, it have
saved me a *lot* of time!

Cal

On Thu, Feb 3, 2011 at 4:44 PM, mike171562 wrote:

> I am building an app that passes a domain name to urls.py like so   "/
> sites/domain.com/'
>
> but I cannot get my urls.py to match the 'domain.com'  it only seems
> to match if i just use domain without the dot
>
> I have tried
>
>(r'^zones/^[^/]+/', get_domain),
>(r'^zones/(?P\w+)/', get_domain),
>(r'^zones/(?P\w+)$', get_domain),
>
> and none seem to be able to catch 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-users@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-users@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: matching a domain name in urls.py

2011-02-03 Thread Cal Leeming [Simplicity Media Ltd]
Here you go: http://www.regexbuddy.com/screen.html

On Thu, Feb 3, 2011 at 4:55 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi Mike,
>
> May I suggest RegexBuddy for anything regex related in the future, it have
> saved me a *lot* of time!
>
> Cal
>
>
> On Thu, Feb 3, 2011 at 4:44 PM, mike171562 wrote:
>
>> I am building an app that passes a domain name to urls.py like so   "/
>> sites/domain.com/'
>>
>> but I cannot get my urls.py to match the 'domain.com'  it only seems
>> to match if i just use domain without the dot
>>
>> I have tried
>>
>>(r'^zones/^[^/]+/', get_domain),
>>(r'^zones/(?P\w+)/', get_domain),
>>(r'^zones/(?P\w+)$', get_domain),
>>
>> and none seem to be able to catch 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-users@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-users@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: matching a domain name in urls.py

2011-02-03 Thread Łukasz Rekucki
> On Thu, Feb 3, 2011 at 4:50 PM, mike171562  wrote:
>> I think i got it now with
>>
>> (r'^zones/(?P[.\w]+)/$', get_domain)

Depending on what you plan to do with the matched string later, you
may want to limit it to 256 characters or incorporate some more
checks, like:

r"^zones/(?P(?:[A-Za-z-]{1,63}\.){0,4}(?:[A-Za-z-]{1,63}))"

On 3 February 2011 17:52, Tom Evans  wrote:
>
> . matches any character, not just dot. Your class '[.\w]+' will
> actually match anything and everything. I think you want '[\.\w]'.
>

Not if used in a character class:

>>> re.match("[.]", ".")
<_sre.SRE_Match object at 0xb72fe330>
>>> re.match("[.]", "1")



-- 
Łukasz Rekucki

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



Re: matching a domain name in urls.py

2011-02-03 Thread Tom Evans
2011/2/3 Łukasz Rekucki :
> On 3 February 2011 17:52, Tom Evans  wrote:
>>
>> . matches any character, not just dot. Your class '[.\w]+' will
>> actually match anything and everything. I think you want '[\.\w]'.
>>
>
> Not if used in a character class:
>
 re.match("[.]", ".")
> <_sre.SRE_Match object at 0xb72fe330>
 re.match("[.]", "1")
>

Ooops, my bad! Thanks for clarifying.

Cheers

Tom

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



Re: help understanding mptt/treebeard

2011-02-03 Thread Jason
"maybe a chapter needs to be added as the
13th chapter in a Book, for example"

MPTT and the other trees are mainly used on data structures where node
insertion might happen anywhere on a tree.
In your case, you only put chapters in books and would never move a
chapter inside of a 'Library' or inside a 'File'.

In other words these trees are all made up of the same node type - the
typical example would be a 'Category'.
Categories can have subcategories, which have sub-subcategories, etc.

I'm not an expert but to me it doesn't look like you'd get much gain
from using MPTT in this situation.


On Feb 3, 7:58 am, Tim  wrote:
> hi,
> I think mptt or treebeard may be a good fit for my project, but I'm
> not sure. Currently I have the project setup in a conventional way
> with no explicit tree structure, just a pattern of ForeignKey usage.
> It works, but I'm beginning to get into some complexity.
>
> The project is for building (compiling) a large set of documentation.
> A 'Library' contains 'Books'; A 'Book' contains 'Chapters';' Chapters'
> are made up of 'Files' and 'Files' refer to external 'Images'. Each of
> these elements has its own set of configuration parameters.
>
> I'm trying to write an interface for writers to configure 'Books' and/
> or 'Chapters', which could mean setting particular configuration
> fields for the element, or removing/adding elements into the overall
> hierarchy at specific points (maybe a chapter needs to be added as the
> 13th chapter in a Book, for example).
>
> I have the merest grasp of tree traversal and the associated
> mathematics, but from reading the mptt docs, I think that the
> application might be the perfect fit for my project.
>
> Can someone confirm or point me to some other documentation to help me
> figure this out?
> thanks,
> --Tim Arnold

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



Re: Possible bug in model validation

2011-02-03 Thread Miguel Araujo
Las try or I will report it as a bug as I think it is.

2011/1/28 Miguel Araujo 

> Well,
>
> I'm just trying to figure out if this should be reported.
>
> Thanks, regards
>
> 
> Miguel Araujo
> @maraujop
>
> 2011/1/22 Miguel Araujo 
>
> Hi everyone,
>>
>> I have a model A that has a overwritten save method that updates a model
>> B's field. Both (A & B) have model validation using full_clean method.
>> Problem is that B model's validation fails when updating the field, because
>> it raises an IntegrityError saying the primary key already exits,
>> obviously.
>>
>> To fix this within my save method I have done:
>>
>> if kwargs.get('force_update') is False:
>> self.full_clean()
>>
>> If this is the desired behavior, then just let me know, I don't think the
>> primary key on an update should be validated this way.
>>
>> Thanks, best regards
>>
>> 
>> Miguel Araujo
>> @maraujop
>>
>
>

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



IE, CSRF and admin login

2011-02-03 Thread MikeKJ

obviously using django contrib auth

works fine in Firefox but IE8 keeps throwing CSRF token error on attempting
to log into the admin interface.

No admin templates have been altered

using django 1.2.3 in pythonpath

even tried changing internet options to allow all cookies!!!

tried creating a custom middleware to dont_enforce_csrf_checks but then IE
insisted that I wasn't allowing cookies see above!!!

has anyone got a solution please?
preferably enabling IE8 to log in without without having to import a copy of
django onto the site and hacking the templates and views to get rid of the
CSRF

Cheers

-- 
View this message in context: 
http://old.nabble.com/IE%2C-CSRF-and-admin-login-tp30837588p30837588.html
Sent from the django-users mailing list archive at Nabble.com.

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



Delete/Update Memcache in 1.2.4?

2011-02-03 Thread Ivo Brodien
Which key is used in 1.2.4 to create the memcache keys?

I am having some html in my database whose keys I want to delete from the 
memcache after they have been saved (or via admin actions)

I don’t know how to get their keys and even doing a cache.clear() in the action 
and console did not delete anything from the cache.

If I were using 1.3 I could just define my own keys using KEY_FUNCTION, but in 
1.2. I can’t do that.

Doing some telnet to memcach I found out that the keys are very long and that 
they include the path.to.view and some odd numbers (probably session keys or 
something)

How can I disable this behavior? For it would be fine, if the key was just 
‘/pages/about’

Thank you for helping (once again)





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



Error: cannot import name SpooledTemporaryFile

2011-02-03 Thread b...@live.se
Hi all , I install dionaea on my Debian 5.0 (VM)
when i run carniwwwhore :

debian:/opt/carniwwwhore# python manage.py runserver
Error: cannot import name SpooledTemporaryFile

debian:/opt/carniwwwhore# python --version
Python 2.5.2

any idea ? 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error: cannot import name SpooledTemporaryFile

2011-02-03 Thread Daniel Roseman
On Thursday, February 3, 2011 6:55:56 PM UTC, b...@live.se wrote:
>
> Hi all , I install dionaea on my Debian 5.0 (VM) 
> when i run carniwwwhore : 
>
> debian:/opt/carniwwwhore# python manage.py runserver 
> Error: cannot import name SpooledTemporaryFile 
>
> debian:/opt/carniwwwhore# python --version 
> Python 2.5.2 
>
> any idea ? thanks


What are dionaea and carniwwwhore?
--
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-users@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: Django model object allocation performance

2011-02-03 Thread oyiptong
Yeah, it was just an example

On Feb 2, 4:28 am, Daniel Roseman  wrote:
> On Tuesday, February 1, 2011 11:52:49 PM UTC, oyiptong wrote:
>
> > Hello,
>
> > I have been seeing a big performance degradation with my application
> > in production.
> > The traffic is roughly 2.5K pageviews per day. I can expect each page
> > to load 100 model objects in memory.
>
> > Some might overlap, but I have a large inventory of objects to show.
>
> > I have noticed that pages have been taking longer and longer to load,
> > at a point where its unacceptable.
> > Looking at the wsgi processes, i found that they a request seems to be
> > taking up a large amount of CPU usage.
>
> > I've been poking around to see how I could improve things, and I've
> > noticed this behavior:
>
> > from project.app.models import Model
> > m = Model.objects.all()[200:300]
> > len(list(m))
>
> > This takes several seconds.
>
> > from project.app.models import Model
> > m = Model.objects.all()[400:500]
> > len(list(m.values()))
>
> > This is much faster. If you're gonna try it, make sure you choose a
> > range of objects that are not already in memory.
>
> > Is the only difference between the two object allocation?
> > If object allocation is what is costing me so much CPU power, how can
> > I get around it?
> > Is using the values method the only option?
>
> Is `len` just an example? If that's really all you need, you should be using
> m.count() instead.
> --
> 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-users@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: Django model object allocation performance

2011-02-03 Thread oyiptong
That was exactly my point. I got around my issue by just using the
dictionaries all over my application.

This did bypass the creation of the objects. My cpu usage and load
average went to drastically.

On Feb 2, 4:33 am, Thomas Weholt  wrote:
> I might be missing something here, but in the first example you do:
>
> len(list(m))
>
> and the next example you do:
>
> len(list(m.values()))
>
> As far as I know, calling .values() will bypass the creation of Django
> ORM objects and just return a dictionary for each record instead of a
> model instance. This is much more efficient if you just need the
> values anyway.
>
> Regards,
> Thomas
>
>
>
>
>
>
>
>
>
> On Wed, Feb 2, 2011 at 10:28 AM, Daniel Roseman  wrote:
> > On Tuesday, February 1, 2011 11:52:49 PM UTC, oyiptong wrote:
>
> >> Hello,
>
> >> I have been seeing a big performance degradation with my application
> >> in production.
> >> The traffic is roughly 2.5K pageviews per day. I can expect each page
> >> to load 100 model objects in memory.
>
> >> Some might overlap, but I have a large inventory of objects to show.
>
> >> I have noticed that pages have been taking longer and longer to load,
> >> at a point where its unacceptable.
> >> Looking at the wsgi processes, i found that they a request seems to be
> >> taking up a large amount of CPU usage.
>
> >> I've been poking around to see how I could improve things, and I've
> >> noticed this behavior:
>
> >> from project.app.models import Model
> >> m = Model.objects.all()[200:300]
> >> len(list(m))
>
> >> This takes several seconds.
>
> >> from project.app.models import Model
> >> m = Model.objects.all()[400:500]
> >> len(list(m.values()))
>
> >> This is much faster. If you're gonna try it, make sure you choose a
> >> range of objects that are not already in memory.
>
> >> Is the only difference between the two object allocation?
> >> If object allocation is what is costing me so much CPU power, how can
> >> I get around it?
> >> Is using the values method the only option?
>
> > Is `len` just an example? If that's really all you need, you should be using
> > m.count() instead.
> > --
> > 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-users@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.
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org

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



Custom/Inclusion Tags

2011-02-03 Thread J
Is there a way to access kwargs from a custom/inclusion 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Amazing work

2011-02-03 Thread Jon J
Well, PHP does have its intended purpose and accomplishes its
objectives nicely. If you're building a one-shot, off-the-cuff
application with no forethought to design or scalability, then PHP is
great. It's not hard for novices to use (object orientation is
optional, etc) and uses a much easier to visualize traditional
filesystem model. A lot of web developers don't care to deal with
exception handling or garbage collection, and it rarely makes a
difference to the their task at hand. I understand that this is of
course very slippery slope logic that gives rise to real turds like
Cold Fusion, but for a good percentage of web applications, PHP is
enough like a real programming language to get the job done without
too much hassle.

That being said, I prefer Python :-) It's a much more mature language
that seems to "fit" a bit better with me. It's also noticeably faster
for a lot of the text processing engines I write.

On Thu, Feb 3, 2011 at 10:53 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> You know, even if PHP had a framework like Django, I wouldn't use it. PHP is
> clunky, has horrible code syntax, piss poor exception handling, awful
> garbage collection, weirdly named functions, and just feels 'wrong'. And
> don't even get me started on performance!
> On Thu, Feb 3, 2011 at 4:13 PM, Jon J  wrote:
>>
>> KG,
>>
>> I've been a PHP developer for years and haven't reached outside of PHP
>> pretty much ever. After writing the same code over and over and
>> over and over and over again and always dealing with the same issues
>> (tweaking the database through a database manager, writing admin
>> interfaces, not having a broad enough codebase such as what Python
>> offers, solving the same problem over and over again, etc). I'm a very
>> disorganized person (it comes with the territory for programmers, I
>> imagine) and I don't have time to continually categorize and maintain
>> a personal common code base for every app I write. I love Django
>> because it cuts out all of the repetitive boring crap from the start
>> of a project. I'm sure that frameworks are available in PHP that are
>> similar, but to be honest I like Python a lot better than PHP because
>> it "feels" like a real programming language, and while PHP has its
>> virtues, I find myself using Python as often as possible to solve real
>> problems. Django literally forces me to abstract my code from
>> templating, which has traditionally been a problem when I've
>> collaborated with others on projects; designers assume they can code
>> and end up breaking the entire site. Now, I can delegate template
>> design entirely to the web designers and they can focus on their job
>> and I can do mine.
>>
>>
>> On Wed, Feb 2, 2011 at 10:15 PM, km  wrote:
>> >
>> >
>> > On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves
>> > 
>> > wrote:
>> >>
>> >> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
>> >> > I just stumbled upon django when looking for a good way to use Python
>> >> > in web programming,
>> >>
>> >> welcome to the club - btw, how did you manage to avoid stumbling over
>> >> django all these years?
>> >> --
>> >> regards
>> >> KG
>> >> http://lawgon.livejournal.com
>> >> Coimbatore LUG rox
>> >> http://ilugcbe.techstud.org
>> >
>> > Hi KG,
>> >
>> > Pls dont drag the post unnecessarily. This is not your ilugc mailing
>> > list.
>> >
>> > KM
>> >>
>> >> 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
>> >> 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-users@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-users@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-users@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" gr

No POST response when using checkbox form

2011-02-03 Thread Ethan Yandow
Hey there, I am trying to delete Events as chosen by a by a user using
check boxes to check of which events they want to be deleted.  But for
some reason whenever I call request.POST.get('event_list') Nothing is
received even though boxes are checked and I end up with nothing.
Here is my template and the view that should be deleting the chosen
events.

 {% if event_list %}
{% for event in event_list%}
{%csrf_token%}

{{ event.title }}
{% endfor %}


{{removal}}{%comment%} this is what should be
removed{%endcomment%}
{% if delete_error %}
{{delete_error}}
{% endif %}

views.py

def EventDelete(request):
removal = request.POST.get('event_list')
if removal:
removal.delete()
else:
delete_error = "You didn't delete anything"
return redner_to_response("detail.html", {'delete_error':
delete_error, 'removal': removal},
context_instance=RequestContext(request))

Im not sure why removal doesn't have anything in it, shouldn't it have
the titles of the events in 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-users@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: Amazing work

2011-02-03 Thread Kenneth Gonsalves
I am a hobbyist programmer started with pascal and then perl. Loved
perl, but once I had to hire a programmer to do some enhancements that I
did not have time for - he did a good job, but after he left I found I
could not understand a word of what he had done. Then someone introduced
me to python and I never looked back. Spent some time wandering in the
zope world and then in 2005 I stumbled onto Django - end of wandering,
beginning of being real productive.

On Thu, 2011-02-03 at 10:13 -0600, Jon J wrote:
> KG,
> 
> I've been a PHP developer for years and haven't reached outside of PHP
> pretty much ever. After writing the same code over and over and
> over and over and over again and always dealing with the same issues
> (tweaking the database through a database manager, writing admin
> interfaces, not having a broad enough codebase such as what Python
> offers, solving the same problem over and over again, etc). I'm a very
> disorganized person (it comes with the territory for programmers, I
> imagine) and I don't have time to continually categorize and maintain
> a personal common code base for every app I write. I love Django
> because it cuts out all of the repetitive boring crap from the start
> of a project. I'm sure that frameworks are available in PHP that are
> similar, but to be honest I like Python a lot better than PHP because
> it "feels" like a real programming language, and while PHP has its
> virtues, I find myself using Python as often as possible to solve real
> problems. Django literally forces me to abstract my code from
> templating, which has traditionally been a problem when I've
> collaborated with others on projects; designers assume they can code
> and end up breaking the entire site. Now, I can delegate template
> design entirely to the web designers and they can focus on their job
> and I can do mine.
> 
> 
> On Wed, Feb 2, 2011 at 10:15 PM, km  wrote:
> >
> >
> > On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves 
> > wrote:
> >>
> >> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
> >> > I just stumbled upon django when looking for a good way to use Python
> >> > in web programming,
> >>
> >> welcome to the club - btw, how did you manage to avoid stumbling over
> >> django all these years?
> >> --
> >> regards
> >> KG
> >> http://lawgon.livejournal.com
> >> Coimbatore LUG rox
> >> http://ilugcbe.techstud.org
> >
> > Hi KG,
> >
> > Pls dont drag the post unnecessarily. This is not your ilugc mailing list.
> >
> > KM
> >>
> >> 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
> >> 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-users@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.
> >
> 


-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



jquery grid and django

2011-02-03 Thread Tony
I found a plugin that combines the two but you cant look at the source
unless you have been approved by the creator.  Is there any viable,
simple way to use the jquery grid plugin with django fairly quickly?

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



Re: Custom/Inclusion Tags

2011-02-03 Thread Cal Leeming [Simplicity Media Ltd]
Sorry I don't quite understand what you mean, can you give a code example of
what you are trying to do / wish for it to do?

On Thu, Feb 3, 2011 at 9:41 PM, J  wrote:

> Is there a way to access kwargs from a custom/inclusion 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
> 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-users@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: Amazing work

2011-02-03 Thread Cal Leeming [Simplicity Media Ltd]
May I ask, how well did you get along with Zope? From what I can tell,
Django is suited for SME, where as Zope is the kinda thing that banks would
be using etc.

On Fri, Feb 4, 2011 at 12:50 AM, Kenneth Gonsalves
wrote:

> I am a hobbyist programmer started with pascal and then perl. Loved
> perl, but once I had to hire a programmer to do some enhancements that I
> did not have time for - he did a good job, but after he left I found I
> could not understand a word of what he had done. Then someone introduced
> me to python and I never looked back. Spent some time wandering in the
> zope world and then in 2005 I stumbled onto Django - end of wandering,
> beginning of being real productive.
>
> On Thu, 2011-02-03 at 10:13 -0600, Jon J wrote:
> > KG,
> >
> > I've been a PHP developer for years and haven't reached outside of PHP
> > pretty much ever. After writing the same code over and over and
> > over and over and over again and always dealing with the same issues
> > (tweaking the database through a database manager, writing admin
> > interfaces, not having a broad enough codebase such as what Python
> > offers, solving the same problem over and over again, etc). I'm a very
> > disorganized person (it comes with the territory for programmers, I
> > imagine) and I don't have time to continually categorize and maintain
> > a personal common code base for every app I write. I love Django
> > because it cuts out all of the repetitive boring crap from the start
> > of a project. I'm sure that frameworks are available in PHP that are
> > similar, but to be honest I like Python a lot better than PHP because
> > it "feels" like a real programming language, and while PHP has its
> > virtues, I find myself using Python as often as possible to solve real
> > problems. Django literally forces me to abstract my code from
> > templating, which has traditionally been a problem when I've
> > collaborated with others on projects; designers assume they can code
> > and end up breaking the entire site. Now, I can delegate template
> > design entirely to the web designers and they can focus on their job
> > and I can do mine.
> >
> >
> > On Wed, Feb 2, 2011 at 10:15 PM, km  wrote:
> > >
> > >
> > > On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves <
> law...@thenilgiris.com>
> > > wrote:
> > >>
> > >> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
> > >> > I just stumbled upon django when looking for a good way to use
> Python
> > >> > in web programming,
> > >>
> > >> welcome to the club - btw, how did you manage to avoid stumbling over
> > >> django all these years?
> > >> --
> > >> regards
> > >> KG
> > >> http://lawgon.livejournal.com
> > >> Coimbatore LUG rox
> > >> http://ilugcbe.techstud.org
> > >
> > > Hi KG,
> > >
> > > Pls dont drag the post unnecessarily. This is not your ilugc mailing
> list.
> > >
> > > KM
> > >>
> > >> 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
> > >> 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-users@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.
> > >
> >
>
>
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org/
>
> --
> 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
> 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-users@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: jquery grid and django

2011-02-03 Thread Casey Greene
I have not specifically used jquerygrid but it looks like it will 
request the data from a URL and all that you need to do is set up a view 
there to return the proper json objects to it.


It is basically like any other django view, just that you would be 
returning json instead of html.  I have been using datatables:

http://www.datatables.net/
with the same strategy and have found it relatively straightforward, so 
if you already know how to use django it shouldn't be too much different 
-- just json instead of html gets returned.


Hopefully this helps,
Casey

On 02/03/2011 07:50 PM, Tony wrote:

I found a plugin that combines the two but you cant look at the source
unless you have been approved by the creator.  Is there any viable,
simple way to use the jquery grid plugin with django fairly quickly?



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



Re: Possible bug in model validation

2011-02-03 Thread Karen Tracey
On Thu, Feb 3, 2011 at 12:30 PM, Miguel Araujo  wrote:

> Las try or I will report it as a bug as I think it is.
>

Your original post was a bit sparse on code/traceback details for the actual
problem you observed. The only specific code you showed was the lines you
added to work around the problem. More details on the actual problem
(traceback, and under what circumstances it happens) and the code that
triggers it might help motivate someone to try to figure out whether what
you are trying to report is a bug or not. That's what I would need to see to
try to assess, and I have not had the time to go manufacture the missing
details based on the prose description.

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-users@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.



Submitting Django forms with AJAX

2011-02-03 Thread mf
I want to have a little feedback form in one of my views but I can't
get it to work. I put a pdb.set_trace() to debug the views but when I
click submit the view reloads and never gets into the if
request.method == 'POST' and... code section. I'm very confused about
how to approach ajax forms submission with django. When I want to make
somthing like update a db value clicking in a button(i.e: votes) I can
create another view for handling the ajax call, but in this case I've
to generate the empty form in the original view, so I guess I can't
create another one to handle the ajax call.

views.py:

def results(request, query):
# View code outside the form
ipcs_selected = request.session['ipcs_requested']
query2 = ' | '.join(query.split())
base_query = '@title (%s)' % (query2)

# code that I want to run when the user submit's the form
results = {'success': False }
if request.method == u'POST' and request.is_ajax():
form = FeedBackForm(request.POST)
POST = request.POST
# work with the form
if form.is_valid():
results = {'success':True}
json = simplejson.dumps(results)
return HttpResponse(json, mimetype='application/json')
else:
form = FeedBackForm()


return render_to_response('results.html',
{'patents': patents, 'query': query, 'bq': base_query,
'form':
form},
context_instance=RequestContext(request))

results.html:


function submit_form() {
$.post("/results/{{query}}/", { query:{{ query }}, full:
{{full_query }} }, function(json){
alert("Success?: " + json['success']);
});
}
function addClickHandlers() {
$("#submit").click( function() { submit_form() });
}
$(document).ready(addClickHandlers);
  

  
  Relevant results?
  {{ form.relevance }}
  Up to which page?
  {{ form.rel_pages }}
  
  

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



Re: Submitting Django forms with AJAX

2011-02-03 Thread Shawn Milochik
What's the dev server output when the AJAX call is attempted?

Which Django version? I don't see a CSRF token in the form. 

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-users@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.



user full name in template

2011-02-03 Thread Bobby Roberts
is there a template tag to show the user's full name on a template?

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



Re: user full name in template

2011-02-03 Thread arlolra
user.get_full_name should work
https://github.com/django/django/blob/master/django/contrib/auth/models.py#L245

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



Re: user full name in template

2011-02-03 Thread Bobby Roberts
here's what i'm trying

from django.contrib.auth import authenticate, login, logout
#import django user modules
from django.contrib.auth.models import User

def ShowMainMenu (request):
fullname=User.first_name + ' ' + User.last_name
return render_to_response('scanning/menu.html',
{'fullname':fullname}, context_instance=RequestContext(request))

I'm getting this err:

type object 'User' has no attribute 'first_name'



On Feb 4, 12:15 am, arlolra  wrote:
> user.get_full_name should 
> workhttps://github.com/django/django/blob/master/django/contrib/auth/mode...

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



Django-filebrowser path problems

2011-02-03 Thread gerram
Can anybody to help me with demo project of correct settings.py for
django-filebrowser and structure of folders. I tried very much places
of locate FILEBROWSER folders for media and uploads but always get
such error: 'Error finding Upload-Folder (MEDIA_ROOT +
FILEBROWSER_DIRECTORY). Maybe it does not exist?'
Best regards, George

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