Re: Duplicate entry in database on refreshing the submitted form

2012-09-29 Thread Timster
After saving the form, instead of doing a render_to_response, you should 
redirect the user to another page.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MrViZERB2J4J.
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 on Bluehost

2012-09-29 Thread JJ Zolper

I hate to be that guy but...

I was on Bluehost for a while but I just ended up deciding the benefits 
of switching to WebFaction far outweighed the benefits of staying on 
Bluehost as a Django user.


If you're interested in joining WebFaction or hearing more about it feel 
free to send me an e-mail at jzth...@gmail.com and I can tell you more 
about it.


If you feel that it suits what you want to do better I would be happy if 
you listed me as an affiliate! (Which I can explain if the time comes)


See ya later.

JJ

On 09/24/2012 12:21 AM, Zach wrote:

Hey everyone,
I have recently been setting up a Django 1.4.1 project with python 
2.7.2 and MySQL. I am using fcgi to deploy my project in this 
environment because mod_wsgi is not available through bluehost. After 
much frustration I have gotten my site up to display the "it works" 
page. Now for some strange reason I can not get it away from this 
page. I have set up the urls.py file for the main project along with 
adding my app into the Installed_Apps section of the settings.py file.

My .htaccess file is the following
*AddHandler fcgid-script .fcgi*
*Options +SymLinksIfOwnerMatch*
*RewriteEngine On*
*RewriteBase /*
*RewriteRule ^(media/.*)$ - [L]*
*RewriteRule ^(adminmedia/.*)$ - [L]*
*RewriteCond %{REQUEST_URI} !(mysite.fcgi)*
*RewriteRule ^(.*)$ mysite.fcgi/$1 [L]*

My mysite.fcgi is the following
*#!/home1/propesn4/python27/bin/python*
*import sys, os*
*sys.path.insert(0, "/home1/propesn4/python27")*
*os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
*
*sys.path.append("/home1/propesn4/project/")*
*from django.core.servers.fastcgi import runfastcgi*
*runfastcgi(method="threaded", daemonize="false")*
*
*
When I make changes to my django project I preform a *touch 
mysite.fcgi* so that the fcgi agent knows there has been changes.
If anyone could lead me in the right direction I would really 
appreciate it!


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Aqyku-yyimsJ.

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: Duplicate entry in database on refreshing the submitted form

2012-09-29 Thread Amyth Arora
As Tim said use "redirect" instead of "render". Alternatively on form
submit you can also have some kind of validation for ex: Query for one
reference_no can take place only once in 24 hours and if it is being
submitted twice return an error message. This way it will be more user
friendly. Also, you can add a "unique" field in your models to achieve this.


On Sat, Sep 29, 2012 at 5:43 PM, Satinderpal Singh <
satinder.goray...@gmail.com> wrote:

> On Sat, Sep 29, 2012 at 5:22 PM, Timster  wrote:
> > After saving the form, instead of doing a render_to_response, you should
> > redirect the user to another page.
> Thanks Timster, it works!
>
> --
> Satinderpal Singh
> http://satindergoraya.blogspot.in/
> http://satindergoraya91.blogspot.in/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @mytharora
http://techstricks.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.



select_related and use_for_related_field

2012-09-29 Thread John Bazik
I have a custom manager class that has use_for_related_field set to true, 
and I set it to be the default manager in my model.  But when I make a 
query using select_related on the related field, I seem to get a plain 
queryset, not my custom one.  Here's a quick sketch of what I'm doing:

class MyQuerySet(models.query.QuerySet):
@property
def foo(self):
return self.filter(foo=True)

class MyManager(models.Manager):
use_for_related_field = True

def get_query_set(self):
return MyQuerySet(self.model)

class Widget(models.Model):
thingies = models.ManyToManyField(Thingy, related_name='widgets')
objects = MyManager()

When I run this query:

Thingy.objects.select_related('widgets').foo

Django tells me that

AttributeError: 'QuerySet' object has no attribute 'foo'

Is this something I should expect to work?  I seem to have reached the thin 
edge of both documentation and discussions.

John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Aw6O25M_gNgJ.
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.



Announcing DjangoNYC Office Hours

2012-09-29 Thread Sean O'Connor
 

Hello Everybody,

Tomorrow I'll be running a bit of an experiment on Google+.  The basic idea 
is that I'll be available on a Google Hangout for an hour or two tomorrow 
afternoon answering any Django questions that you might have.

If your interested in asking questions, join the hangout and ask away. 
 Otherwise, it might be interesting to just watch the hang out and see what 
you can learn from other people's questions.

You can join the office hours over at http://bit.ly/SauDRO.

If you have any questions, have any feedback, or run into any problems, 
please feel free to let me know.

Thanks!



Sean O'Connor
http://seanoc.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FpF0cRXZtg8J.
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.



AW: Announcing DjangoNYC Office Hours

2012-09-29 Thread Patrick Müssig
Hi, which time you will Run the hangout

Von meinem Xperia™ smartphone gesendet

 Originalnachricht 
Betreff: Announcing DjangoNYC Office Hours
Von: Sean O'Connor 
An: django-users@googlegroups.com
Cc: 

 

Hello Everybody,

Tomorrow I'll be running a bit of an experiment on Google+.  The basic idea 
is that I'll be available on a Google Hangout for an hour or two tomorrow 
afternoon answering any Django questions that you might have.

If your interested in asking questions, join the hangout and ask away. 
 Otherwise, it might be interesting to just watch the hang out and see what 
you can learn from other people's questions.

You can join the office hours over at http://bit.ly/SauDRO.

If you have any questions, have any feedback, or run into any problems, 
please feel free to let me know.

Thanks!



Sean O'Connor
http://seanoc.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FpF0cRXZtg8J.
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: splitting up image loads from rest of page

2012-09-29 Thread Larry Martell
On Fri, Sep 28, 2012 at 1:48 PM, Larry Martell  wrote:
> I have a template that creates a table that has clickable links. It
> also loads a bunch of images associated with each row in the table.
> Through javascript events, when the user mouses over certain fields,
> the images are displayed or hidden. Initially, all the images are not
> displayed
>
> When the page loads, the table is produced quickly, but then there's a
> period of time before you can click on the links or mouse over and see
> the images. How long that period of time is seems directly related to
> how many rows there are in the table, so I'm assuming that time is
> being spent loading the images. Would that be a correct assumption?
>
> Assuming my assumption is correct, is there a way I can some how split
> this up, so the clickable links work as soon as the table is rendered,
> without waiting for the images? Also, the client is asking for me to
> display '... loading images' which goes away once they are all loaded.
> Can anyone tell me how I could do that?

For the archives:

What I did was to move the code that handles the clickable links into
a $(document).ready block (it was in a window.onload block). This
seems to be working fine for me - the links are active before the
images are loaded.

For the other part of this task (display '... loading images' which
goes away once all the images are loaded), I created the text with
display: none, then when the page is created I show() it, and in the
window.onload function I hide it. This also seems to be working fine.

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



EntryAdmin.form does not inherit from BaseModelForm.

2012-09-29 Thread Chris Fox
Hello,

I'm having a strange issue where I get the following exception on my 
production server, but have no issues on my dev machine:

Django Version:1.3.1Exception Type:ImproperlyConfiguredException Value:

EntryAdmin.form does not inherit from BaseModelForm.

Exception 
Location:/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py
 
in validate_base, line 292Python Executable:/usr/local/bin/pythonPython 
Version:2.7.3

I have narrowed the problem down to this area of the code:

class EntryAdminForm(forms.ModelForm):
class Meta:
model = Entry

latitude = CoordinateField()
longitude = CoordinateField()

class EntryAdmin(admin.ModelAdmin):
form = EntryAdminForm  ## COMMENT OUT THIS LINE MAKES THE PRODUCTION 
SERVER WORK ##
list_display = ('title', 'location', 'pub_date', 'type', 'blogger')
list_filter = ('blogger', 'pub_date', 'type')

I have hit a wall with this one and could use some inspiration. 
As mentioned above commenting out form = EntryAdminForm in EntryAdmin makes 
everything work fine

Below is more details on the error:
Environment:


Request Method: GET
Request URL: http://URL/admin/sail_blog/entry/120/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'sail_blog',
 'blog_redirect']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/core/handlers/base.py" in 
get_response
  101. request.path_info)
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
resolve
  250. for pattern in self.url_patterns:
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
_get_url_patterns
  279. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
_get_urlconf_module
  274. self._urlconf_module = import_module(self.urlconf_name)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" 
in import_module
  35. __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/urls.py" in 
  5. admin.autodiscover()
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/__init__.py" 
in autodiscover
  26. import_module('%s.admin' % app)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" 
in import_module
  35. __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/sail_blog/admin.py" in 

  45. admin.site.register(Entry, EntryAdmin)
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/sites.py" 
in register
  97. validate(admin_class, model)
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" 
in validate
  24. validate_base(cls, model)
File 
"/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" 
in validate_base
  292. "BaseModelForm." % cls.__name__)

Exception Type: ImproperlyConfigured at /admin/sail_blog/entry/120/
Exception Value: EntryAdmin.form does not inherit from BaseModelForm.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GYzuwIcFQZsJ.
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.



Request for assistance from a Chinese Django user

2012-09-29 Thread Russell Keith-Magee
Hi all,

I require some assistance from a Django user that lives in China.

For the last month, whenever someone posts to Django-users, they
receive a notification email from China Mobile.

These emails are caused by a django-users subscriber that is
forwarding their mail to another address. However, the address they're
forwarding to isn't able to accept mail.

If my research is correct, this number indicates that the individual
is a customer of China Mobile, and lives in Wuhan.

If you live in China, and would like to assist me in contacting this
user so we can unsubscribe them, please email me privately at
russ...@keith-magee.com.

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.