Wired integers displayed instead of Friends List in facebook connect

2009-06-11 Thread gganesh

hi,
My app connects to Facebook and as user logins in with facebook
connect ,i intent to display users friends list .I the process of
doing so i have written a code as pasted below





FB_RequireFeatures(["XFBML"],function()
{
FB.Facebook.init
("2654d333c10576bae931ba210f288314","xd_receiver.htm");
FB.Facebook.get_sessionState().waitUntilReady(function()
{
FB.Facebook.apiClient.friends_get(null,function(result,ex){
window.alert("friends list :" + result);

});
});
});



I was expecting friends list in "result" variable ,but it found to be
some wired integer ,Where I went wrong ?,Any suggestions  are
appreciable
--~--~-~--~~~---~--~~
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: Open Sourcing a Website [dangerous?]

2009-06-11 Thread Kenneth Gonsalves

On Thursday 11 June 2009 22:27:11 Shadow wrote:
> Thanks for the info, very helpful.
>
> You've convinced me, now I just need to convince the higher
> authorities 

I have had a fair amount of success in convincing non-profits to open source 
the code of their webapps. Among points you can make:

1. No vendor lock-in. Even if everyone associated with the project vanishes, 
the code is there and available for anyone to continue the development

2. A chance for volunteers to contribute to the project without too much 
commitment - a lot of contributions to open source are casual one-offs by 
passers by

3. A large potential group of testers. Normally testing is a very tedious job 
and costs a lot to hire people to do it. Open source projects often have 
hundreds of testers - and in popular projects it would run to lakhs.

4. Help other non-profits doing similar work - they can reuse the code, and 
also contribute back (this is a tricky point as very often non-profits have to 
compete for funds and other non-profits doing similar work are the main enemy)

5. Depending on the level of idealism in the organisation, you could also use 
arguments relating to the freedom of information, contributing to society etc. 
You can find such arguments in the FSF website.

And to reassure them, promise to keep 'mission-critical-business-logic' a 
secret. (this is actually BS, but the effect is amazing).
-- 
regards
kg
http://lawgon.livejournal.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
-~--~~~~--~~--~--~---



Re: Processing Forms in HTML docs

2009-06-11 Thread Abhishek Nanda



any ideas?
--~--~-~--~~~---~--~~
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: Open Sourcing a Website [dangerous?]

2009-06-11 Thread Kenneth Gonsalves

On Thursday 11 June 2009 15:41:59 Shadow wrote:
> I'm about to launch a non-profit django website, and was thinking I
> might as well open source the code as well.
>
> I noticed this has been done with djangoproject.com, but was thinking
> how potentially dangerous it is, that any flaws are open to see and be
> exploited.

OMG - openssl code is open - how come the bad guys haven't cracked it ;-)
>
> Is it just a matter of hoping good guys find the flaws before the bad
> ones? :P

seriously, security is a process and has little or nothing to do with whether 
the source code is available or not. And remember one thing - in proprietary 
code it is very easy for a bad guy to build a back door into the site which 
will probably never be found. As long as you do not do anything silly like 
putting your passwords under version control, you are quite safe.

-- 
regards
kg
http://lawgon.livejournal.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
-~--~~~~--~~--~--~---



Re: How to doing something after change record of DB with admin view?

2009-06-11 Thread Rama Vadakattu

>From my point of view
use of signals correctly fit your needs.

On Jun 12, 5:31 am, Shuge Lee  wrote:
> For some reason, I want to create a static file after user change
> record of DB with admin view, I need to use 
> signalhttp://docs.djangoproject.com/en/dev/topics/signals/#topics-signals
> , or other stuff?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Determining the type of a form field within a template

2009-06-11 Thread thsut...@gmail.com

Hi all,

I'm currently working on my first Django project and have run into a
difficulty while trying to write a generic "display a form" template
that I can {% include %} when I need to (as suggested in the
documentation ).

My goal is a simple template which renders each [visible] form field
in a div with an id ("{{ field.auto_id }}_wrapper") and a few classes.
In particular, I need to add a class so that different types of form
field can be styled differently w.r.t. their labels and errors.

I generally accomplish this with markup like:


I agree to the terms of service.



I've been trying to find out how to accomplish this in Django
templates, but the closest I've been able to find are two threads on
this list  and  which both seem to
indicate that it is impossible at the template level to get any
information about a form field beyond its auto_id, errors, and the
HTML for the label, input, etc.

This has been trivial in every other framework I've used and I'm sure
it is in Django as well, but I'm completely stumped. Is there any way
to do this which doesn't require that I write custom code for every
form and/or checkbox in my project?

Cheers,

Thomas Sutton
--~--~-~--~~~---~--~~
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: Memory usage

2009-06-11 Thread Graham Dumpleton



On Jun 12, 11:51 am, Miles  wrote:
> Or rather - how to keep the server from blowing up. I've searched the
> web before, but nothing I've found solves the problem.
>
> Some background info - I'm running worldoflogs.com, a site that gets
> around 100 concurrent requests during rush hour and still growing
> rather rapidly. Django powers the frontend and custom java code does
> the number crunching on the backend. Running Django via mod_wsgi,
> multiprocess, apache-prefork.
>
> We ran into trouble this week when all WSGI workers were busy serving
> requests, apache queueing requests and page load times bouncing up and
> down from 0 to 20s. Easy fix: increase amount of processes, until you
> run out of ram. ps showed that each python process took at least 100M
> and half of them at 150M+, so getting past 60 processes was no go.
>
> I used Dozer to see if anything leaked between requests: nope. Okay...
> There are no objects alive, yet the memory usage rises after serving
> requests; running JMeter to fire off infinite requests to apache
> raised memory used from ~30M after 1 request to 200M+ after 250,
> stopped the benchmark after that.
>
> Maybe python doesn't free up memory from it's heap? I know that java
> with the default GC options does that. Bingo. The following 4 lines
> solved it for us:
>
> class GCMiddleware(object):
>     def process_request(self, request):
>         import gc
>         gc.collect()
>
> Yeah. It was that simple. Memory usage went from insane to 50M and
> stable, even after thousands of requests to a single worker. If you're
> running out of ram but got CPU cycles to spare, do a full gc before
> every request. We had 85% idle time on the CPU, but RAM utilization
> was at 80% and I don't dare raising the limits further, running into
> swap kills the server instantly.
>
> It's silly how much attention GC gets on java and none at all on
> python, especially on a server memory tends to be a problem under load
> - if you go the multiprocess way instead of using threads. That's the
> main reason we use java on the backend - threads. This is not Django's
> fault, it's just python that tries to minimize GC time - what's good
> for one app is poison for another, and python's default GC behavior is
> quite evil in this case.
>
> This "solution" is quite crude, but tuning the garbage collector with
> set_threshold is an a pain in the backside; what I would like to see
> is a simple collector, like java's new generation: if full: collect;
> if free memory after collection <= min_free or >= max_free, resize
> heap to follow it.
>
> With threshold on the default 700/10/10, we run into minor collections
> all the time, promoting objects quickly from gen 0 to 1 to 2 and
> requiring a full collection to get it out of there. Trying to get the
> size right is impossible without an equivalent for -XX:+PrintGC -XX:
> +PrintGCDetails -XX:+PrintGCTimeStamps, things either get promoted too
> quickly or never, making any collection as expensive as a full GC.
>
> If someone has an idea how to get memory usage at about the same with
> lower cpu cost than a full GC every request, please tell.

In Python, garbage collecting is not real garbage collection like
other systems. Primarily, Python uses reference counting on objects
and so is able to reclaim memory as soon as last reference is gone.
The problem, and where GC kicks in in Python, is where there are
object reference count loops. That is, where a network of objects have
mutual references to each other.

If you can, perhaps try and determine what objects it is that the GC
is having to deal with. In some cases the design of objects can be
changed to avoid the GC needing to kick in to reclaim them.

Graham
--~--~-~--~~~---~--~~
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: URL Patterns for URL Encoding Symbols

2009-06-11 Thread Andy Dietler

Awesome thanks. I love the Django community.

On Jun 11, 7:03 pm, Thomas Sutton  wrote:
> Hi Andy,
>
> 2009/6/12 Andy  Dietler :
>
>
>
>
>
>
>
> > Right now I've got a URL pattern that works for letters and numbers,
> > but when a character like %20 gets thrown in it fails.
>
> > The pattern is this:
>
> > (r'^(?P\w+)/$', 'detail'),
>
> > Which works when I have:
>
> > domain.com/Friends/
> > domain.com/24/
>
> > but not for
>
> > domain.com/The%20Office/
>
> > How do I get it to accept the %20?
>
> The `\w` in your regular expression means (to quote the Python `re` module
> documentation :
>
> > When the LOCALE and UNICODE flags are not specified, [`\w`] matches any
> > alphanumeric character and the underscore; this is equivalent to the set
> > [a-zA-Z0-9_].  With LOCALE, it will match the set [0-9_] plus whatever
> > characters are defined as alphanumeric for the current locale. If UNICODE is
> > set, this will match the characters [0-9_] plus whatever is classified as
> > alphanumeric in the Unicode character properties database.
>
> You need to replace the `\w` with something that will match the characters you
> want. If you want everything that `\w` matches plus spaces, you should use
> `[\w ]+` (note the space) instead of `\w+`.
>
> Cheers,
>
> Thomas Sutton
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Memory usage

2009-06-11 Thread Miles

Or rather - how to keep the server from blowing up. I've searched the
web before, but nothing I've found solves the problem.

Some background info - I'm running worldoflogs.com, a site that gets
around 100 concurrent requests during rush hour and still growing
rather rapidly. Django powers the frontend and custom java code does
the number crunching on the backend. Running Django via mod_wsgi,
multiprocess, apache-prefork.

We ran into trouble this week when all WSGI workers were busy serving
requests, apache queueing requests and page load times bouncing up and
down from 0 to 20s. Easy fix: increase amount of processes, until you
run out of ram. ps showed that each python process took at least 100M
and half of them at 150M+, so getting past 60 processes was no go.

I used Dozer to see if anything leaked between requests: nope. Okay...
There are no objects alive, yet the memory usage rises after serving
requests; running JMeter to fire off infinite requests to apache
raised memory used from ~30M after 1 request to 200M+ after 250,
stopped the benchmark after that.

Maybe python doesn't free up memory from it's heap? I know that java
with the default GC options does that. Bingo. The following 4 lines
solved it for us:

class GCMiddleware(object):
def process_request(self, request):
import gc
gc.collect()

Yeah. It was that simple. Memory usage went from insane to 50M and
stable, even after thousands of requests to a single worker. If you're
running out of ram but got CPU cycles to spare, do a full gc before
every request. We had 85% idle time on the CPU, but RAM utilization
was at 80% and I don't dare raising the limits further, running into
swap kills the server instantly.


It's silly how much attention GC gets on java and none at all on
python, especially on a server memory tends to be a problem under load
- if you go the multiprocess way instead of using threads. That's the
main reason we use java on the backend - threads. This is not Django's
fault, it's just python that tries to minimize GC time - what's good
for one app is poison for another, and python's default GC behavior is
quite evil in this case.

This "solution" is quite crude, but tuning the garbage collector with
set_threshold is an a pain in the backside; what I would like to see
is a simple collector, like java's new generation: if full: collect;
if free memory after collection <= min_free or >= max_free, resize
heap to follow it.

With threshold on the default 700/10/10, we run into minor collections
all the time, promoting objects quickly from gen 0 to 1 to 2 and
requiring a full collection to get it out of there. Trying to get the
size right is impossible without an equivalent for -XX:+PrintGC -XX:
+PrintGCDetails -XX:+PrintGCTimeStamps, things either get promoted too
quickly or never, making any collection as expensive as a full GC.

If someone has an idea how to get memory usage at about the same with
lower cpu cost than a full GC every request, please tell.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



urlconf doesn't coerce

2009-06-11 Thread notcourage

From:
http://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-urls

Each captured argument is sent to the view as a plain Python string,
regardless of what sort of match the regular expression makes.

* * *

Does anybody think it would be nice to specify coercions like you can
on TypedChoiceField.

Speaking of which, wouldn't it be nice if MultipleChoiceField behaved
similarly?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



URL Patterns for URL Encoding Symbols

2009-06-11 Thread Andy Dietler

Right now I've got a URL pattern that works for letters and numbers,
but when a character like %20 gets thrown in it fails.

The pattern is this:

(r'^(?P\w+)/$', 'detail'),

Which works when I have:

domain.com/Friends/
domain.com/24/

but not for

domain.com/The%20Office/

How do I get it to accept the %20?

Thank in advance.
- Andy
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



templates in Practical Django Projects

2009-06-11 Thread jayvandal

I am now on linux . I created a CMS under jim/djp/
I created the projec t to the flatpages.
I am trying to create templates.
I created a templates in jim/djp/templates.I created cms under
templates, then flatpages directory. I then created default.html

In the setting I put the template_dir = (
  'djp/templates/cms/',

I see te template directory n it tells me that it can't find
/jdp/templates.cms/flatpages/default.html/


I have created the directories in templates/cms/flatpages/default.html
But the error messages tell me that it can't find the templates

How do you identify the templates?
Jim
--~--~-~--~~~---~--~~
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: Permission Denied: /tmp/python.cache_root

2009-06-11 Thread Graham Dumpleton

Since you never posted a full and complete traceback, we have no idea
what code is even triggering this condition, so how can we suggest
what needs to change.

Also, you should do a 'ls -lasR' of /tmp/python.cache_root and work
out if all files under the directory are owned by the same or
different users.

I also don't recollect you even explaining how you are hosting this.
Your problems could be how you have set up your hosting environment,
what user it runs as and what umask setting has been inherited by the
processes.

Graham

On Jun 12, 6:52 am, joshm  wrote:
> This is a private beta...not production I have debug on for that
> reason.
>
> In this instance, there are 2 django sites running, so this could very
> well be the issue.
>
> They are being hosted on a vps but the production one has memcache
> setup as its cache backend, the beta site which is getting this error
> has none of that in its settings files, so it is defaulting to
> whatever django 1.0 defaults to.  Is there a way to force the instance
> of django to not share this cache?
>
> On Jun 9, 4:42 pm, Graham Dumpleton 
> wrote:
>
>
>
> > Do you run more than one instance of Django on the same machine,
> > whether they be production or development systems?
>
> > If you run multiple Django instances and they run as different users,
> > as would often be case where running development Django on same box
> > and production runs as Django, it is bad practice to put caches or
> > database in /tmp and use the same location for all instances.
>
> > The situation that can arise if you do this is that another instance
> > could create directories/files which another instance cannot open or
> > create files within. Thus you get permission denied.
>
> > So, more information is needed about how many Django sites you have
> > running, how they are hosted, what users they run as and how they are
> > configured for caches, databases etc.
>
> > Graham
>
> > On Jun 9, 3:23 am, jmat  wrote:
>
> > > I'm getting an error using Django 1.0 when trying to log a new user
> > > in.  When I call
>
> > > login(request)
>
> > > On a new user I  will occassionally (not very often) get an error (the
> > > cache number values will be different):
>
> > > Permission Denied: /tmp/python.cache_root/8/7/2
>
> > > Which is an:
>
> > > OSError in /usr/lib/python2.4/os.py in makedirs, line 159
>
> > > I can't find any reference to /tmp/python.cache_root anywhere on my
> > > system, but it appears the call is originating from a django request.
>
> > > I can temporarily fix the issue by enabling write permission on the
> > > given location, but down the road the same error seems to appear
> > > again...
>
> > >  Has anyone ever seen an error like this before?
>
> > > any help will be appreicated.
>
> > > - JM
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



templates in Practical Django Projects

2009-06-11 Thread jayvandal

I am now on linux . I created a CMS under jim/djp/
I created the projec t to the flatpages.
I am trying to create templates.
I created a templates in jim/djp/templates.I created cms under
templates, then flatpages directory. I then created default.html

In the setting I put the template_dir = (
  'djp/templates/cms/',

I see te template directory n it tells me that it can't find
/jdp/templates.cms/flatpages/default.html/


I have created the directories in templates/cms/flatpages/default.html
But the error messages tell me that it can't find the templates

How do you identify the templates?
Jim
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to doing something after change record of DB with admin view?

2009-06-11 Thread Shuge Lee



For some reason, I want to create a static file after user change
record of DB with admin view, I need to use signal
http://docs.djangoproject.com/en/dev/topics/signals/#topics-signals
, or other stuff?
--~--~-~--~~~---~--~~
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: how to custom Admin list_filter queryset? thanks ~

2009-06-11 Thread mydjango

thanks ~

On 6月11日, 下午5时40分, mydjango  wrote:
> I want many sites to use one admin,they only use his datas,but  can't
> view other user's datas.
>
> I use admin.ModelAdmin def queryset to custom changelistview, but when
> i use list_filter with ForeignKey field , the filter will show all
> user's date.
>
> how can custom list_filter queryset list ?
>
> 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
-~--~~~~--~~--~--~---



getting the latest story is too slow

2009-06-11 Thread ssc

Hello,

I would like to retrieve the most recently published story from the
database. The criterion date is not a field, but sits in a separate
model connected by a ManyToMany field.

# this works fine
latest_story = Story.order_by('-publish_dates__publish_date')[0]

# this also works, seems slightly faster and is nicer to read
latest_story = Story.latest('publish_dates__publish_date')

Problem is that the query takes 30s to execute with just 3000 objects
in the database.

I can not use values(...), because that only works with fields, not
with ManyToManyField attributes.

I have played with the raw SQL and noticed that there is an ANDed test
in the WHERE part that checks if the story publish date & time <=
current date & time. This seems redundant to me and when I remove it,
the execution times drop to less than a second. I would prefer not to
resort to raw SQL yet, though and I believe that there must be a way
to do this query using the Django API in an efficient manner.

Searching for 'slow' in this group and reading e.g.
http://www.ibm.com/developerworks/opensource/library/os-django-models/index.html,
I am getting the impression that it is quite common to run into
performance issues with 'naive' queries once a larger DB is used. I
could not find a solution how to speed up the query, though. Are there
any common practices how to deal with this ?

Your help would be greatly appreciated :-)

Cheers,

Steve

--~--~-~--~~~---~--~~
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-registration using a different registration form

2009-06-11 Thread Paddy Joy

Thanks Creecode,

I discovered the new url needs to be before the urlconf to override
it.

url(r'^%saccounts/register/$' % settings.BASE_URL,
'registration.views.register', {'form_class': RegistrationWithPet},
name='registration_register'),
url(r'^%saccounts/' % settings.BASE_URL, include
('registration.urls')),

Paddy

On Jun 11, 10:43 am, creecode  wrote:
> Hello Paddy,
>
> You can do the later. Put your url above the include for registration
> and you should be good to go.
>
> On Jun 10, 3:26 pm, Paddy Joy  wrote:
>
> > I have been reading the django-registration docs and have learned I
> > can change the registration form by using the 'form_class' keyword
> > argument.
>
> >http://bitbucket.org/ubernostrum/django-registration/src/b360801eae96...
>
> > To make this work do I need to rewrite the included urls with my own
> > or is there a way I can keep the included urlconf and just overwrite
> > one particular url?
>
> Toodle-loo...
> creecode
--~--~-~--~~~---~--~~
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: how to override ordering in date-based generic views

2009-06-11 Thread Joseph Brown
Hi Justin - Thanks & sorry I missed your email until just now.  I did try
that, and it's interesting: it worked for any of the date based generic
views that took a datepart parameter in the url, i.e. archive_year,
archive_month, and archive_day.  But archive_index just ignores it.  Also
tried adding an order_by to the model, which had the same effect.  I'm out
of my league but am guessing that the archive_index sets its own order by,
perhaps in a custom query via the date_field solely ..

I've kinda given up on this one and just came up with a different look and
feel for the site to promote featured blogs.

Thanks again,
Joe



On Tue, Jun 9, 2009 at 12:52 PM, Justin Myers  wrote:

>
> Have you tried this yet?
>
> info_dict = {
>'queryset': Entry.objects.order_by(-featured),
> 'date_field': 'pub_date'
> }
> urlpatterns = patterns('django.views.generic.date_based',
> ...
>   (r'^$',  'archive_index', info_dict),
> )
>
> I haven't checked whether or not it works, but it seems like it'd do
> the job.
>

--~--~-~--~~~---~--~~
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: How can I get consistent url mappings on both apache+mod_wsgi and the development server.

2009-06-11 Thread Graham Dumpleton



On Jun 12, 4:23 am, peta  wrote:
> I have django running under apache+mod-wsgi with...
>
>       WSGIScriptAlias /tools     /blah/blah/blah/tools.wsgi
>
> so http:server/tools/thingy cranks up the thingy tool.  Because
> mod_wsgi strips off the /tools part the urlpatterns just have to match
> the tool name, i.e.
>
>           (r'^thingy/',         include('tools.thingy.urls')),
>
> All well and good.
>
> Now I want to develop using the built in server, but it doesn't strip
> off the /tools part.  I can get around this by adding more
> urlpatterns
>
>             (r'^thingy/',                 include
> ('tools.thingy.urls')),   # For apache
>             (r'^tools/thingy/',         include
> ('tools.thingy.urls')),   # For runserver
>
> which is kludgy, and I'm not sure what is going to happen with the
> reverse url mappings.
>
> Is there someway to handle this situation gracefully.  The examples
> for mod_wsgi all put the WSGIAlias at / so it doesn't come up.

If you use all the appropriate functions for constructing URLs in
pages based on the context application is run, you should be able to
use the same urls.py for both. In this case though when working under
development server the application will be mounted at root URL where
as for mod_wsgi it will be a sub URL. The application though, if you
are doing everything right, shouldn't care where it is mounted.

So, just don't include 'tools/' in urls.py and access application
under development server from root URL rather than sub URL.

Graham
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Hi, im new with Django

2009-06-11 Thread Asinox

Hi, im Asinox, im a php user , CodeIgniter Framewor user, but i want
to test something different to PHP, so why not Python.

But i have a litter problem, im using window with WAMP, my python path
is : E:\wamp\bin\Python25\, my Django installation is: E:\wamp\bin
\Python25\Lib\site-packages\django

my htpdocs is e:\wamp\www, ¿how ill run the Django from my htpdocs?,
¿why Django go into "site-package" ?, ¿from where ill run this :
django-admin.py  ?, so i dont like the framework that first need somet
Console command...i love CodeIgniter for this razon.

I want to test Django, but im lost with the complicate ambient.

In the tutorial "Writing your first Django app, part 1" i saw this
command ( import django ), but ¿From where i need to type this
command?, because i got error about it, "is not a recognized internal
or external command..".

and the last one, the tutorial say:  "From the command line, cd into a
directory where you’d like to store your code, then run the command
django-admin.py startproject mysite. This will create a mysite
directory in your current directory." ... this command "django-
admin.py startproject mysite" dont is recognized too.

Some help please, in lost...

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
-~--~~~~--~~--~--~---



Disabling I18N causes circular import?

2009-06-11 Thread ringemup

With I18n disabled, I'm getting what looks like a circular import
error from one of my apps, but with it enabled, the error goes away.
None of my modules is (to my knowledge) using any I18N features.  Any
clues what might be going on?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 & Couchdb ??

2009-06-11 Thread Nicolas Steinmetz

Hello,

Interesed by couchdb, I would be interested to use both django & couchdb.

I see that there is at least 6 implementations :
- couchdb-django : http://code.google.com/p/couchdb-django/ - not 
updated since last august
- django-couchdb : http://code.google.com/p/django-couchdb/ - not 
updated since last september
- django-relax : http://github.com/zvoase/django-relax/tree/master - not 
updated since last december
- django-couchdb : 
http://github.com/crimeminister/django-couchdb/tree/master : empty
- django-relex : http://bitbucket.org/benoitc/django-relax/ : empty
- django-couch : http://bitbucket.org/ianschenck/django-couch/wiki/Home

Any stable and maintained solution to suggest me or should I forget 
using both of them at the same time ?

Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Permission Denied: /tmp/python.cache_root

2009-06-11 Thread joshm

This is a private beta...not production I have debug on for that
reason.

In this instance, there are 2 django sites running, so this could very
well be the issue.

They are being hosted on a vps but the production one has memcache
setup as its cache backend, the beta site which is getting this error
has none of that in its settings files, so it is defaulting to
whatever django 1.0 defaults to.  Is there a way to force the instance
of django to not share this cache?



On Jun 9, 4:42 pm, Graham Dumpleton 
wrote:
> Do you run more than one instance of Django on the same machine,
> whether they be production or development systems?
>
> If you run multiple Django instances and they run as different users,
> as would often be case where running development Django on same box
> and production runs as Django, it is bad practice to put caches or
> database in /tmp and use the same location for all instances.
>
> The situation that can arise if you do this is that another instance
> could create directories/files which another instance cannot open or
> create files within. Thus you get permission denied.
>
> So, more information is needed about how many Django sites you have
> running, how they are hosted, what users they run as and how they are
> configured for caches, databases etc.
>
> Graham
>
> On Jun 9, 3:23 am, jmat  wrote:
>
>
>
> > I'm getting an error using Django 1.0 when trying to log a new user
> > in.  When I call
>
> > login(request)
>
> > On a new user I  will occassionally (not very often) get an error (the
> > cache number values will be different):
>
> > Permission Denied: /tmp/python.cache_root/8/7/2
>
> > Which is an:
>
> > OSError in /usr/lib/python2.4/os.py in makedirs, line 159
>
> > I can't find any reference to /tmp/python.cache_root anywhere on my
> > system, but it appears the call is originating from a django request.
>
> > I can temporarily fix the issue by enabling write permission on the
> > given location, but down the road the same error seems to appear
> > again...
>
> >  Has anyone ever seen an error like this before?
>
> > any help will be appreicated.
>
> > - JM
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with cascade delete of onetoone relation

2009-06-11 Thread jenlu


I have a model 'Account' with a OneToOne relation to another model
Tokens and then lots of
other stuff in my models

Class Account (.

 tokens = models.OneToOneField('TokenStore',
verbose_name=_(u'Token Store'), related_name='account')

When deleting an Account from admin gui it cascades and everything is
deleted ok -- except this Tokens instance (and I would like to delete
it also). This makes my database corrupt as I now have
a Token instance with no account (so I get an exception - object not
found whenever I try and look at an account)...

I have tried inserting a delete for this token in the pre_delete
signal for an Account (but then I get a good old infinite recursion -
since the account deletes a token that deletes its account that
deleltes its token that...) and in post_delete it seems that trying to
do instance.tokens.delete() makes a db lookup and the instance (=of
the Account) has already been deleted from db so that also goes
pooofff...

Any ideas...??

Running local on mac but deployment uses Postgres
--~--~-~--~~~---~--~~
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: ModelChoiceField queryset option

2009-06-11 Thread Bobby Roberts

> Hi.
> You should take a read on the queryset api, that would help you a lot
> In the furture. For distinct values add .distinct() so you fx get
> ...filter(...).distinct()
>
> ~Jakob


Jakob -

I've read the docs and know about distinct.  The issue here is that a
modelchoicefield returns the ID and then whatever you specify to
populate the human readable value in the selection box.  See my
example above of what I am looking for.  If i just use distinct, the
record id is always used so it will always be distinct... or am i
misunderstanding something here.


--~--~-~--~~~---~--~~
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: in admin interface - how to edit/show data based on ownership/not ownership

2009-06-11 Thread phoebebright

This post might help -
http://groups.google.com/group/django-users/browse_thread/thread/c84dbbac27c6fea2/cf6624cca547fe89?lnk=gst=admin+owner#cf6624cca547fe89
Not exactly what you want but might give you some ideas.

On Jun 11, 7:36 pm, "Sergio A."  wrote:
> Hello,
>
> in this blog post:
>
> http://www.b-list.org/weblog/2008/dec/24/admin/
>
> it is explained how to list only data that someone owns and restrict
> edit permission.
> What I'd like to do is to list all the data, but let users change only
> those owned, while showing the rest for reading.
>
> This means that I should be able to compare logged user to the data
> owner and then select a proper template (to change/present) data.
>
> Any example on how to do this in the admin module?
>
> Thanks, Sergio
--~--~-~--~~~---~--~~
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: ModelChoiceField queryset option

2009-06-11 Thread googletorp

Hi.
You should take a read on the queryset api, that would help you a lot
In the furture. For distinct values add .distinct() so you fx get
...filter(...).distinct()

~Jakob

On Jun 11, 7:28 pm, Bobby Roberts  wrote:
> > The issue is the line: WebPage.objects.filter(page_plaque!='').  The
> > queryset syntax doens't use the != operator anywhere.  To do != operations
> > you need to instead do WebPage.objects.exclude(page_plaque='').
>
> ok that got past the error but there are dupes in there.  Is there a
> way to pull a distinct list? ideally i'd like it to return something
> like this
>
> 
> pic1.jpg
> pic1.jpg
> pic1.jpg
> pic2.jpg
> 
>
> where the option value is the ID of the record from the table.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Entering {{ variable }} into the Admin Interface

2009-06-11 Thread saved...@gmail.com

If the following question seems daft, then excuse me.  Is it possible
(from a data entry perspective) to enter a string

 with the variable in the admin?  For example, can I enter the
following data into the admin,

"My name is {{ user.username }} ." When the template engine encounters
this, it will literally show on the public site

"My name is {{ user.username }} ." rather than "My name is Dave ."

I've noticed that in .po files there is something like msgid "%(user)
s".  Is there any way to do this in the admin?

Thanks in Advance.

Ken
--~--~-~--~~~---~--~~
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: Seeing form validation errors

2009-06-11 Thread zayatzz

Well i found a solution finally...

http://kfarr.com/2008/04/04/making-a-complex-customized-django-form-template-remember-to-include-errorsnon_field_errors/

If anyone else has this kind of problem then  you could go ahead
and check this example too :

http://opensource.washingtontimes.com/blog/post/jsoares/2009/01/im-lazier-then-django-forms/

Alan.

On Jun 10, 10:31 pm, zayatzz  wrote:
> Nice... it worked...
>
> If i use form.as_p it gives me output of all form errors before the
> form, just as i want, but form as paragraph does not look very nice
> and i rather use my own template for it which looks like this:
>
>                         {% for field in form %}
>                                 {{ field.label_tag 
> }}
> {{ field }}
>                         {% endfor %}
>
> But which tag is the one that gives me this nice list of errors in
> case of form.as_p ?
>
>                         {{ form.errors }}
>
> gives me output like :
> 
> 
> __all__
> 
> Password has to be longer than 6 characters
> 
> 
> 
>  
>
> and that just sucks.. 2 errorlist uls and one empty ul? and whats up
> with that __all__ ?
>
> do i have to iterate through that form.errors? how then because
>
>                         {% for error in form.errors %}
>                                 {{ error }}
>                         {% endfor %}
>
> Gives me just this :
> __all__
>  
>
> Alan.
>
> On Jun 9, 3:00 pm, zayatzz  wrote:
>
> > Aha!
>
> > I will try that when i get back home.
>
> > Thanks!
>
> > Alan
>
> > On Jun 9, 2:50 pm, Karen Tracey  wrote:
>
> > > On Tue, Jun 9, 2009 at 2:19 AM, zayatzz  wrote:
>
> > > > Well thats what i was complaining about in the beginning that i could
> > > > use good example of how to do it. Its quite confusing how form
> > > > validation is on one page, errors on the others and views on third and
> > > > there is not single full example.
>
> > > > How should the else part be?
>
> > > > else:
> > > >    message = "form was not valid"
> > > >    accform = form
> > > >    ...
> > > >    return render_to_response..
>
> > > > something like that perhaps?
>
> > > No, you don't want to be creating another form instance in the case where
> > > the existing one is not valid.  The existing instance that failed 
> > > validation
> > > is already annotated with specific errors describing what's wrong with it.
> > > Really, this example, mentioned earlier, is complete:
>
> > >http://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-...
>
> > > There doesn't need to be an else block for the is_valid().  The case where
> > > there are errors in the POSTed data which make the form invalid is 
> > > described
> > > by the 3rd numbered note below the example.  All that has to happen for 
> > > that
> > > case is that you pass the existing bound (and invalid, therefore 
> > > containing
> > > errors that will display with the form) back in the context for display.
> > > The form gets re-displayed with error annotations and is ready for
> > > correction/re-submission by the user.
>
> > > Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



in admin interface - how to edit/show data based on ownership/not ownership

2009-06-11 Thread Sergio A.

Hello,

in this blog post:

http://www.b-list.org/weblog/2008/dec/24/admin/

it is explained how to list only data that someone owns and restrict
edit permission.
What I'd like to do is to list all the data, but let users change only
those owned, while showing the rest for reading.

This means that I should be able to compare logged user to the data
owner and then select a proper template (to change/present) data.

Any example on how to do this in the admin module?

Thanks, Sergio
--~--~-~--~~~---~--~~
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: tinycme and filebrowser - unable to select image

2009-06-11 Thread Daniel Hilton
Hi Sam

Yes mine is working now. Weird - will try a fresh project at some stage and
try and track this one down.
Was the error you were getting from tinyMCE saying that 'u is not defined'?

Cheers,
Dan

2009/6/11 nostradamnit 

>
> Hi Daniel,
>
> Your javascript name change didn't work for me :( Is your working now?
>
> Did you check your settings.FILEBROWSER_URL_FILEBROWSER_MEDIA? Mine
> was pointing to an invalid path ( I hadn't copied the filebrowser
> media files over ) . My install is working now :D
>
> Good luck,
> Sam
>
> On Jun 9, 11:40 pm, Daniel Hilton  wrote:
> > Thanks, I have done:
> http://code.google.com/p/django-tinymce/issues/detail?id=45
> >
> > HTH
> > Dan
> >
> > 2009/6/9 patrickk :
> >
> >
> >
> >
> >
> > > I´m actually not sure whether or not your saying there´s an error with
> > > the filebrowser-templates ... because I don´t know what you mean with
> > > "the tinymce filebrowser template".
> >
> > > if you think you´ve found an error, please use the google-code issue-
> > > tracker to report it.
> >
> > > thanks,
> > > patrick
> >
> > > On Jun 9, 10:23 pm, Daniel Hilton  wrote:
> > >> 2009/6/9 nostradamnit :
> >
> > >> > Hello,
> >
> > >> > I've successfully implemented TinyMCE and filebrowser for flatpages,
> > >> > however, I can't seem to select the images that are displayed in
> > >> > filebrowser. If I click on the image, it just serves the image?!?
> How
> > >> > do you use it to select the image to insert into TinyMCE? if I paste
> > >> > the path from the image served into the image url field, it inserts
> it
> > >> > correctly into TinyMCE.
> >
> > >> > Thanks in advance for you assistance,
> > >> > Sam
> >
> > >> I lost three days to this! It's to do with the tinymce filebrowser
> > >> template - you need to capitalise the javascript function, otherwise
> > >> you'll get an 'u is not defined error' from tinymce in your javascript
> > >> error log.
> > >> HTH
> > >> Dan
> >
> > >> --
> > >> Dan Hilton
> > >> 
> > >> DanHilton.co.uk
> > >> 
> >
> > --
> > Dan Hilton
> > 
> > DanHilton.co.uk
> > 
> >
>


-- 
Dan Hilton

DanHilton.co.uk


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How can I get consistent url mappings on both apache+mod_wsgi and the development server.

2009-06-11 Thread peta

I have django running under apache+mod-wsgi with...

  WSGIScriptAlias /tools /blah/blah/blah/tools.wsgi

so http:server/tools/thingy cranks up the thingy tool.  Because
mod_wsgi strips off the /tools part the urlpatterns just have to match
the tool name, i.e.

  (r'^thingy/', include('tools.thingy.urls')),

All well and good.

Now I want to develop using the built in server, but it doesn't strip
off the /tools part.  I can get around this by adding more
urlpatterns

(r'^thingy/', include
('tools.thingy.urls')),   # For apache
(r'^tools/thingy/', include
('tools.thingy.urls')),   # For runserver

which is kludgy, and I'm not sure what is going to happen with the
reverse url mappings.

Is there someway to handle this situation gracefully.  The examples
for mod_wsgi all put the WSGIAlias at / so it doesn't come up.

--~--~-~--~~~---~--~~
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: ModelChoiceField queryset option

2009-06-11 Thread Bobby Roberts

> The issue is the line: WebPage.objects.filter(page_plaque!='').  The
> queryset syntax doens't use the != operator anywhere.  To do != operations
> you need to instead do WebPage.objects.exclude(page_plaque='').
>

ok that got past the error but there are dupes in there.  Is there a
way to pull a distinct list? ideally i'd like it to return something
like this


pic1.jpg
pic1.jpg
pic1.jpg
pic2.jpg


where the option value is the ID of the record from the table.
--~--~-~--~~~---~--~~
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: ModelChoiceField queryset option

2009-06-11 Thread Alex Gaynor
On Thu, Jun 11, 2009 at 12:13 PM, Bobby Roberts  wrote:

>
> hi group
>
> i'm trying to create a drop box that is populated with a distinct list
> of values from a certain field  (fieldname=page_plaque) in the table.
> Here is what i have in my forms.py
>
>
> class PagePlaqueModelChoiceField (forms.ModelChoiceField):
>def label_from_instance(self,obj):
>return obj.page_plaque
>
> page_plaque  = PagePlaqueModelChoiceField
> (queryset=WebPage.objects.filter(page_plaque!=''),
> empty_label='Choose',required=False, widget=forms.Select(attrs=
> {'class':'dropbox'}))
>
>
>
> this is not working and errors out with:
>
> 'bool' object is not iterable
>
>
> Is this possible and if so what am i doing wrong?  Can I pull a
> DISTINCT list of values for that field?
>
>
> >
>
The issue is the line: WebPage.objects.filter(page_plaque!='').  The
queryset syntax doens't use the != operator anywhere.  To do != operations
you need to instead do WebPage.objects.exclude(page_plaque='').

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
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: Imposing a negative constraint on related objects

2009-06-11 Thread Rowan Nairn

On Thu, Jun 11, 2009 at 9:15 AM, Jashugan  wrote:
>
> On Jun 10, 2:48 pm, Rowan  wrote:
>
>> Here is an English description of what I want to achieve:
>> "People who have received mails with tag T, excluding mails in threads
>> that they started themselves"
>
> Have you tried using Q objects?
>
> Person.objects.filter(
>    Q(received_mails__tags=T) & \
>    !Q(received_mails__thread__started_by=F('id'))).distinct()

Yes.  This produces exactly the same query as the one with exclude.

--~--~-~--~~~---~--~~
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: tinycme and filebrowser - unable to select image

2009-06-11 Thread nostradamnit

Hi Daniel,

Your javascript name change didn't work for me :( Is your working now?

Did you check your settings.FILEBROWSER_URL_FILEBROWSER_MEDIA? Mine
was pointing to an invalid path ( I hadn't copied the filebrowser
media files over ) . My install is working now :D

Good luck,
Sam

On Jun 9, 11:40 pm, Daniel Hilton  wrote:
> Thanks, I have 
> done:http://code.google.com/p/django-tinymce/issues/detail?id=45
>
> HTH
> Dan
>
> 2009/6/9 patrickk :
>
>
>
>
>
> > I´m actually not sure whether or not your saying there´s an error with
> > the filebrowser-templates ... because I don´t know what you mean with
> > "the tinymce filebrowser template".
>
> > if you think you´ve found an error, please use the google-code issue-
> > tracker to report it.
>
> > thanks,
> > patrick
>
> > On Jun 9, 10:23 pm, Daniel Hilton  wrote:
> >> 2009/6/9 nostradamnit :
>
> >> > Hello,
>
> >> > I've successfully implemented TinyMCE and filebrowser for flatpages,
> >> > however, I can't seem to select the images that are displayed in
> >> > filebrowser. If I click on the image, it just serves the image?!? How
> >> > do you use it to select the image to insert into TinyMCE? if I paste
> >> > the path from the image served into the image url field, it inserts it
> >> > correctly into TinyMCE.
>
> >> > Thanks in advance for you assistance,
> >> > Sam
>
> >> I lost three days to this! It's to do with the tinymce filebrowser
> >> template - you need to capitalise the javascript function, otherwise
> >> you'll get an 'u is not defined error' from tinymce in your javascript
> >> error log.
> >> HTH
> >> Dan
>
> >> --
> >> Dan Hilton
> >> 
> >> DanHilton.co.uk
> >> 
>
> --
> Dan Hilton
> 
> DanHilton.co.uk
> 
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ModelChoiceField queryset option

2009-06-11 Thread Bobby Roberts

hi group

i'm trying to create a drop box that is populated with a distinct list
of values from a certain field  (fieldname=page_plaque) in the table.
Here is what i have in my forms.py


class PagePlaqueModelChoiceField (forms.ModelChoiceField):
def label_from_instance(self,obj):
return obj.page_plaque

page_plaque  = PagePlaqueModelChoiceField
(queryset=WebPage.objects.filter(page_plaque!=''),
empty_label='Choose',required=False, widget=forms.Select(attrs=
{'class':'dropbox'}))



this is not working and errors out with:

'bool' object is not iterable


Is this possible and if so what am i doing wrong?  Can I pull a
DISTINCT list of values for that field?


--~--~-~--~~~---~--~~
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: tinycme and filebrowser - unable to select image

2009-06-11 Thread nostradamnit

Patrickk wins this one! Thanks!

The problem was settings.FILEBROWSER_URL_FILEBROWSER_MEDIA which was a
valid path but not a valid url. Apparently I got lost at the second
item of the filebrowser basic installation :(

Thanks again to everyone,
Sam

On Jun 9, 9:43 pm, patrickk  wrote:
> hi sam,
>
> it seems that the js to select the image isn´t loaded 
> (seehttp://code.google.com/p/django-filebrowser/source/browse/trunk/fileb...,
> line 10 to 14 - probably line 12).
>
> please (re)check the "available settings" for the filebrowser -
> especially the different url- and path-settings (http://
> code.google.com/p/django-filebrowser/wiki/Settings).
>
> you may use firebug to get additional information on what´s wrong ...
>
> patrick
>
> On Jun 9, 4:53 pm, nostradamnit  wrote:
>
> > Hello,
>
> > I've successfully implemented TinyMCE and filebrowser for flatpages,
> > however, I can't seem to select the images that are displayed in
> > filebrowser. If I click on the image, it just serves the image?!? How
> > do you use it to select the image to insert into TinyMCE? if I paste
> > the path from the image served into the image url field, it inserts it
> > correctly into TinyMCE.
>
> > Thanks in advance for you assistance,
> > Sam
--~--~-~--~~~---~--~~
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: Open Sourcing a Website [dangerous?]

2009-06-11 Thread Shadow

Hi Michael,

Thanks for the info, very helpful.

You've convinced me, now I just need to convince the higher
authorities :P

On Jun 12, 12:24 am, Michael  wrote:
> On Thu, Jun 11, 2009 at 6:11 AM, Shadow wrote:
>
>
>
> > Hi guys,
>
> > I'm about to launch a non-profit django website, and was thinking I
> > might as well open source the code as well.
>
> > I noticed this has been done with djangoproject.com, but was thinking
> > how potentially dangerous it is, that any flaws are open to see and be
> > exploited.
>
> > Is it just a matter of hoping good guys find the flaws before the bad
> > ones? :P
>
> > Any thoughts?
>
> Thanks for thinking about Open Sourcing your projects.It really helps out
> the community to see full projects out there in the wild.
>
> As for security, if there is an exploit in your code, it exists whether or
> not your code is open sourced or not. While you run the risk of the bad guys
> seeing the exploits directly, instead of needing to reverse engineer
> anything, you will have considerably more eyes on the code, which means bugs
> will be filed and, in general, the community is very helpful.
>
> A few things I can think of if you are going to open source your entire Web
> Site: Don't place your settings.py file in the project, as your database
> information, secret key and other information will be in that file. Remember
> to extract any API keys or passwords that you might have hard coded in your
> views or other code. Run the CSRF middleware; 90% of exploits that I have
> found/committed into code since starting to using Django came in the form of
> CSRF. While the middleware is a little strict and not prefect, it can cut
> down on some of your risk. A full test suite will help to make sure that
> your application does exactly as documented (don't forget to document) this
> will help make sure that you don't have random tangents that might lead to
> exploits.
>
> Another extremely helpful thing that can help out the community without
> needing to release the entire codebase, is to write your apps with reuseable
> code and release several reusable apps. There are lots of examples out there
> for reusable apps.
>
> I hope that helps,
>
> Michael
--~--~-~--~~~---~--~~
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: Generic Views vs. Admin

2009-06-11 Thread phoebebright

Jashugan,

I agree that generic views for non-admins make sense, just be nice to
be able to say

body_html = auto_generate(model, list/display/update etc.)

or whatever admin is doing and stick that in a generic template.

{% extends 'base.html' %}

{% block main %}

{{body_html}}

{% endblock %}


What do you think?


On Jun 11, 4:34 pm, Jashugan  wrote:
> On Jun 11, 8:03 am, phoebebright  wrote:
>
> > I have spent a good deal time researching this online and in this
> > group but can find no clear answer.
>
> I think the reason why is that it depends on what you want to do.
>
> > My instinct is that I should use the former, but do I really have to
> > go and write all those templates when admin is so good at it already?
>
> I use generic views for models that need to be administered by any non-
> programmer admins.  One reason is that they are consistent with the
> look of the rest of the site, whereas the admin interface is not.
> Another is that I usually end up having to customize either the view
> logic or the template that it uses slightly, so I would prefer to have
> a 'stub' in place to go off of.
--~--~-~--~~~---~--~~
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: Displaying a checkbox/list from database back onto a Django form

2009-06-11 Thread Jashugan

On Jun 10, 10:48 am, NealWalters  wrote:
> So I stored the list into my bigtable database.  The user goes to page
> 2 or 3 of a five page form, then goes back to the first page where the
> languages were, and now, I need to show the same languages checked
> that he user checked when he was originally on page 1.

So this seems like a good case for the FormWizard, however, the
FormWizard as it stands right now, doesn't allow you to go back to
previous forms (http://code.djangoproject.com/ticket/9200).

I think there are two ways of doing this:

1. use sessions
2. store each step in the database, which you retrieve when you return
to that step. Once all the steps are complete, you can delete the
steps from the database and create a record. Of course, you'd need a
scrubber script that deletes the partially complete processes after 24
hours of inactivity.
--~--~-~--~~~---~--~~
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: Problem with query set order_by

2009-06-11 Thread Sean Brant

You the man Alex, that was the problem!

On Jun 11, 11:19 am, Alex Gaynor  wrote:
> On Thu, Jun 11, 2009 at 11:15 AM, Tom Evans wrote:
>
>
>
>
>
> > On Thu, 2009-06-11 at 09:04 -0700, Sean Brant wrote:
> > > If I have 2 sql queries one with a limit of 5 and the other with a
> > > limit or 6 they return there results in diffrent orders.
>
> > > Here is a example.
>
> > > >>> class Book(models.Model):
> > > >>>    title = models.CharField(max_length=150)
> > > >>>    author = models.CharField(max_length=100)
>
> > > >>> book_list_1 = Books.objects.order_by('author')[0:5]
> > > >>> book_list_2 = Books.objects.order_by('author')[0:6]
>
> > > >>> print book_list_1
> > > <<< [, , , ,
> > > ]
>
> > > >>> print book_list_2
> > > <<< [, , , ,
> > > , ]
>
> > > Very confused.
>
> > Django just returns them in the order your database engine returns them.
> > If you look at django.db.connection.queries, and run them in your db
> > shell, they will return the items in a different order. What's causing
> > that is interesting though, what db engine do you use?
>
> > Might be interesting to see the queries, and also book_list_n.values().
>
> > Cheers
>
> > Tom
>
> The cause is likely that the author for each item is equal, and there is no
> defined ordering for equal objects.  If you want a consistant ordering
> provide 2 levels or ordering, aka: order_by('author', 'other_field') with
> another field such as 'id'.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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: Problem with query set order_by

2009-06-11 Thread Alex Gaynor
On Thu, Jun 11, 2009 at 11:15 AM, Tom Evans wrote:

>
> On Thu, 2009-06-11 at 09:04 -0700, Sean Brant wrote:
> > If I have 2 sql queries one with a limit of 5 and the other with a
> > limit or 6 they return there results in diffrent orders.
> >
> > Here is a example.
> >
> > >>> class Book(models.Model):
> > >>>title = models.CharField(max_length=150)
> > >>>author = models.CharField(max_length=100)
> >
> > >>> book_list_1 = Books.objects.order_by('author')[0:5]
> > >>> book_list_2 = Books.objects.order_by('author')[0:6]
> >
> > >>> print book_list_1
> > <<< [, , , ,
> > ]
> >
> > >>> print book_list_2
> > <<< [, , , ,
> > , ]
> >
> > Very confused.
>
> Django just returns them in the order your database engine returns them.
> If you look at django.db.connection.queries, and run them in your db
> shell, they will return the items in a different order. What's causing
> that is interesting though, what db engine do you use?
>
> Might be interesting to see the queries, and also book_list_n.values().
>
> Cheers
>
> Tom
>
>
> >
>
The cause is likely that the author for each item is equal, and there is no
defined ordering for equal objects.  If you want a consistant ordering
provide 2 levels or ordering, aka: order_by('author', 'other_field') with
another field such as 'id'.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
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: Problem with query set order_by

2009-06-11 Thread Tom Evans

On Thu, 2009-06-11 at 09:04 -0700, Sean Brant wrote:
> If I have 2 sql queries one with a limit of 5 and the other with a
> limit or 6 they return there results in diffrent orders.
> 
> Here is a example.
> 
> >>> class Book(models.Model):
> >>>title = models.CharField(max_length=150)
> >>>author = models.CharField(max_length=100)
> 
> >>> book_list_1 = Books.objects.order_by('author')[0:5]
> >>> book_list_2 = Books.objects.order_by('author')[0:6]
> 
> >>> print book_list_1
> <<< [, , , ,
> ]
> 
> >>> print book_list_2
> <<< [, , , ,
> , ]
> 
> Very confused.

Django just returns them in the order your database engine returns them.
If you look at django.db.connection.queries, and run them in your db
shell, they will return the items in a different order. What's causing
that is interesting though, what db engine do you use?

Might be interesting to see the queries, and also book_list_n.values().

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: Imposing a negative constraint on related objects

2009-06-11 Thread Jashugan

On Jun 10, 2:48 pm, Rowan  wrote:

> Here is an English description of what I want to achieve:
> "People who have received mails with tag T, excluding mails in threads
> that they started themselves"

Have you tried using Q objects?

Person.objects.filter(
Q(received_mails__tags=T) & \
!Q(received_mails__thread__started_by=F('id'))).distinct()
--~--~-~--~~~---~--~~
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: New to Django - question about AUTHENTICATION_BACKENDS and syncdb

2009-06-11 Thread Karen Tracey
On Wed, Jun 10, 2009 at 4:52 PM, spacelab  wrote:

>
> I tried to follow the following tutorial
>
> http://agileweb.wordpress.com/2009/04/28/step-by-step-guide-to-use-sign-in-with-twitter-with-django/#comment-67
> however I failed to get it to work properly.
>
> To eleminate one hypothsis, I was trying to find out if there is an
> issue with one of of the steps. The step being #8.
> In step 8 it tells you to create a class "class UserProfile
> (models.Model):" in a module named UserProfile.
>
> So the question is, should "class UserProfile(models.Model):" be in
> UserProfile.py as stated in the tutorial? or should it be a file named
> models.py? I though if you are creating a model, then you need add the
> app to settings,  create the model in the models.py file, and do
> syncdb.
>
> I posted a question to the tutorial, but the author took it down.
>

Your question seems to be there now, with an answer, so I'd guess it was not
taken down but rather perhaps delayed due to moderation/spam blocking
attempts.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with query set order_by

2009-06-11 Thread Sean Brant

If I have 2 sql queries one with a limit of 5 and the other with a
limit or 6 they return there results in diffrent orders.

Here is a example.

>>> class Book(models.Model):
>>>title = models.CharField(max_length=150)
>>>author = models.CharField(max_length=100)

>>> book_list_1 = Books.objects.order_by('author')[0:5]
>>> book_list_2 = Books.objects.order_by('author')[0:6]

>>> print book_list_1
<<< [, , , ,
]

>>> print book_list_2
<<< [, , , ,
, ]

Very confused.
--~--~-~--~~~---~--~~
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: how to disable recursive delete in admin

2009-06-11 Thread Jashugan

On Jun 11, 8:43 am, Francis  wrote:
> If a link an image in ProductPage and then delete the image later, the
> admin site will tell me that it would also delete the ProductPage. I
> tried it, and it got deleted.

I don't use the admin site that much, but this behavior strikes me as
wrong.

A work around is to perhaps use the pre_delete signal and clear the
relationships before delete is called:

def image_pre_delete(sender, instance, **kwargs):
   instance.productpage_set.clear()

signals.pre_delete.connect(image_pre_delete, sender=Image)


--~--~-~--~~~---~--~~
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: Not displaying the data after space

2009-06-11 Thread Jeff FW

Take a look in the database itself (use the sqlite3 shell) and see if
the full phrase is being stored.  If it is, then there is an issue
with how you are pulling the data out and displaying it in the form;
if it isn't, then there is an issue with how you are saving the data
in the first place.

Without more information on what you're doing, that's the best I can
give you.  Check on that, and reply.

-Jeff

On Jun 11, 10:29 am, Nalini  wrote:
> Hi,
>
> I am using jvascript, python and django for my web page with Sqllite3
> at database.
>
> When i enter some data in a textfield, for example "this is an
> instrument" it is getting saved accurately into the database, the
> problem is when i try to view the data in the database , the data that
> is getting displayed in the frontend textfield is only "this" and the
> remaining data "is an instrument" is not getting displayed .
>
> I have declared that variable in models.py as
>
> description = models.TextField('Description', max_length=256)
>
> can anyone help me out where i went wrong?
>
> Thanks and Regards,
> Nalini
--~--~-~--~~~---~--~~
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: Unable to update a query

2009-06-11 Thread Jashugan

On Jun 11, 6:56 am, shradha  wrote:
> hi,
>
> I have created a django application , where my model class is
>
> class Developer(models.Model):
>
>     developer_id=models.CharField(primary_key=True,max_length=30)
>     developer_name = models.CharField(max_length=100)
>     project_id = models.ForeignKey(Project)
>
> I have written a query to update :
>
> form1 = DeveloperForm(request.GET)
>                 if form1.is_valid():
>                     new_defect = form1.save(commit=False)
>                     Developer.objects.filter
> (developer_id=new_defect.developer_id).update
> (developer_name=new_defect.developer_name)
>                     return HttpResponse("hello")
>

I'm not sure where it is failing. Is it failing on "if form1.is_valid
():"? or on the update call?

Is the Developer model wrapping a legacy schema? How does
DeveloperForm look like?
--~--~-~--~~~---~--~~
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: how to disable recursive delete in admin

2009-06-11 Thread Francis

And it's what puzzle me.

That's my models :

class Image(models.Model):
name = models.CharField(max_length=50)
file = models.FileField(upload_to=PRODUCT_IMAGES)

class ProductPage(Page):
product_description = models.TextField()
product_id = models.IntegerField()
original_image = models.ImageField(upload_to=PRODUCT_IMAGES)
category = models.ForeignKey(Category)
similar_products = models.ManyToManyField('self',
symmetrical=True, null=True, blank=True)
images = models.ManyToManyField(Image, blank=True)
videos = models.ManyToManyField(Video, blank=True)
(it inherit from page, for menu management - no link to image)

If a link an image in ProductPage and then delete the image later, the
admin site will tell me that it would also delete the ProductPage. I
tried it, and it got deleted.

I'm using the svn version - uptodate


On Jun 11, 11:29 am, Jashugan  wrote:
> On Jun 11, 8:08 am, Francis  wrote:
>
> > Is it possible to disable recursive delete?
>
> > Because I have some pages models that has a m2m relationship with an
> > image/video table. But if I delete an image, I don't want it to also
> > delete the page.
>
> I don't think recursive delete is enabled in m2m relationships, just
> in foreign key relationships. In m2m relationships, the only thing
> that should be deleted is the records in the join table, but not in
> the target or source tables.
--~--~-~--~~~---~--~~
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: Generic Views vs. Admin

2009-06-11 Thread Jashugan

On Jun 11, 8:03 am, phoebebright  wrote:
> I have spent a good deal time researching this online and in this
> group but can find no clear answer.

I think the reason why is that it depends on what you want to do.

> My instinct is that I should use the former, but do I really have to
> go and write all those templates when admin is so good at it already?
>

I use generic views for models that need to be administered by any non-
programmer admins.  One reason is that they are consistent with the
look of the rest of the site, whereas the admin interface is not.
Another is that I usually end up having to customize either the view
logic or the template that it uses slightly, so I would prefer to have
a 'stub' in place to go off of.
--~--~-~--~~~---~--~~
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: how to disable recursive delete in admin

2009-06-11 Thread Jashugan

On Jun 11, 8:08 am, Francis  wrote:
> Is it possible to disable recursive delete?
>
> Because I have some pages models that has a m2m relationship with an
> image/video table. But if I delete an image, I don't want it to also
> delete the page.

I don't think recursive delete is enabled in m2m relationships, just
in foreign key relationships. In m2m relationships, the only thing
that should be deleted is the records in the join table, but not in
the target or source tables.
--~--~-~--~~~---~--~~
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: How to doing something after change db record with admin view?

2009-06-11 Thread Jashugan

On Jun 11, 3:13 am, Shuge Lee  wrote:
> For some reason, I want to create a static file after user change
> record of DB with admin view, I need to use 
> signalhttp://docs.djangoproject.com/en/dev/topics/signals/#topics-signals

Yeah signals would work well.
--~--~-~--~~~---~--~~
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: stringformat to get first 3 characters?

2009-06-11 Thread Daniel Roseman

On Jun 11, 3:50 pm, Frank Peterson  wrote:
> I need to use the stringformat filter on a variable in a template but
> I just want it to grab the first 3 characters of the variable.
>
> {{ object.caption|lower|truncatewords:"1"|stringformat:"3s" }}
>
> Doesnt seem to work.

Use slice (because Python strings are iterables, just like lists):
{{ object.caption|lower|truncatewords:"1"|slice:":3" }}
--
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 versions and wsgi - 'module' object has no attribute 'site'

2009-06-11 Thread Karen Tracey
On Wed, Jun 10, 2009 at 4:21 PM, El Marto  wrote:

>
> Hi all!
>
> I m trying to run my django app using wsgi, The default django
> installed in the server is 0.97-pre-SVN-6978 and I want to use the
> development one. I inserted the development django path in the wsgi
> file:
> --
> import os, sys
> import django.core.handlers.wsgi
>
> sys.path.insert(0, '/home/gtc/django-trunk/build/lib')
> sys.path.insert(1, '/home/gtc/django-trunk/build/lib/django')
> sys.path.insert(2, '/home/gtc/')
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'gtc.settings'
>
> application = django.core.handlers.wsgi.WSGIHandler()
> --
>
> But I get this error:
>
> --
> ImproperlyConfigured at /
> Error while importing URLconf 'gtc.urls': 'module' object has no
> attribute 'site'
> --
>
> Of course the app works in my machine, so... can anyone tell me if it
> is possible to override the version? or am I doing something else
> wrong?
>

It is certainly possible to override the version in site-packages by one
specified explicitly in the path in your .wsgi file.  If you are absolutely
sure you have the paths specified correctly -- are the permisions set
properly on /home/gtc etc. so that Apache can read the code from there?

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to disable recursive delete in admin

2009-06-11 Thread Francis

Hi folks,

I have a question related to deletion in the admin interface.

Is it possible to disable recursive delete?

Because I have some pages models that has a m2m relationship with an
image/video table. But if I delete an image, I don't want it to also
delete the page.

thank you

Francis

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Generic Views vs. Admin

2009-06-11 Thread phoebebright

I have spent a good deal time researching this online and in this
group but can find no clear answer.

Generally, I can either use generic views and write a template for
each model to list/view/update/delete or I can use admin and do a
filter to only show a particular person's entries.

My instinct is that I should use the former, but do I really have to
go and write all those templates when admin is so good at it already?

(I'm sure this discussion has already been done so do point me at the
thread - I have looked and looked...)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



stringformat to get first 3 characters?

2009-06-11 Thread Frank Peterson

I need to use the stringformat filter on a variable in a template but
I just want it to grab the first 3 characters of the variable.

{{ object.caption|lower|truncatewords:"1"|stringformat:"3s" }}

Doesnt seem to work.
--~--~-~--~~~---~--~~
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: Getting a distinct list of Users from two related Models

2009-06-11 Thread Karen Tracey
On Wed, Jun 10, 2009 at 3:24 PM, Streamweaver wrote:

>
> Thanks so much for the reply.
>
> Oddly the method you suggests throws an error but I'm not sure why.
>
> The solution I came up with is as follows:
>
> User.objects.order_by('username').filter
> (project__owner__isnull=False).distinct() | User.objects.filter
> (release__owner__isnull=False).distinct()
>
> I would expect the line you wrote to give the same results but when I
> try it I get an Template Error of "Caught an exception while
> rendering: no such column: U1.owner_id"  I have no idea why.
>
> It's working for me so I don't have a problem now but I'm definitly
> missing something about why I'm getting this error at all.
>

An error like that -- where the ORM generates SQL that is incorrect -- is
generally a bug in Django.  In this case I can recreate it with the 1.0.2
release, but not with current trunk or 1.0.X branch code, so it is
apparently a bug that has been found and fixed since 1.0.2.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Not displaying the data after space

2009-06-11 Thread Nalini

Hi,

I am using jvascript, python and django for my web page with Sqllite3
at database.

When i enter some data in a textfield, for example "this is an
instrument" it is getting saved accurately into the database, the
problem is when i try to view the data in the database , the data that
is getting displayed in the frontend textfield is only "this" and the
remaining data "is an instrument" is not getting displayed .

I have declared that variable in models.py as

description = models.TextField('Description', max_length=256)

can anyone help me out where i went wrong?

Thanks and Regards,
Nalini
--~--~-~--~~~---~--~~
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: Open Sourcing a Website [dangerous?]

2009-06-11 Thread Michael
On Thu, Jun 11, 2009 at 6:11 AM, Shadow wrote:

>
> Hi guys,
>
> I'm about to launch a non-profit django website, and was thinking I
> might as well open source the code as well.
>
> I noticed this has been done with djangoproject.com, but was thinking
> how potentially dangerous it is, that any flaws are open to see and be
> exploited.
>
> Is it just a matter of hoping good guys find the flaws before the bad
> ones? :P
>
> Any thoughts?
>

Thanks for thinking about Open Sourcing your projects.It really helps out
the community to see full projects out there in the wild.

As for security, if there is an exploit in your code, it exists whether or
not your code is open sourced or not. While you run the risk of the bad guys
seeing the exploits directly, instead of needing to reverse engineer
anything, you will have considerably more eyes on the code, which means bugs
will be filed and, in general, the community is very helpful.

A few things I can think of if you are going to open source your entire Web
Site: Don't place your settings.py file in the project, as your database
information, secret key and other information will be in that file. Remember
to extract any API keys or passwords that you might have hard coded in your
views or other code. Run the CSRF middleware; 90% of exploits that I have
found/committed into code since starting to using Django came in the form of
CSRF. While the middleware is a little strict and not prefect, it can cut
down on some of your risk. A full test suite will help to make sure that
your application does exactly as documented (don't forget to document) this
will help make sure that you don't have random tangents that might lead to
exploits.

Another extremely helpful thing that can help out the community without
needing to release the entire codebase, is to write your apps with reuseable
code and release several reusable apps. There are lots of examples out there
for reusable apps.

I hope that helps,

Michael

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Unable to update a query

2009-06-11 Thread shradha

hi,

I have created a django application , where my model class is

class Developer(models.Model):

developer_id=models.CharField(primary_key=True,max_length=30)
developer_name = models.CharField(max_length=100)
project_id = models.ForeignKey(Project)

I have written a query to update :

form1 = DeveloperForm(request.GET)
if form1.is_valid():
new_defect = form1.save(commit=False)
Developer.objects.filter
(developer_id=new_defect.developer_id).update
(developer_name=new_defect.developer_name)
return HttpResponse("hello")

it is not updating the query saying developer is not validated

Plz provide m e a solutio , reply on shradha.ambe...@patni.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
-~--~~~~--~~--~--~---



How to doing something after change db record with admin view?

2009-06-11 Thread Shuge Lee

How to doing something after change record of DB with admin view?

For some reason, I want to create a static file after user change
record of DB with admin view, I need to use signal
http://docs.djangoproject.com/en/dev/topics/signals/#topics-signals
, or other stuff?

--~--~-~--~~~---~--~~
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: MySQLdb Exceptions

2009-06-11 Thread Frédéric Hébert

Hi,

have you an access to your mysql server config file ?

In that case, you could enable logging :
To see the current variables values type mysqld --verbose --version in
a shell prompt.
Search for log* variables.
If log is set to false see link below

"The general query log is a general record of what mysqld is doing.
The server writes information to this log when clients connect or
disconnect, and it logs each SQL statement received from clients. The
general query log can be very useful when you suspect an error in a
client and want to know exactly what the client sent to mysqld. "
(from MySQL 5.0 manual)

http://dev.mysql.com/doc/refman/5.0/en/query-log.html

Hope it will be helpfull

Frédéric

2009/6/11 jrivero :
>
> Hi!
>
> I have one mysqldb exception on insert or update in some model with
> message [1] and can not find it. Django does not catch and return
> generic error 500.
>
> [1]: Exception exceptions.TypeError: "'NoneType' object is not
> callable" in  object at 0x1dd56d50>> ignored
>
> I suspect that appears after a change in the properties of any table.
>
> Some idea for find? Is possible catch all exception commit-query's and
> logging the query?
>
> Thanks!
> Jordi.
>
> >
>

--~--~-~--~~~---~--~~
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 using ChoiceField

2009-06-11 Thread newbie

Thank you very much urukay. That was really helpful.

On Jun 11, 10:53 am, urukay  wrote:
> The problem is that, when you submit the form to your view, the form choices
> does not exist (the only exist only at client side, not server side).
> Before validating the form, you have to create appropriate choices for that
> choicefield.
>
> This should point you to the right 
> direction:http://monogroncho.com/2008/10/django-gotchas-part-1/
>     - look at the FORM SUBMISSION
>
> This example is little bit complicated (can be done much easier, i think)
> but as a guide it's very good.
>
> Regards,
> Radovan
>
>
>
> newbie-15 wrote:
>
> > Hi,
>
> >       I have created a form which contains a ChoiceField. But in the
> > class of the form, I havent given
>
> > any choices to the ChoiceField. I'm creating the choices dynamically
> > using ajax and adding it on
>
> > the client side using javascript. I'm also using is_valid function to
> > check whether the input given to
>
> > the form is valid. All is well till there. But when I select a choice,
> > I'm getting an exception saying
>
> > "Please provide valid input. That choice is not available in the
> > choices". Can someone clarify me if
>
> > its wrong to add choices dynamically at the client side and select
> > them as input. If so then how do
>
> > we solve this problem.
>
> > Thanks,
> > Nazgi.
>
> --
> View this message in 
> context:http://www.nabble.com/error-using-ChoiceField-tp23968615p23975673.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
-~--~~~~--~~--~--~---



Re: ManyToMany Question

2009-06-11 Thread Daniel Roseman

On Jun 11, 1:06 pm, LeeRisq  wrote:
> Programming with Django is unfortunately my job on the side right now,
> so limited time for coding and testing. I know I could answer this
> question myself by tinkering around, but don't have time.
>
> When you have a generic ManyToMany field specified between two models,
> will Django automatically create a "through" table if I don't
> explicitly tell it to? Logic tells me that it does, but the
> documentation suggests otherwise unless I am losing it, which has been
> known to happen. Thanks everyone.

It always creates an intermediate table in the database, as there's no
other way of modelling a many-to-many relation. However, it won't
expose this via the ORM unless you create the intermediate model and
use 'through'.
--
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
-~--~~~~--~~--~--~---



ManyToMany Question

2009-06-11 Thread LeeRisq

Programming with Django is unfortunately my job on the side right now,
so limited time for coding and testing. I know I could answer this
question myself by tinkering around, but don't have time.

When you have a generic ManyToMany field specified between two models,
will Django automatically create a "through" table if I don't
explicitly tell it to? Logic tells me that it does, but the
documentation suggests otherwise unless I am losing it, which has been
known to happen. Thanks everyone.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



MySQLdb Exceptions

2009-06-11 Thread jrivero

Hi!

I have one mysqldb exception on insert or update in some model with
message [1] and can not find it. Django does not catch and return
generic error 500.

[1]: Exception exceptions.TypeError: "'NoneType' object is not
callable" in > ignored

I suspect that appears after a change in the properties of any table.

Some idea for find? Is possible catch all exception commit-query's and
logging the query?

Thanks!
Jordi.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Open Sourcing a Website [dangerous?]

2009-06-11 Thread Shadow

Hi guys,

I'm about to launch a non-profit django website, and was thinking I
might as well open source the code as well.

I noticed this has been done with djangoproject.com, but was thinking
how potentially dangerous it is, that any flaws are open to see and be
exploited.

Is it just a matter of hoping good guys find the flaws before the bad
ones? :P

Any thoughts?

Cheers
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to custom Admin list_filter queryset? thanks ~

2009-06-11 Thread mydjango

I want many sites to use one admin,they only use his datas,but  can't
view other user's datas.

I use admin.ModelAdmin def queryset to custom changelistview, but when
i use list_filter with ForeignKey field , the filter will show all
user's date.

how can custom list_filter queryset list ?

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: how to custom Admin list_filter queryset?

2009-06-11 Thread Daniel Roseman

On Jun 11, 10:06 am, mydjango  wrote:
> how to custom Admin list_filter queryset?

http://catb.org/esr/faqs/smart-questions.html

--
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
-~--~~~~--~~--~--~---



how to custom Admin list_filter queryset?

2009-06-11 Thread mydjango

how to custom Admin list_filter queryset?
--~--~-~--~~~---~--~~
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: Processing Forms in HTML docs

2009-06-11 Thread Abhishek Nanda

Well the problem with the URL is that i cannot pass the data this way
to the view. for example if i need to sort the results i have obtained
how do i pass the QuerySet to the appropriate view function? what I am
wondering like in a link  we can directly go
to a particular view  if we can do anything similar in the action
attribute also...

On Jun 11, 1:30 pm, Rama Vadakattu  wrote:
> 1. 
>
>     
>
> just put down the appropriate view url  for the action attribute of
> your form.
>
> On Jun 11, 8:56 am, Abhishek Nanda  wrote:
>
> > Hi
>
> > I wanted some help about processing forms in an html document returned
> > as the result of a given query. I am developing an opac system . now
> > once a user searches fr a book he is directed to an html document
> > which contains all the results. now in this page i need to embed the
> > search form so that he can search again from this page itself. but i
> > cannot understand how to process the data of the form as in how to
> > send the data to the appropriate view...please help
>
> > Abhishek
--~--~-~--~~~---~--~~
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: How to SEO adapt a I18N django web site..

2009-06-11 Thread jenlu

Quick update - got it to work !!! Still awaiting for google to index
my site under http://work724.com/en/start/ and http://work724.com/sv/start/
but everything seems to be working.

One issue I had was the ordering of modules. Using localeurl 1.3 and
in installation guide step 2 states:

'...Add 'localeurl.middleware.LocaleURLMiddleware' to
settings.MIDDLEWARE_CLASSES. It must come before
'django.middleware.common.CommonMiddleware' or settings.APPEND_SLASH
will not work...'

I tried putting it first in the list but then I only got the default
language and could never change... then I put it last and everything
started to work. Below is the ordering of my stuff (might help someone
in the future)...

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'mysite.projects.middleware.ThreadLocalsMiddleware',
'django.middleware.doc.XViewMiddleware',
'localeurl.middleware.LocaleURLMiddleware',
)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



question about UserChangeForm

2009-06-11 Thread Wim Feijen

Hello,

In my views, I'd like to be able to rename a user using the
UserChangeForm from django.contrib.auth.forms . However, the form does
not validate. Should I use another instance than request.user?

Errorlist:

Translation: "Dit veld is verplicht." is Dutch for "This field is
required."

passwordDit veld
is verplicht.last_loginDit veld is verplicht.date_joinedDit veld is verplicht.

In views:

def rename(request):
'''Displays a form which can rename a user'''
if request.POST:
form = UserChangeForm(request.POST, instance=request.user)
if form.is_valid():
result = form.save()
return HttpResponseRedirect("/preferences")
print form.errors
else:
form = UserChangeForm(instance=request.user)
context = {
'form': form,
}
return render_to_response('rename_user.html', context)

Thanks! Wim
--~--~-~--~~~---~--~~
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: IFEQUAL takes two arguments error on Django 0.91

2009-06-11 Thread Jason Beaudoin
On Wed, Jun 10, 2009 at 5:43 PM, Frank Peterson
wrote:

>
> I'm on Django 0.91 (unfortunately we are stuck with that and cannot
> upgrade).
>

I have a really hard time believe you truly are stuck.
Migration may not be the simplest in the short-run, but certainly sensible
in the long-term. Who wants to use old, broken, incomplete code anyway?

--
401.837.8417
jasonbeaud...@gmail.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
-~--~~~~--~~--~--~---



Re: error using ChoiceField

2009-06-11 Thread urukay


The problem is that, when you submit the form to your view, the form choices
does not exist (the only exist only at client side, not server side).
Before validating the form, you have to create appropriate choices for that
choicefield.

This should point you to the right direction:
http://monogroncho.com/2008/10/django-gotchas-part-1/
- look at the FORM SUBMISSION

This example is little bit complicated (can be done much easier, i think)
but as a guide it's very good.

Regards,
Radovan




newbie-15 wrote:
> 
> 
> Hi,
> 
>   I have created a form which contains a ChoiceField. But in the
> class of the form, I havent given
> 
> any choices to the ChoiceField. I'm creating the choices dynamically
> using ajax and adding it on
> 
> the client side using javascript. I'm also using is_valid function to
> check whether the input given to
> 
> the form is valid. All is well till there. But when I select a choice,
> I'm getting an exception saying
> 
> "Please provide valid input. That choice is not available in the
> choices". Can someone clarify me if
> 
> its wrong to add choices dynamically at the client side and select
> them as input. If so then how do
> 
> we solve this problem.
> 
> Thanks,
> Nazgi.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/error-using-ChoiceField-tp23968615p23975673.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
-~--~~~~--~~--~--~---