Re: escaping metacharacter in url pattern

2011-04-26 Thread Michel30
That is just terrific Raúl, thanks a lot!

code I ended up using:
url(r'^cgi-bin/DocDB/
ShowDocument','docDB.views.retrieveDocumentVersion')

documentid = int(request.GET.get('docid'))
version = request.GET.get('version', '')


On Apr 21, 4:16 pm, Raúl Cumplido  wrote:
> sorry copy&paste error:
>
> *u*rl(r'^cgi-bin/DocDB/ShowDocument\$',
> 'docDB.views.retrieveDocumentVersion'),
>
> 2011/4/21 Raúl Cumplido 
>
>
>
> > Hi,
>
> > That data is not part of the path they are part of the querystring. It
> > would be better to set your urls.py as:
>
> > rl(r'^cgi-bin/DocDB/ShowDocument\$',
> > 'docDB.views.retrieveDocumentVersion'),
>
> > And retrieve values in your view as:
>
> > request.GET.get('docid', '')
> > and
> > request.GET.get('version', '')
>
> > Look at the documentation here:
>
> >http://docs.djangoproject.com/en/1.3/ref/request-response/#django.htt...
>
> > Raúl
>
> > On Thu, Apr 21, 2011 at 3:59 PM, Michel30  wrote:
>
> >> Hey guy's,
>
> >> I'm trying to replicate behaviour of a legacy CMS and stick it into a
> >> new Django project.
>
> >> Here is an example of my url:
>
> >>http://hostname:port/cgi-bin/DocDB/ShowDocument?docid=19530&version=1
>
> >> I want to filter the docid and version with a regex in a urlpattern to
> >> use later in a function:
>
> >>    url(r'^cgi-bin/DocDB/ShowDocument\?docid=(?P\d+)\?
> >> version=(?P\d+)', 'docDB.views.retrieveDocumentVersion'),
>
> >> I've tried about every way of escaping the '? ' but can't get it to
> >> work...
>
> >> Any ideas anyone?
>
> >> 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.
>
> > --
> > Raúl Cumplido
>
> --
> Raúl Cumplido

-- 
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: i am suspicious !

2011-04-26 Thread Tonton
now it 's work

def cleanPath(file):
path= settings.MEDIA_ROOT+"/here/"+str(file)
if default_storage.exists(path):
default_storage.delete(path)
return "file deleted : "+str(file)

si simple ! :o)

tonton

On Fri, Apr 22, 2011 at 9:59 AM, Tonton  wrote:

> so how to pass over ?
>
> i made an upload form for tree files
> then i use data in these files and create a table.
>
> next i need tu upload more tree files but in the path there is the tree
> file before so i hope to remove it !!
>
> then django Crying me with SuspiciousOperation
>
> maybe i am a little bit "brutal"
>
> def cleanPath(path):
> list= default_storage.listdir(path)
> for f in list:
> file = path + f
> if default_storage.exists(file):
> default_storage.delete(file)
> return "dossier nettoye"
>
> this is what i am in trouble now but next
> i would like to let my users (authenticate user ) to remove table and all
> data inside from the website
>
> thank's for all
> Tonton
>

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



Form redisplay in the case of form errors?

2011-04-26 Thread Derek
I have a form that I am expecting will redisplay with errors; it does not do
so.  Instead, the "print form.errors" statement is reached which does, in
fact, show that there are errors. For example:

cellphoneThis field is
required.

What else do I need to do to have the form be redisplayed?

Thanks
Derek


# form
class PersonForm(ModelForm):
class Meta:
model = Person
fields = (
'first_name', 'last_name', 'date_of_birth', 'gender', 'email',
'cellphone', 'area',
)

# view
person = Person.objects.get(pk=id)
if request.method == 'POST':
form = PersonForm(request.POST, instance=person)
if form.is_valid():
form.save()
return HttpResponseRedirect('/profile/')
else:
print form.errors
else:
form = PersonForm(instance=person)
return render_to_response(
'profile_edit.html',
{'form': form},
context_instance=RequestContext(request))

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



Re: Form redisplay in the case of form errors?

2011-04-26 Thread Daniel Roseman


On Tuesday, April 26, 2011 10:37:50 AM UTC+1, Derek wrote:
>
> I have a form that I am expecting will redisplay with errors; it does not 
> do so.  Instead, the "print form.errors" statement is reached which does, in 
> fact, show that there are errors. For example:
>
> cellphoneThis field is 
> required.
>
> What else do I need to do to have the form be redisplayed?
>
> Thanks
> Derek
>
>
> # form
> class PersonForm(ModelForm):
> class Meta:
> model = Person
> fields = (
> 'first_name', 'last_name', 'date_of_birth', 'gender', 'email',
> 'cellphone', 'area',
> )
>
> # view
> person = Person.objects.get(pk=id)
> if request.method == 'POST':
> form = PersonForm(request.POST, instance=person)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/profile/')
> else:
> print form.errors
> else:
> form = PersonForm(instance=person)
> return render_to_response(
> 'profile_edit.html',
> {'form': form},
> context_instance=RequestContext(request))
>

Just move the final return call back one indent. The form will then be 
displayed in all cases other than successful validation.
--
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 write a view that accesses a method over all objects in a given model?

2011-04-26 Thread matt
First post, creating first Django project and having a of an issue I
was hoping for some help with!

I'm trying to write my own search which takes as input a user's
location and returns a list of places (from my db) sorted by
proximity. Here's roughly what I've got:

in models.py:

class Place(models.Model):
   ...
  def coordinates(self)
location = Location(self.zipcode, self.street)
return location

(Location works beautifully, spitting out coordinates of my instances
of Place which I can see on my Place page using a generic view and in
the admin)

But in views.py I can't figure out how to access this information.
I've written a Distance function which works in interpreter, and I can
convert my query into the kind of input the function can handle, but
how can I access the coordinates of Place in a view??

Thanks for the help!

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



Accessing ImageField temporary file to dynamically change upload_to storage path

2011-04-26 Thread Ian Turner
I'm in need of direction to access the temporary file that is stored
in memory or on disk from an ImageField/FileField so that I can read
it before it gets moved to its final location.

The topics I've found all deal with only modifying the storage path
based on other fields in a model.  My requirement is reading EXIF/IPTC/
XMP data to grab the Date created of a photo.

Providing a callable to "upload_to" gives an instance but the image
field doesn't have a file associated with it yet (working logically).
So how can I access the temporary memory or file to read it?

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



Re: Accessing ImageField temporary file to dynamically change upload_to storage path

2011-04-26 Thread Thomas Weholt
I'm also looking for something like this so please post any info you
might find on the subject if you don't get the answer in this group.

PS! FYI: I think most software writing metadata into a file writes at
exif, perhaps xmp or iptc in addition to plain exif, so you only need
to check for exif data to get the date. Pil is the fastest way to do
that, but pyexiv2 handles xmp very well too, but is much slower ( in
my tests so far ). Pil does not handle metadata from all image files
either, but pyexiv2 has never let me down. I've written a metadata
extraction method that tries pil first and falls back to pyexiv2 if
pil fails to extract the date from exif. Perhaps a custom storage
backend which handles metadata as well could solve this? Anyway,
please post any findings you might have. I'm in the middle of a huge
photo library project in django and any piece of information about
images, metadata and django is appreciated.

Regards,
Thomas

On Tue, Apr 26, 2011 at 8:16 AM, Ian Turner  wrote:
> I'm in need of direction to access the temporary file that is stored
> in memory or on disk from an ImageField/FileField so that I can read
> it before it gets moved to its final location.
>
> The topics I've found all deal with only modifying the storage path
> based on other fields in a model.  My requirement is reading EXIF/IPTC/
> XMP data to grab the Date created of a photo.
>
> Providing a callable to "upload_to" gives an instance but the image
> field doesn't have a file associated with it yet (working logically).
> So how can I access the temporary memory or file to read it?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: Django 1.2 Dropped Sessions when single view contains registration and login authentication

2011-04-26 Thread Ray Cote
- Original Message -
> From: "benp" 
> To: "Django users" 
> Sent: Monday, April 25, 2011 8:54:15 AM
> Subject: Django 1.2 Dropped Sessions when single view contains registration 
> and login authentication
> I've seen other Django developers have the same exact issue with
> registering and logging in a user in the same view. There hasn't been
> a satisfactory answer yet, though I've seen it suggested that it could
> be related to MySQL timeouts or threading issues.
I'll just add my voice as someone else also fighting this issue to no avail.

In our situation, we have two (originally identical) deployments of a custom 
Django app. 
One never has this problem. Users of the second one frequently report this 
error. 
And yes, difficult to reproduce in our test environments. 
--Ray

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



Unexpected error

2011-04-26 Thread Czare1
Once for a while I get very strange error. It's listed below. I

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/
base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/www/apache22/django-apps/religia_test_pl/frontend/
views.py", line 125, in standard_page
article =
get_object_or_404(Page.objects.active_with_expired().select_related(depth=1),
id=page_id)

  File "/usr/local/lib/python2.7/site-packages/django/shortcuts/
__init__.py", line 113, in get_object_or_404
return queryset.get(*args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/db/models/
query.py", line 349, in get
% self.model._meta.object_name)

TypeError: 'exceptions.IndexError' object is not callable


,
POST:,
COOKIES:{'__utma':
'150994869.1564363155.1303383499.1303819996.1303823441.14',
 '__utmb': '150994869.6.10.1303823441',
 '__utmc': '150994869',
 '__utmz': '38281853.1303808779.6.5.utmcsr=religia.test.pl|
utmccn=(referral)|utmcmd=referral|utmcct=/category/wywiady,8/',
 'csrftoken': '9072d7b8e066329d7061e7db82d6182b',
 'geoloc': '12',
 'test_aui': '1',
 'test_cid': '18991619f3e2cf017278b9c9cfae0d15',
 'test_sid': '7ce95443dcb5695792cf027f3e487dcd',
 'test_ubi': '201104201728590718010022',
 'test_uoi': 'l%3Dreligiabs%2540test.pl%26n%3D61898957%26s%3D1%26p
%3D0%26z%3D1',
 'test_wl': 'MVF+ATMT+MLOD+MEDI+KOBN+ZDR+DZMK',
 'testzuo_ticket':
'1F13D016392FCE4F0BED9D7DA11ECAEB01004DCAF8AE7E70C026A7AEB86FF5C884A75BD9DD7800',
 'sessionid': '16600872ae1d51ecb9c580f739e4ce80'},
META:{'AUTH_TYPE': 'Basic',
 'CSRF_COOKIE': '9072d7b8e066329d7061e7db82d6182b',
 'DOCUMENT_ROOT': '/usr/local/www/apache22/django-apps',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-2,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'pl,en;q=0.8,en-US;q=0.6',
 'HTTP_COOKIE': 'test_ubi=201104201728590718010022;
testzuo_ticket=1F13D016392FCE4F0BED9D7DA11ECAEB01004DCAF8AE7E70C026A7AEB86FF5C884A75BD9DD7800;
test_cid=18991619f3e2cf017278b9c9cfae0d15; test_uoi=l%3Dreligiabs
%2540test.pl%26n%3D61898957%26s%3D1%26p%3D0%26z%3D1; test_aui=1;
__utmz=150994869.1303453719.6.2.utmcsr=p.test.blueservices.pl|
utmccn=(referral)|utmcmd=referral|utmcct=/gallery/
galeria-19042011,2.html; test_sid=7ce95443dcb5695792cf027f3e487dcd;
sessionid=16600872ae1d51ecb9c580f739e4ce80;
__utmz=38281853.1303808779.6.5.utmcsr=religia.test.pl|
utmccn=(referral)|utmcmd=referral|utmcct=/category/wywiady,8/;
__utma=38281853.1575839522.1303313712.1303454105.1303808779.6;
__utmc=38281853; csrftoken=9072d7b8e066329d7061e7db82d6182b;
test_wl=MVF+ATMT+MLOD+MEDI+KOBN+ZDR+DZMK; geoloc=12;
__utma=150994869.1564363155.1303383499.1303819996.1303823441.14;
__utmc=150994869; __utmb=150994869.6.10.1303823441',
 'HTTP_HOST': 'religia.test.pl',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/
534.16',
 'HTTP_X_VARNISH': '1036411300',
 'PATH_INFO': u'/kraj,19/pamietamy,686578121.html',
 'PATH_TRANSLATED': '/usr/local/www/apache22/django-apps/
religia_test_pl/production.wsgi/kraj,19/pamietamy,686578121.html',
 'QUERY_STRING': '',
 'REMOTE_ADDR': 'x.x.x.x',
 'REMOTE_PORT': '25000',
 'REMOTE_USER': 'test',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/kraj,19/pamietamy,686578121.html',
 'SCRIPT_FILENAME': '/usr/local/www/apache22/django-apps/
religia_test_pl/production.wsgi',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': 'x.x.x.x',
 'SERVER_ADMIN': 'n...@test.pl',
 'SERVER_NAME': 'religia.test.pl',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': '',
 'SERVER_SOFTWARE': 'Apache',
 'UNIQUE_ID': 'TbbEpdW0knoAAVkAPw0K',
 'mod_wsgi.application_group': '',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.handler_script': '',
 'mod_wsgi.input_chunked': '0',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '80',
 'mod_wsgi.process_group': 'religia_test_pl',
 'mod_wsgi.request_handler': 'wsgi-script',
 'mod_wsgi.script_reloading': '1',
 'mod_wsgi.version': (3, 3),
 'wsgi.errors': ,
 'wsgi.file_wrapper': ,
 'wsgi.input': ,
 'wsgi.multiprocess': True,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 1)}>
--

As you can see I user apache + mod_wsgi. Here are my config files:

--

WSGIDaemonProcess religia_onet_pl user=www group=www threads=25
processes=12
WSGIProcessGroup religia_test_pl
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /usr/local/www/apache22/django-apps/relig

fastcgi and new translation

2011-04-26 Thread ScOut3R
Dear List,

I have some issues with runfcgi and translations. I'm running the
fastcgi processes from runit with this:

/usr/local/bin/python /path/to/manage.py runfcgi daemonize=false
method=prefork host=127.0.0.1 port=8001

After compiling a new translation file I restart the fcgi processes
but I don't see the new strings served. If I run the developement
server everything is fine. After switching back to runfcgi I got back
the earlier state so I'm missing the new translations. I'm not an fcgi
guru but I don't see why the fcgi processes aren't picking up the
new .mo file after a restart.

If You need more info on this please ask, I'm not sure what should
post on this issue.

Best regards,
Mate

-- 
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: Unexpected error

2011-04-26 Thread Daniel Roseman
On Tuesday, April 26, 2011 2:32:35 PM UTC+1, Czare1 wrote:
>
> Once for a while I get very strange error. It's listed below. I 
>
> Traceback (most recent call last): 
>
>   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/ 
> base.py", line 111, in get_response 
> response = callback(request, *callback_args, **callback_kwargs) 
>
>   File "/usr/local/www/apache22/django-apps/religia_test_pl/frontend/ 
> views.py", line 125, in standard_page 
> article = 
> get_object_or_404(Page.objects.active_with_expired().select_related(depth=1), 
>
> id=page_id) 
>
>   File "/usr/local/lib/python2.7/site-packages/django/shortcuts/ 
> __init__.py", line 113, in get_object_or_404 
> return queryset.get(*args, **kwargs) 
>
>   File "/usr/local/lib/python2.7/site-packages/django/db/models/ 
> query.py", line 349, in get 
> % self.model._meta.object_name) 
>
> TypeError: 'exceptions.IndexError' object is not callable 
>
>


The error appears to be in your manager's `active_with_expired` method, 
which you have not posted.
--
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: Need advice on ecommerce app direction

2011-04-26 Thread shofty
agree with Russ, but i have used the book mentioned and found it
excellent.
http://www.amazon.com/Beginning-Django-Commerce-James-McGaw/dp/1430225351

not an affiiate link.

On Apr 26, 1:23 am, Russell Keith-Magee 
wrote:
> On Tuesday, April 26, 2011, Ernesto Guevara  wrote:
> > I find for download "Beginning Django E-Commerce" in webmasterresourceskit 
> > site. Look that.
>
> No - don't do that. And don't ever suggest that again.
>
> The site you have referenced is a pirate site, providing illegal
> downloads of copyrighted material. Promoting theft of copyrighted
> material isn't a practice that the Django project condones. Anyone
> making a habit of suggesting copyright theft in this forum will have
> their account banned.
>
> Yours,
> Russ Magee %-)

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



Re: Need advice on ecommerce app direction

2011-04-26 Thread william ratcliff
I believe that you can also buy the book (or e-book) directly from Amazon:
http://www.apress.com/9781430225355

and I also found it to be an excellent
read.

Best,
William

On Tue, Apr 26, 2011 at 10:15 AM, shofty  wrote:

> agree with Russ, but i have used the book mentioned and found it
> excellent.
> http://www.amazon.com/Beginning-Django-Commerce-James-McGaw/dp/1430225351
>
> not an affiiate link.
>
> On Apr 26, 1:23 am, Russell Keith-Magee 
> wrote:
> > On Tuesday, April 26, 2011, Ernesto Guevara 
> wrote:
> > > I find for download "Beginning Django E-Commerce" in
> webmasterresourceskit site. Look that.
> >
> > No - don't do that. And don't ever suggest that again.
> >
> > The site you have referenced is a pirate site, providing illegal
> > downloads of copyrighted material. Promoting theft of copyrighted
> > material isn't a practice that the Django project condones. Anyone
> > making a habit of suggesting copyright theft in this forum will have
> > their account banned.
> >
> > Yours,
> > Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Unexpected error

2011-04-26 Thread Czare1
Thanks for immediate answer. Here is my manager:

class PageManager(models.Manager):
def active(self):
return
self.active_with_expired().filter(Q(expire_time__exact=None) |
Q(expire_time__gt=datetime.now()))

def active_with_expired(self):
return self.filter(active=True,
start_time__lte=datetime.now())

use_for_related_fields=True

On 26 Kwi, 16:10, Daniel Roseman  wrote:
> On Tuesday, April 26, 2011 2:32:35 PM UTC+1, Czare1 wrote:
>
> > Once for a while I get very strange error. It's listed below. I
>
> > Traceback (most recent call last):
>
> >   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/
> > base.py", line 111, in get_response
> >     response = callback(request, *callback_args, **callback_kwargs)
>
> >   File "/usr/local/www/apache22/django-apps/religia_test_pl/frontend/
> > views.py", line 125, in standard_page
> >     article =
> > get_object_or_404(Page.objects.active_with_expired().select_related(depth=1 
> > ),
>
> > id=page_id)
>
> >   File "/usr/local/lib/python2.7/site-packages/django/shortcuts/
> > __init__.py", line 113, in get_object_or_404
> >     return queryset.get(*args, **kwargs)
>
> >   File "/usr/local/lib/python2.7/site-packages/django/db/models/
> > query.py", line 349, in get
> >     % self.model._meta.object_name)
>
> > TypeError: 'exceptions.IndexError' object is not callable
>
> 
>
> The error appears to be in your manager's `active_with_expired` method,
> which you have not posted.
> --
> 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.



Raw SQL within ModelForm.save() in one transaction

2011-04-26 Thread Radim
How can I execute raw SQL in ModelForm.save()? I am using Django 1.3 /
Postgresl 8.3 with contrib.admin without TransactionMiddleware. If I
use connection.cursor() in ModelForm.save() (called by admin view
which is using @transaction.commit_on_success), the cursor is created
within a new Postgres session (according to Postgres log - session
id). I need to do everything in one transaction. It seems that if a
transaction is open in connection, connection.cursor() creates a new
session, is it possible? How to do everything in one transaction/
session?

This was already asked here
http://groups.google.com/group/django-users/browse_thread/thread/20056ca45701cfd6?pli=1
but never answered.

Radim

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



M2M Ordering in Admin

2011-04-26 Thread br
I am creating an application for displaying decks of slides.   Each
slide may be in more than one deck.  Order of the slides in a deck
matters.   So, I have a many to many relation.

class Slide(BaseModel):
"""Represents a slide in a slide deck for a display""

class Deck(BaseModel):
name = models.CharField(max_length = 45, unique=True  )
slides = models.ManyToManyField(Slide, through='DeckSlides')

 class DeckSlides(BaseModel):
deck = models.ForeignKey(SlideDeck)
slide = models.ForeignKey(Slide)
slide_position= models.PositiveSmallIntegerField()

I am trying to figure out how I can use Admin to both select slides
for a deck (which is already provided by the default M2M control) and
set the ordering of the slides in the Deck (not provided by default
for an M2M in admin).  I'm guessing people have had to face this
before. I've googled it but am not finding a solution.

Thanks

br

-- 
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: M2M Ordering in Admin

2011-04-26 Thread br
Just found this:

http://pypi.python.org/pypi/django-sortedm2m/0.3.2

It looks awesome.  Thanks, Gregor.

Going to try it out. Will post back if I have problems.

br

On Apr 26, 9:06 am, br  wrote:
> I am creating an application for displaying decks of slides.   Each
> slide may be in more than one deck.  Order of the slides in a deck
> matters.   So, I have a many to many relation.
>
> class Slide(BaseModel):
>     """Represents a slide in a slide deck for a display""
>
> class Deck(BaseModel):
>     name = models.CharField(max_length = 45, unique=True  )
>     slides = models.ManyToManyField(Slide, through='DeckSlides')
>
>  class DeckSlides(BaseModel):
>     deck = models.ForeignKey(SlideDeck)
>     slide     = models.ForeignKey(Slide)
>     slide_position    = models.PositiveSmallIntegerField()
>
> I am trying to figure out how I can use Admin to both select slides
> for a deck (which is already provided by the default M2M control) and
> set the ordering of the slides in the Deck (not provided by default
> for an M2M in admin).  I'm guessing people have had to face this
> before. I've googled it but am not finding a solution.
>
> Thanks
>
> br

-- 
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: ORM help

2011-04-26 Thread Carl Meyer
Hi Daniel,

On Apr 22, 5:57 pm, Daniel Gerzo  wrote:
> I have a following models:
>
> class Movie(models.Model):
>      title = models.CharField(max_length=255)
>      year = models.IntegerField(max_length=4)
>      rating = models.DecimalField(max_digits=2, decimal_places=1, default=0)
>
> class Request(models.Model):
>      movie = models.ForeignKey(Movie)
>      user = models.ForeignKey(User)
>      language = models.CharField(max_length=7, db_index=True)
>      notes = models.CharField(max_length=255, blank=True, null=True)
>      added = models.DateTimeField(default=datetime.now)
>
> I want to get all Requests, with count per each pair of Movie and language.
>
> So far I got this:
> Request.objects.values('movie', 'language').annotate(Count('language'))
>
> That seems to give me almost what I want, but that way I get a
> ValueQuerySet. Is there a way to get or convert this to a QuerySet? I'd
> like to get an easy way to access Movie attributes from the above query
> as I will need to display movie title and rating in the template for
> each result from the above query.
>
> So, is there some better way of what am I trying to accomplish? If not,
> how should I proceed in retrieving the Movie attributes? Will I need to
> fetch those with something like Movie.objects.filter(pk__in=[list of
> ids]) and then manually map those?

That's one way, if you actually get full Movie objects out. However,
if you just need certain fields from the movie, you should be able to
do this:

Request.objects.values("movie__title",
"language").annotate(Count("language"))

Carl

-- 
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: cx_Oracle error: ImproperlyConfigured

2011-04-26 Thread kamal sharma
Thanks to all for supporting this to fix the issue.

So issue is resolved by adding these 2 lines in "app.wsgi"

os.environ["LD_LIBRARY_PATH"] = "/opt/app/oracle/products/11.2.0/lib"
os.environ["ORACLE_HOME"] = "/opt/app/oracle/products/11.2.0"

Thanks again for helping to fix this issue. Its really a superb forum to fix
the issue so quickly. :-)

Regards,
Kamal

On Sun, Apr 24, 2011 at 7:58 PM, Ian  wrote:

> On Apr 23, 12:29 pm, kamal sharma  wrote:
> > No it was .profile of mine. Now I have set the LD_LIBRARY_PATH in
> app.wsgi
> > as mentioned below and when I print the os.environ in the beginning of
> > views.py then it shows that newly added value.
>
> It's clear that your LD_LIBRARY_PATH is fine at this point, since the
> library must be loaded in order to get the ORA-01804 error.  The
> problem, as Jirka and I have suggested, is that the rest of your
> Oracle installation is still not visible to the process, which is
> preventing the client from reading its data files.  Why this is the
> case is unclear without knowing more details about your system.  Is
> the Oracle directory readable by the WSGI user?  Is the WSGI process
> running inside a chroot jail?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How to write a view that accesses a method over all objects in a given model?

2011-04-26 Thread Alendit
Hi,

to access a model in the view, simply import it into you view.
Something along the lines:

from yourapp.models import Place
from django.http import HttpResponse

def some_view(request):
OBJECT_ID = 1 # put here the id of the object
# or give it as a function argument
place = Place.object.get(id=OBJECT_ID)
coordinates= place.coordinates()
return HttpResponse("The coordinates of the place number %s are:
%s"\
   % (OBJECT_ID, coordinates) # assuming
Location has
 
# a string representation

You can also use django.db.models.get_model, which returns a model
class from a app_label, model_name tuple, although i would only use it
when the model names is not known at the compiling time.

Hope it helps.

Alendit.

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



authentication not working using test client

2011-04-26 Thread Roy Smith
I've got a test case that essentially looks like this:

--
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User

class ApiTest(TestCase):
def test_login(self):
username = 'foo'
email = 'f...@example.com'
password = 'secret'
user = User.objects.create_user(username, mail,
password=password)
assert user.username == username
assert user.is_active
client = Client()
assert client.login(username=username, password=password)  #
this assertion fails
--

When I run it, the client.login() assertion fails.  Any idea what I
might be doing wrong?

-- 
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: {{ STATIC_URL }} and RequestContext()

2011-04-26 Thread Alendit
Hi,

static context processor is simply this:

return {'STATIC_URL': settings.STATIC_URL}

so you can just add it to your context.

Regarding your design decision, i'm not sure, why don't you just give
the whole object to the context and access its attributes/functions in
the template. Would look much cleaner to me, separation of concerns
etc.

Alendit

-- 
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 do I decode a string that it is received by a filter ???

2011-04-26 Thread Alendit
Django docs say to set Apaches locale correctly

http://code.djangoproject.com/wiki/django_apache_and_mod_wsgi

Would mean to put

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'

into /etc/apache2/envvars.

-- 
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: authentication not working using test client

2011-04-26 Thread Roy Smith
I figured it out.  When I first set up my settings.py file, I did:

AUTHENTICATION_BACKENDS = (
'socialregistration.auth.FacebookAuth',
)

which breaks (well, omits) the default authentication module that 
client.login() depends on.  I needed to do:

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'socialregistration.auth.FacebookAuth',
)


On Apr 26, 2011, at 12:56 PM, Roy Smith wrote:

> I've got a test case that essentially looks like this:
> 
> --
> from django.test import TestCase
> from django.test.client import Client
> from django.contrib.auth.models import User
> 
> class ApiTest(TestCase):
>def test_login(self):
>username = 'foo'
>email = 'f...@example.com'
>password = 'secret'
>user = User.objects.create_user(username, mail,
> password=password)
>assert user.username == username
>assert user.is_active
>client = Client()
>assert client.login(username=username, password=password)  #
> this assertion fails
> --
> 
> When I run it, the client.login() assertion fails.  Any idea what I
> might be doing wrong?
> 
> -- 
> 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.
> 


---
Roy Smith
r...@panix.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 i connect my PostgreeSQL to a Django?

2011-04-26 Thread Web Lucas
My Django dont make any program because the PostgreeSQL is not
connect.


Someone help me.


Thanks for the answer.

Bye

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



Is there a more basic tutorial?

2011-04-26 Thread byront
Hello,

I went through the beginners tutorial and am interested in Django. I
new to web development altogether and am having trouble finding
resources to help me make a very basic but professional looking page.
Something similar to this yacht club page http://bhyc.on.ca/ with a
banner, menus that change on scroll over, several static pages, and a
front page with rotating information.

Any help would be greatly appreciated.

Thank you,
Byron

-- 
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 i connect my PostgreeSQL to a Django?

2011-04-26 Thread Shawn Milochik
What error are you getting?

-- 
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: Is there a more basic tutorial?

2011-04-26 Thread Shawn Milochik
This has nothing to do with Django. This is a Web design question. Try
a mailing list about HTML and/or CSS. Mostly CSS.

Shawn

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



Re: How do I decode a string that it is received by a filter ???

2011-04-26 Thread Oleg Lomaka
I meant to try locally if it solves your problem. If yes, then migrate
solution to live server. Anyway, what OS do you use at your apache server?

On Mon, Apr 25, 2011 at 9:40 PM, Ariel  wrote:

> The site is deploy in an apache server, that does not help.
> Do you have any other idea ???
> I thought this would be very easy to solve.
>
> I'd thanks any help.
> Regards
> Ariel
>
>
> On Mon, Apr 25, 2011 at 6:21 PM, Oleg Lomaka wrote:
>
>> Not sure if it helps in your case, but try to start django in UTF-8
>> locale. For example,
>>
>> LANG=en_US.UTF-8 ./manage.py runserver
>>
>>
>> On Mon, Apr 25, 2011 at 6:23 PM, Ariel  wrote:
>>
>>> I have the following problem, I have made a template filter that process
>>> a string, but when the string that is passed to the filter has a non-ascii
>>> character then I received that string in the filter codified, how can I
>>> decode the string ???
>>>
>>> For instance: in the template html I have the following code:
>>>
>>> {{object.name|tag_process}}
>>>
>>> But the name = "español" , the character ñ'' it is pass to the
>>> tag_process filter as C3%B1, then the string I received in the tag_process
>>> function is espaC3%B1ol instead of 'español', How can I solved that ???
>>>
>>>

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



User Profile and Form initial values

2011-04-26 Thread James
I'm struggling to create a method by which a user can update his user
profile, where the current information is displayed in the "edit"
form, and I'm hoping someone here can point out what I'm doing wrong.
I am not using ubernostrum's django-profiles for this because it
hasn't been touched in quite some time and therefore doesn't work out-
of-the-box with Django 1.3 (perhaps there's a fork or patch that I
missed).

Anyway, the issue: when the form is displayed, it acts as if I've
submitted it (error messages of missing data appear), and the initial
data doesn't appear, even if I make it explicit in __init__ (e.g.
self.fields['field'].initial = 'test'). I just get a blank field.

I've pared the following code down to the very basics and it still
doesn't work. Is there something missing? Or do I have something extra
that shouldn't be there?

http://pastebin.com/2D7ABMKW

Thanks,

James

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



Re: User Profile and Form initial values

2011-04-26 Thread Shawn Milochik
If you're creating a ModelForm that already has data in the database, 
don't pass in request.POST. Instead, pass in the instance with the 
'instance' keyword argument.


For example, if it was a ModelForm for the User object: form = 
UserForm(instance = request.user)





--
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 ORM question about lookups that span relationships

2011-04-26 Thread Carsten Fuchs
First of all, many thanks to everyone who replied in this thread, your posts were very interesting 
and helpful!


On 24.04.2011 07:35, Alexander Schepanovski wrote:

You can, with a subrequest:
Blog.objects.filter(pk__in=Entry.objects.filter(pub_date__lte=date(2011,
4, 1), headline__contains='Lennon').values('blog').distinct())


Is this the same?
To my understanding, this is the subrequest-"equivalent" to the query in my 
first post:

Blog.objects.filter(entry__pub_date__lte=date(2011, 4, 1), 
entry__headline__contains='Lennon')

but I don't think it finds blogs whose *most recent* entry before or at April 1st has the word 
"Easter" in the headline (or "Lennon", doesn't matter; sorry for the confusion that I accidentally 
created in my first mail).


This is because if there is a blog that has
- an entry with pub_date = 2010-09-23 with headline "Easter", and
- another more recent entry with a headline that does *not* contain 
"Easter",
the above query would find the blog, but it shouldn't. Please correct me if my 
understanding is wrong!

Best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de



smime.p7s
Description: S/MIME Cryptographic Signature


Re: User Profile and Form initial values

2011-04-26 Thread James
That did it. 99% of the time the data will be there; I can write
exception clauses for when it isn't. I think I'll use this method,
though I had just discovered the "initial" dictionary argument as
well, a few minutes before I noticed your reply. Is there a spot in
the Django docs that explains this in more detail? I haven't been able
to find it.

Thank you very much!

James

On Apr 26, 3:17 pm, Shawn Milochik  wrote:
> If you're creating a ModelForm that already has data in the database,
> don't pass in request.POST. Instead, pass in the instance with the
> 'instance' keyword argument.
>
> For example, if it was a ModelForm for the User object: form =
> UserForm(instance = request.user)

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



Re: User Profile and Form initial values

2011-04-26 Thread Kenny Meyer
On Tue, Apr 26, 2011 at 4:17 PM, Shawn Milochik  wrote:
> If you're creating a ModelForm that already has data in the database, don't
> pass in request.POST. Instead, pass in the instance with the 'instance'
> keyword argument.
>
> For example, if it was a ModelForm for the User object: form =
> UserForm(instance = request.user)
Thanks, I had the same question and passing an instance worked fine
for me. Isn't this documented somewhere?

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



Re: User Profile and Form initial values

2011-04-26 Thread Shawn Milochik

On 04/26/2011 06:04 PM, Kenny Meyer wrote:

On Tue, Apr 26, 2011 at 4:17 PM, Shawn Milochik  wrote:

If you're creating a ModelForm that already has data in the database, don't
pass in request.POST. Instead, pass in the instance with the 'instance'
keyword argument.

For example, if it was a ModelForm for the User object: form =
UserForm(instance = request.user)

Thanks, I had the same question and passing an instance worked fine
for me. Isn't this documented somewhere?



You know, I assume it must be documented because I know it. However, I 
was unable to find it by doing a quick search of the docs. Maybe I read 
it in a book.


I'll do a little more looking for it and if I don't find it I'll open a 
ticket to improve the documentation. It'll be an easy ticket to work on.


Shawn

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



Re: User Profile and Form initial values

2011-04-26 Thread Shawn Milochik

Yeah, it's documented. Right at the tippy-top of the ModelForms docs.

http://docs.djangoproject.com/en/1.3/topics/forms/modelforms/



--
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: Is there a more basic tutorial?

2011-04-26 Thread Lachlan Musicman
On Wed, Apr 27, 2011 at 04:34, byront  wrote:
> Hello,
>
> I went through the beginners tutorial and am interested in Django. I
> new to web development altogether and am having trouble finding
> resources to help me make a very basic but professional looking page.
> Something similar to this yacht club page http://bhyc.on.ca/ with a
> banner, menus that change on scroll over, several static pages, and a
> front page with rotating information.
>
> Any help would be greatly appreciated.

As Shawn says, the underlying HTML and CSS is probably a good place to
start for an understanding of how the whole web system works. Django
is what I would call a third generation web dev platform, with first
gen being html/css via notepad or nvu/dreamweaver. Second generation
would be the CMS mob: wordpress, joomla, drupal, etc.

None of these will really help you witha lot of the other stuff you
will need to know - web servers (apache, nginx, lighttpd), CGI, etc.
If you are not a computer scientist or not planning on being one, and
want simple: try wordpress. If you are planning on being a computer
scientist of some description, learn html and css (and then move onto
django).

cheers
L.

-- 
Bacon ice cream (or Bacon-and-egg ice cream) is a modern invention in
experimental cookery, generally created by adding bacon to egg custard
and freezing the mixture. Although it was a joke in a Two Ronnies
sketch, it was eventually created for April Fools’ Day. Heston
Blumenthal experimented with the creation of ice cream, making a
custard similar to scrambled eggs then adding bacon to create one of
his signature dishes. It now regularly appears on dessert menus in
high-end restaurants.
from The Best of Wikipedia http://bestofwikipedia.tumblr.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: Is there a more basic tutorial?

2011-04-26 Thread Kenneth Gonsalves
On Wed, 2011-04-27 at 10:24 +1000, Lachlan Musicman wrote:
> None of these will really help you witha lot of the other stuff you
> will need to know - web servers (apache, nginx, lighttpd), CGI, etc.
> If you are not a computer scientist or not planning on being one, and
> want simple: try wordpress. If you are planning on being a computer
> scientist of some description, learn html and css (and then move onto
> django). 

also work on python and sql
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Django view in admin index.

2011-04-26 Thread kelvinfix
I have a view in view.py:

def question_list(request):
#questions = Question.objects.filter(topic__icontains = 1)
questions = Question.objects.all()
return render_to_response('admin/question_list.html',
{'questions':questions})
question_list = staff_member_required(question_list)

How can I add the view into admin.py? So that it can be view in the
admin index page.

-- 
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 view in admin index.

2011-04-26 Thread Oleg Lomaka
Not clearly understand what do you need.

If you want to modify Admin index page to add your action links or widgets,
take a look at django-grappelli or django-admin-tools.

If you want to add custom view for your models, then read this
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls

On Wed, Apr 27, 2011 at 3:42 AM, kelvinfix  wrote:

> I have a view in view.py:
>
> def question_list(request):
>#questions = Question.objects.filter(topic__icontains = 1)
>questions = Question.objects.all()
>return render_to_response('admin/question_list.html',
> {'questions':questions})
> question_list = staff_member_required(question_list)
>
> How can I add the view into admin.py? So that it can be view in the
> admin index page.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Unexpected error

2011-04-26 Thread Czare1
The error keeps happening. Here is another trace:


Traceback (most recent call last):

  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/
base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/
options.py", line 307, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/utils/
decorators.py", line 93, in _wrapped_view
response = view_func(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/views/decorators/
cache.py", line 79, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/
sites.py", line 197, in inner
return view(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/utils/
decorators.py", line 28, in _wrapper
return bound_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/utils/
decorators.py", line 93, in _wrapped_view
response = view_func(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/utils/
decorators.py", line 24, in bound_func
return func(self, *args2, **kwargs2)

  File "/usr/local/lib/python2.7/site-packages/django/db/
transaction.py", line 217, in inner
res = func(*args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/
options.py", line 947, in change_view
obj = self.get_object(request, unquote(object_id))

  File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/
options.py", line 451, in get_object
return queryset.get(pk=object_id)

  File "/usr/local/lib/python2.7/site-packages/django/db/models/
query.py", line 349, in get
% self.model._meta.object_name)

TypeError: 'exceptions.IndexError' object is not callable


Anybody has an idea what is happening?

On 26 Kwi, 16:54, Czare1  wrote:
> Thanks for immediate answer. Here is my manager:
>
> class PageManager(models.Manager):
>     def active(self):
>         return
> self.active_with_expired().filter(Q(expire_time__exact=None) |
> Q(expire_time__gt=datetime.now()))
>
>     def active_with_expired(self):
>         return self.filter(active=True,
> start_time__lte=datetime.now())
>
>     use_for_related_fields=True
>
> On 26 Kwi, 16:10, Daniel Roseman  wrote:
>
>
>
>
>
>
>
> > On Tuesday, April 26, 2011 2:32:35 PM UTC+1, Czare1 wrote:
>
> > > Once for a while I get very strange error. It's listed below. I
>
> > > Traceback (most recent call last):
>
> > >   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/
> > > base.py", line 111, in get_response
> > >     response = callback(request, *callback_args, **callback_kwargs)
>
> > >   File "/usr/local/www/apache22/django-apps/religia_test_pl/frontend/
> > > views.py", line 125, in standard_page
> > >     article =
> > > get_object_or_404(Page.objects.active_with_expired().select_related(depth=1
> > >  ),
>
> > > id=page_id)
>
> > >   File "/usr/local/lib/python2.7/site-packages/django/shortcuts/
> > > __init__.py", line 113, in get_object_or_404
> > >     return queryset.get(*args, **kwargs)
>
> > >   File "/usr/local/lib/python2.7/site-packages/django/db/models/
> > > query.py", line 349, in get
> > >     % self.model._meta.object_name)
>
> > > TypeError: 'exceptions.IndexError' object is not callable
>
> > 
>
> > The error appears to be in your manager's `active_with_expired` method,
> > which you have not posted.
> > --
> > 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 and fastcgi losing some info in request data

2011-04-26 Thread xiao_haozi
sorry... was doing some more digging.

Seems the problem is exclusive to // scenarios.
doing somethign like this:
http://mydomain/url/http%3A%21%21wikipedia.com/
gives me the proper :
http:!!wikipedia.com
etc etc

so any clue why it would be exclusively stripping out one / from // ?

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



Experience of migrating a Django site to DotCloud

2011-04-26 Thread Olli Wang
I have migrated my Django site to the new PaaS provider DotCloud. I
think it's a pretty good choice if you want to deploy your Django on
the cloud.

You can see the full article at 
http://www.ollix.com/blog/2011/04/25/migrating-django-site-dotcloud/

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



Hyperlinks in Messages

2011-04-26 Thread Venkatraman S
Hi,

How can i include hyperlinks in the messages?(am using the messages
framework).
The hyperlinks dont seem to get rendered; am getting the text'd version of
the HTML.

-Venkat

-- 
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 and fastcgi losing some info in request data

2011-04-26 Thread xiao_haozi
FOUND:
http://groups.google.com/group/django-users/msg/76718270ffed9696?pli=1
link for future reference.

-- 
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: Experience of migrating a Django site to DotCloud

2011-04-26 Thread Venkatraman S
On Wed, Apr 27, 2011 at 10:34 AM, Olli Wang  wrote:

> I have migrated my Django site to the new PaaS provider DotCloud. I
> think it's a pretty good choice if you want to deploy your Django on
> the cloud.
>
> You can see the full article at
> http://www.ollix.com/blog/2011/04/25/migrating-django-site-dotcloud/
>
>
40USD per month! hmmm..how are they better then webfaction? (and also
considering that they are in beta).

-- 
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 display the data on the page from the database

2011-04-26 Thread GKR
How to display the data on the page from the database in tabular format like 
msflexgrid with update facility.


Please help

-- 
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: Experience of migrating a Django site to DotCloud

2011-04-26 Thread Olli Wang
I had tried WebFaction before, but its SSH shell is extremely slow in
my country.

The first plan (40USD) should allow 3 instances, which means I can
assign one for Django site, one for database, and one for a worker to
handle time-consuming work. I don't know whether WebFaction is
designed for scaling or not, but I believe DotCloud is once it is out
of beta. Especially the beta is free, nothing gonna lose to give it a
try, right?

On Apr 27, 1:31 pm, Venkatraman S  wrote:
> On Wed, Apr 27, 2011 at 10:34 AM, Olli Wang  wrote:
> > I have migrated my Django site to the new PaaS provider DotCloud. I
> > think it's a pretty good choice if you want to deploy your Django on
> > the cloud.
>
> > You can see the full article at
> >http://www.ollix.com/blog/2011/04/25/migrating-django-site-dotcloud/
>
> 40USD per month! hmmm..how are they better then webfaction? (and also
> considering that they are in beta).

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