'bool' object has no attribute 'render'

2012-08-14 Thread yao ge
When delete a record in admin raise error : Request Method: POST Request URL:http://localhost/admin/tvplays/news/ Django Version: 1.4 Exception Type: AttributeError Exception Value: 'bool' object has no attribute 'render' Exception Location: E:\Python25\Lib\site-packages\django\t

Re: Help with Django code.

2011-08-27 Thread GE
You haven't said which OS you use. If you are in a unix-based environment, I found this article very helpful. http://www.juiceanalytics.com/writing/django_settings_module/ Good luck On Aug 26, 5:28 am, Yaşar Arabacı wrote: > Try this, always worked for me, > > import os > import sys > # assuming

Re: urgent, undo delete

2011-01-17 Thread ge...@aquarianhouse.com
you should have a backup of your data in the case where is no way to get the data back On Jan 17, 10:18 am, gintare wrote: > Is it possible to undo  model.filter( field_gte = datemin ).delete() > if it was the action, which happened from function in views.py, by > accidentaly uncommenting the li

Re: send_mail not firing

2010-05-18 Thread ge...@aquarianhouse.com
what happens if you set fail_silently to True? On May 19, 12:05 am, Nick wrote: > I am having an issue with an authentication app I am writing. The app > saves the form appropriately but doesn't send the confirmation email. > I am using the same email_host settings as with other application that

Re: How to adapt some code provided by friend

2010-05-05 Thread ge...@aquarianhouse.com
install MySQLdb :) On May 5, 1:23 pm, Etienne Python wrote: > On May 5, 12:42 pm, Daniel Roseman wrote: > > > > > On May 5, 11:06 am, Etienne Python wrote: > > > > Hey all, > > > > I'm a real beginner at both Django and Python, so excuse me if my > > > question looks silly to you. > > > > A fri

Re: Equivalent of php json_encode?

2010-05-04 Thread ge...@aquarianhouse.com
sure, simplejson is your helper On May 4, 4:34 pm, zweb wrote: > Is there a django or python equivalent of php json_encode? > > the data I am converting to json has text fields that have quotes, > double quotes, newlines and html tags. Creating json manually in my > program without escaping or co

Re: send an email to users after saving is_active=True

2010-05-04 Thread ge...@aquarianhouse.com
if you don't use django-registration, when listen on signal post_save for User, check if is_active == True and do something. On May 4, 2:45 pm, Sander wrote: > someone got an answer to this one? > is there some kind of is_activated signal? > > Sander > > On Apr 3, 6:19 pm, Alessandro Ronchi > wr

Re: HttpResponseRedirect and user message

2010-05-04 Thread ge...@aquarianhouse.com
i would use reverse and redirect to a "success" page def my_view(request): #do stufff #save info in session return HttpResponseRedirect(reverse('success_url')) def my_success_view(request): #access the session and get the data return render_to_response('success.html', locals()

Re: Distinct Field

2010-05-03 Thread ge...@aquarianhouse.com
QL "select distinct(year) from project" it works > fine, but I dont think its very elegant... > > On 3 maio, 07:31, "ge...@aquarianhouse.com" > wrote: > > > > > To use distinct in this context is not a good idea. > > > Better use aggregate and

Re: Distinct Field

2010-05-03 Thread ge...@aquarianhouse.com
To use distinct in this context is not a good idea. Better use aggregate and count the years. http://docs.djangoproject.com/en/dev/topics/db/aggregation/#generating-aggregates-over-a-queryset On May 3, 12:27 pm, Thales wrote: > Hi everybody, > > I have a model called "Project" with the field "y

Re: Refresh django settings without restarting apache

2010-04-29 Thread ge...@aquarianhouse.com
. > > On Thu, Apr 29, 2010 at 9:57 PM, ge...@aquarianhouse.com < > > > > ge...@aquarianhouse.com> wrote: > > Sure, with WSGI script reload > > > On Apr 29, 6:51 pm, Kashif Ali wrote: > > > Hi, > > > > Is it possible to refresh changes to a

Re: Refresh django settings without restarting apache

2010-04-29 Thread ge...@aquarianhouse.com
Sure, with WSGI script reload On Apr 29, 6:51 pm, Kashif Ali wrote: > Hi, > > Is it possible to refresh changes to apache (webserver) without restart it? > Actually i have multiple databases that i need to change while the webserver > is running. Is it possible? > > Or any other way to accomplish

Re: sorl-thumbnail: random name in Thumbnail field

2010-04-29 Thread ge...@aquarianhouse.com
http://docs.djangoproject.com/en/dev/howto/custom-file-storage/ On Apr 29, 6:48 pm, xRobot wrote: > No I am newbie and I don't know how to overwrite storage... could you > help me  ^_^ ? > > > > On 29 Apr, 12:46, "ge...@aquarianhouse.com" > wrote: &g

Re: sorl-thumbnail: random name in Thumbnail field

2010-04-29 Thread ge...@aquarianhouse.com
Did you try to overwrite the storage? On Apr 29, 6:16 pm, xRobot wrote: > I want to use str(uuid.uuid4()) instead of the name uploaded. > > For instance: I have this model: > > class foo(models.Model): >    pic  = ThumbnailField(upload_to='pics', size=(200, 200)) > > I am uploading hello_world.jp

Re: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
calling > pisaDocument with the generated data it hangs and after a while it > gives timeout. > > On Apr 22, 4:59 pm, "ge...@aquarianhouse.com" > > > > wrote: > > we say the whole thing takes 60 sec., how many sec. does it take to > > collect and how many to render

Re: How to raise integrity error in save method of model

2010-04-22 Thread ge...@aquarianhouse.com
In this case it's the wrong place, you have to put the logic into the form class MyForm(models.ModelForm): model = mdlcountry def country_name(self): #verify here and give an error On Apr 22, 3:51 pm, Tom Evans wrote: > On Thu, Apr 22, 2010 at 2:45 PM, Radhikavk wrote: > > > i hav

Re: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
after the data > is collected, at the line that calls the pisa.pisaDocument method to > generate the pdf and write the generated bits in a buffer, which > should then be sent to response. > So the bottleneck is at pdf generation step. > > On Apr 22, 4:25 pm, "ge...@aquarianho

Re: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
er Guerra Giraldez wrote: > > > > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com > > > wrote: > > > I your case i would put this task in queue or kind of a back process. > > > +1 > > > Queues are the way to go.  in this case, i guess a &quo

Re: How to raise integrity error in save method of model

2010-04-22 Thread ge...@aquarianhouse.com
def save(self, *args, **kw): if not mdlcountry.objects.filter(country_name=self.country_name).exists(): super(mdlroomtypes, self).save(*args, **kw) else: #do something or do nothing pass On Apr 22, 3:14 pm, Radhikavk wrote: > Model > > class mdlcountry(models.Model

Re: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
I think that would be a wrong approach. I your case i would put this task in queue or kind of a back process. For sure not on demand. On Apr 22, 1:19 pm, Florin wrote: > Hi! > > I use pisa to generate large pdf files, but it gives opage timeout > when generating. > It waits a long time at the f

Re: Email Field

2010-04-20 Thread ge...@aquarianhouse.com
did you try: email = models.EmailField(max_length=60) On Apr 20, 5:00 pm, CrabbyPete wrote: > Where in the django.contrib is the models.EmailField defined? I have > email address that are longer than 60 characters and I want to see if > I can override it. > > -- > You received this message becau

Re: unable to connect

2010-04-19 Thread ge...@aquarianhouse.com
Did you try http://127.0.0.1:8000/ ? On Apr 19, 8:51 pm, arpho wrote: > some days ago after a not clean shut-down django stopped to work, > after python manage.py runserver, it seems working normally, but when > I try to connect tohttp://localhost:8000/adminwith firefox all I can > get is Unable

Re: ChoiceField Being Unpatriotic

2010-04-18 Thread ge...@aquarianhouse.com
wacky but I guess > my model has to override or define an "all" method? > > Thanks in advance! > > On Apr 17, 11:34 am, "ge...@aquarianhouse.com" > > > > wrote: > > try with: > > > class AddressForm(forms.Form): > >         f

Re: Saving a ModelForm for the current user?

2010-04-18 Thread ge...@aquarianhouse.com
t occurs after form > validation takes place. Notice that in my Site model the url and user > fields are specified as being unique_together. If I set the user as > you suggest, I still run the risk of a database error. > > Is there another way to accomplish this? > > On A

Re: Saving a ModelForm for the current user?

2010-04-18 Thread ge...@aquarianhouse.com
use commit=False m = form.save(commit=False) m.user = request.user m.save() On Apr 18, 6:06 am, David Lindquist wrote: > Greetings, > > I am trying to solve what seems like an easy problem, but the solution > eludes me even after many Google searches. > > I have a simple model: > > class Site(mo

Re: Modify Content-Type to play MP3?

2010-04-18 Thread ge...@aquarianhouse.com
something like: f = open("file.mp3", "rb") data = f.read() f.close() return HttpResponse(data, mimetype='audio/mp3') On Apr 18, 6:34 am, The Danny Bos wrote: > Heya, > > I'm trying to modify the content-type of a page to play an MP3. > > Basically, instead of pointing directly to an MP3, I'm po

Re: Django-PostgreSQL-Unix_socket

2010-04-17 Thread ge...@aquarianhouse.com
leave HOST='' # empty then it's unix sockets On Apr 17, 10:04 pm, user4f <4fs...@gmail.com> wrote: > What exaple settings in settings.py for connection to PostgreSQL via > unix soket? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To

Re: ChoiceField Being Unpatriotic

2010-04-17 Thread ge...@aquarianhouse.com
try with: class AddressForm(forms.Form): first_and_last_name = forms.CharField(128, 1) street1 = forms.CharField(128, 1) street2 = forms.CharField(128, 1) city = forms.CharField(64, 1) state = forms.ModelChoiceField(queryset=States.objects.all()) form = Add

Re: how do you build an html website in python?

2010-04-17 Thread ge...@aquarianhouse.com
http://www.djangoproject.com/ On Apr 17, 3:06 pm, codecub wrote: > i want to create a website like whalesalad.com and ive read through > the python documentation but it doesnt explain building a website out > of scratch in python > > -- > You received this message because you are subscribed to th

Re: Authentication using email in Django 1.1

2010-04-17 Thread ge...@aquarianhouse.com
when overwrite the auth module :) On Apr 17, 12:08 pm, Marconi wrote: > Hello, I've been googling and I can't find a solution to use email > instead of username when logging-in that will work in Django 1.1 and > should also work on the admin side. > > -- > You received this message because you ar

Re: form won't save my submitted form

2010-04-16 Thread ge...@aquarianhouse.com
def save(self): # Better: don't overwrite save method if form.is_valid(): form.save() and you are fine On Apr 17, 12:30 am, JoJo wrote: > Hi all, i have created a site where users can leave messages, and > their opinions on certain topics, i have the form inserting the data, > and

Re: Concat a message with send_mail

2010-04-15 Thread ge...@aquarianhouse.com
As already mentioned, the best would be to use render_to_string('email_template.txt', {'name':'John', 'msg':'message'}) and pass it through. On Apr 15, 6:13 pm, Tim Shaffer wrote: > Can't you just concatenate them like so? > > message = "Last Name: " + last_name + " Message: " + message > > Or if

Re: Not able to resolve this error

2010-04-15 Thread ge...@aquarianhouse.com
P?[-\w]+ to ?P[-\w]+ On Apr 15, 3:46 pm, Pankaj Singh wrote: >  Page not found (404)  Request Method: GET  Request > URL:http://10.115.4.61:1234/weblog/2010/apr/14/how-it-functions/ > > Using the URLconf defined in django_project.urls, Django tried these URL > patterns, in this order: > >    1

Re: Django 1.2

2010-04-15 Thread ge...@aquarianhouse.com
Full roadmap: http://code.djangoproject.com/wiki/Version1.2Roadmap On Apr 15, 1:56 pm, Karen Tracey wrote: > On Thu, Apr 15, 2010 at 7:51 AM, Sudhakar wrote: > > > When is the official release of Django 1.2? > > http://www.djangoproject.com/weblog/2010/apr/14/django-1_2-release-sc... > > Karen -

Re: Help in working with the API

2010-04-15 Thread ge...@aquarianhouse.com
It seems there is no such table "DatabaseError: no such table: polls_choice " ./manage syncdb would help :) On Apr 15, 10:43 am, Vetc wrote: > Hello, > > I am a new user of Django, i am following the instructions at this web > page (http://docs.djangoproject.com/en/1.1/intro/tutorial01/#playing

Re: name in the model

2010-04-15 Thread ge...@aquarianhouse.com
Sure, use verbose_name='FOO' On Apr 15, 11:15 am, Alfredo Alessandrini wrote: > Hi, > > I've this model: > > class Persone(models.Model): >        CV = models.TextField() > > Can I change the name "CV" when I display it in a formset? > > Thanks, > > Alfredo -- You received this message because

Re: Calling a method immediately after login

2010-04-02 Thread ge...@aquarianhouse.com
In this case you should overwrite the auth class. http://docs.djangoproject.com/en/dev/topics/auth/ On Apr 2, 1:40 pm, Derek wrote: > I am running Django 1.1 and using the Admin framework with the "built-in" > user registration functionality. > > I need to run some code immediately after a user

Re: probleme with delete on cascade with foreign key self-referencing

2010-03-29 Thread ge...@aquarianhouse.com
i think like this: def delete_all(self): Categories.objects.filter(parent_category=self).delete() On Mar 29, 3:55 pm, mouadino wrote: > hello everybody > > I have a model class where i m  using a foreign key self-referencing > here is my code : > > class Categories(custom.Model): >     url =

Re: Django ORM

2010-03-23 Thread ge...@aquarianhouse.com
If it doesn't exist it would throw an exception. On Mar 23, 3:21 pm, jrs wrote: > On Mar 23, 10:05 am, "ge...@aquarianhouse.com" > > wrote: > > Filter would be better :) > > > Container.objects.filter( > >           pk=container_id > >      ).d

Re: Django ORM

2010-03-23 Thread ge...@aquarianhouse.com
Filter would be better :) Container.objects.filter( pk=container_id ).delete() On Mar 23, 2:55 pm, jrs wrote: > I have a statement--- > >     Container.objects.get( >          pk=container_id >     ).delete() > > This seemingly trivial operation hammers the db with 581 queries!! >

Re: Why should I always use a forward slash (/) in settings.py?

2010-03-18 Thread ge...@aquarianhouse.com
like this is also fine: os.path.join(os.path.dirname(__file__),'templates'), On Mar 18, 3:16 pm, brooder wrote: > http://docs.djangoproject.com/en/1.1/intro/tutorial01/#intro-tutorial01 > > Tutorial 1 says: "When specifying the path, always use forward > slashes, even on Windows (e.g. C:/homes/u

Re: error when updating

2010-03-18 Thread ge...@aquarianhouse.com
;POST': form = ActionForm(request.POST) # return render_to_response('tmp.html', locals())#etc... On Mar 18, 3:11 pm, Benedict Verheyen wrote: > ge...@aquarianhouse.com wrote: > > Hi, > > > I hope I understood it right. You could set the field to &g

Re: error when updating

2010-03-18 Thread ge...@aquarianhouse.com
Hi, I hope I understood it right. You could set the field to editable=False, the rest Django will take care. Btw, you have a typo "attachement" should be "attachment" I think. On Mar 18, 2:47 pm, Benedict Verheyen wrote: > Hi, > > i have a problem when saving a form for updating. > In my model,

Re: How to debug a 500 error - view not called, request not accessible

2010-03-16 Thread ge...@aquarianhouse.com
EMPLATE_DEBUG = DEBUG > > I'll read up on setting up a 500 error page to see if that helps. > > On Mar 16, 11:32 am, "ge...@aquarianhouse.com" > > wrote: > > We need more infos. > > > Is it on the test server or on the prodution server? > > >

Re: How to debug a 500 error - view not called, request not accessible

2010-03-16 Thread ge...@aquarianhouse.com
We need more infos. Is it on the test server or on the prodution server? Is DEBUG on? If debug is off and 500 is beeing showed when maybe django is trying to find "500.html" and if it's not available when this error happen like you have. On Mar 16, 4:22 pm, Stodge wrote: > I'm using the develo

Re: Resize image if too large

2010-03-15 Thread ge...@aquarianhouse.com
well, something is missing, like def save(self, *args, **kwargs): #your code but in our case the form class should do the validation... On Mar 15, 5:07 pm, When ideas fail wrote: > Hello, I've been trying to create a save method which resizes an image > if it is too large. Using pil this is

Re: Putting dictionary element according to another element's value

2010-03-15 Thread ge...@aquarianhouse.com
{% with o.id as key %}{{ dictionary.key }}{% endwith %} would be better, as in comments mentioned On Mar 15, 3:14 pm, "pjrhar...@gmail.com" wrote: > You'll need a custom template tag. Something like this will probably > do: > > http://push.cx/2007/django-template-tag-for-dictionary-access > > Pe

Re: REMOTE_ADDR

2010-03-15 Thread ge...@aquarianhouse.com
it seem to me, it's in the template. when it should work like this: {{ request.META.REMOTE_ADDR }} btw: > 'request.METTA['REMOTE_ADDR']' <--- in META is one T to much On Mar 15, 2:45 pm, Ken Lacey wrote: > Hi > > I am trying to access the remote addr in a view. > > Using request.META['REMOTE

Re: send_mail UnicodeDecodeError: 'ascii' codec can't decode byte

2010-03-14 Thread ge...@aquarianhouse.com
it should work with: body = unicode("Treść", 'utf-8') On Mar 14, 3:49 pm, Michał Klich wrote: > Hi, > I do not fully understand how this works. > > I have > subject = "Temat" > body = "Treść" > from = some.em...@dot.com > to = some.em...@dot.com > > send_email(subject, body, from, to) prints out

Re: convert mysql database to django model

2010-02-27 Thread ge...@aquarianhouse.com
Hi just use ./manage.py inspectdb ;) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. F

Re: Handling input of external urls

2010-02-26 Thread ge...@aquarianhouse.com
Check it with regex? re.compile("[a-z0-9]\.[a-z]{2,6}$", re.I) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsub

Re: update a record without typing too much

2010-02-26 Thread ge...@aquarianhouse.com
maybe like this?: def up(model, **kw): m.objects.filter(pk=model.pk).update(**kw) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email

Re: How to have both newforms-admin and previous version on the same machine?

2008-07-19 Thread ge
Don't know if this helps for your case, but I simply clone the django repository using git-svn, and then sym link the django directory to site-packages in the usual fashion. When you want to switch to a different branch, its as simple as running 'git checkout '. You can switch back and forth fr

Re: Help for strategy to load dynamic content by domain (not subdomains)

2008-06-11 Thread ge
Thanks, this seems to work well! On Jun 10, 11:14 pm, "Ronny Haryanto" <[EMAIL PROTECTED]> wrote: > On Wed, Jun 11, 2008 at 10:00 AM, ge <[EMAIL PROTECTED]> wrote: > > I have what I hope is a simple question here.  I do have a working > > solution, but I'

Help for strategy to load dynamic content by domain (not subdomains)

2008-06-10 Thread ge
I have what I hope is a simple question here. I do have a working solution, but I'd like to know if anyone has any thoughts on cleaner or perhaps more proper way to do this. For simplicities sake, lets assume I am trying to make a blogging service that allows users to create their own blogging p