Re: send_mail on MAC OS X 10.7

2012-10-01 Thread Laxmikant Gurnalkar
Comment the csrf from settings. It doesnt work when you want.I use session
and own credentials to do that
And just write a simple view to send mail.
This will work without csrf or any of credentials & etc.

*Cheers*

Laxmikant

On Tue, Oct 2, 2012 at 6:15 AM, Cheng  wrote:

> Hi,
>
> I am new to django.
>
> I am following The Definitive Guide to Django SECOND EDITION by Adrian
> Holovaty and Jacob Kaplan -Moss and I cannot get the contact form to send
> mail. First the eg did not work at all until I added the @csrf-exempt
> decorator. Keeps getting Error 61 Connection Failure after that.
>
> Would be grateful if someone can help.
>
> Thanks,
> Cheng
>
> --
> 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/-/r40DN0e3ybAJ.
> 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.
>



-- 
*

 GlxGuru

*

-- 
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: Newbie question - setting a model form foriegn key

2012-10-01 Thread Laxmikant Gurnalkar
Sorry, see again!!

def payments_view(request, contact_id):
payment = Payment()
contact =   contact.objects.filter(id=contact_id)
if contact:
payment.contact  = contact[0]
payment.save()


I dont think you are looking for this kind of thing :
cheers

On Tue, Oct 2, 2012 at 10:42 AM, Laxmikant Gurnalkar <
laxmikant.gurnal...@gmail.com> wrote:

> def payments_view(request, contact_id):
> payment = Payment()
> payment.contact  = contact[0]
>
>> 'contact': contact, 'payments': payments, 'form' : PaymentForm()
>> })
>> return render_to_response('CRMSite/contact_payments.html',rctx)
>>
>rctx = RequestContext(request,{
> On Tue, Oct 2, 2012 at 4:20 AM, Keir Lawson  wrote:
>
>> Sorry if this is a dumb question, just picking up Django.
>>
>> I've set up a payments form, to create payments associated with a contact
>> (see payments model) however I'm having trouble figuring out how to save
>> the payment with the relevant contact associated, as the contact isnt
>> selected as part of the form (its in the URL instead).  I've included both
>> the payment view and the view for processing it, my current approach
>> results in a validation error. Anyone able to help?
>>
>> Thanks
>>
>> Keir
>>
>> class Payment(models.Model):
>> amount = models.DecimalField(max_digits=10, decimal_places=2)
>> date = models.DateField()
>> contact = models.ForeignKey(Contact)
>>
>> def payments_view(request, contact_id):
>> contact = get_object_or_404(Contact, pk=contact_id)
>> payments = Payment.objects.filter(contact=contact_id)
>> rctx = RequestContext(request,{
>> 'contact': contact, 'payments': payments, 'form' : PaymentForm()
>> })
>> return render_to_response('CRMSite/contact_payments.html',rctx)
>>
>> def save_payment(request,contact_id):
>> PaymentForm(request.POST,contact=contact_id).save()
>> return payments_view(request, contact_id)
>>
>>  --
>> 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/-/g4cNoMI7bEoJ.
>> 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.
>>
>
>
>
>
>


-- 
*

 GlxGuru

*

-- 
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: Newbie question - setting a model form foriegn key

2012-10-01 Thread Laxmikant Gurnalkar
def payments_view(request, contact_id):
payment = Payment()

payment.contact  = contact[0]


   rctx = RequestContext(request,{
> 'contact': contact, 'payments': payments, 'form' : PaymentForm()
> })
> return render_to_response('CRMSite/contact_payments.html',rctx)
>
On Tue, Oct 2, 2012 at 4:20 AM, Keir Lawson  wrote:

> Sorry if this is a dumb question, just picking up Django.
>
> I've set up a payments form, to create payments associated with a contact
> (see payments model) however I'm having trouble figuring out how to save
> the payment with the relevant contact associated, as the contact isnt
> selected as part of the form (its in the URL instead).  I've included both
> the payment view and the view for processing it, my current approach
> results in a validation error. Anyone able to help?
>
> Thanks
>
> Keir
>
> class Payment(models.Model):
> amount = models.DecimalField(max_digits=10, decimal_places=2)
> date = models.DateField()
> contact = models.ForeignKey(Contact)
>
> def payments_view(request, contact_id):
> contact = get_object_or_404(Contact, pk=contact_id)
> payments = Payment.objects.filter(contact=contact_id)
> rctx = RequestContext(request,{
> 'contact': contact, 'payments': payments, 'form' : PaymentForm()
> })
> return render_to_response('CRMSite/contact_payments.html',rctx)
>
> def save_payment(request,contact_id):
> PaymentForm(request.POST,contact=contact_id).save()
> return payments_view(request, contact_id)
>
>  --
> 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/-/g4cNoMI7bEoJ.
> 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.



send_mail on MAC OS X 10.7

2012-10-01 Thread Cheng
Hi,

I am new to django.

I am following The Definitive Guide to Django SECOND EDITION by Adrian 
Holovaty and Jacob Kaplan -Moss and I cannot get the contact form to send 
mail. First the eg did not work at all until I added the @csrf-exempt 
decorator. Keeps getting Error 61 Connection Failure after that. 

Would be grateful if someone can help.

Thanks,
Cheng

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

Title: Contact us



	Contact us 
	
	{% if errors %}
		
			{% for error in errors %}
			{{error}}
			{% endfor %}
		,/ul>
	{% endif %}
	  
		Subject: 
		Your e-mail(optional): 
		Message: 
		
	

	# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mydb',  # Or path to database file if using sqlite3.
'USER': 'beh',  # Not used with sqlite3.
'PASSWORD': 'swallow',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for default. Not used with sqlite3.
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'US/Pacific'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/;, "http://example.com/media/;
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '9xo!_4#txadx-gju-%=vc@mg5nzah9o=%zsmz8dzwnuf)@44l'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'mysite.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'mysite.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not 

middleware not executed on 404

2012-10-01 Thread Larry Martell
We have middleware that records the last url the user has visited:


class LastSiteUrl(object):

def is_admin_url(self, url):
if re.search('^(http:\/\/.*){0,1}\/admin\/', url) is None: return(False)
else: return(True)

def process_request(self, request):
if self.is_admin_url(request.path) and \
not self.is_admin_url(request.META['HTTP_REFERER']):
request.session['last_site_url'] = request.META['HTTP_REFERER']

We use this to return them back to the last app page they were at,
from an admin page, no matter how deep into admin they were. This is
working fine.

We have a custom 404 page, and from there I want to provide a link to
take them back to where they were in the app. But it seems the
middleware does not run when they go to an invalid page. Is there a
way to make it run in that case as well?

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



Re: app for kickstarter-like goals

2012-10-01 Thread Alec Taylor
What you are talking about are: "game mechanics"

With those keywords you should be able to find something. But it
doesn't look too difficult to build yourself.

On Mon, Oct 1, 2012 at 5:10 AM, Matteo Suppo  wrote:
> I'm developing a website for a non-profit organization.
>
> They want something similar to kickstarter, only based on people instead of
> money.
>
> Let's say there's an event. A birthday.
>
> If 5 people preorder the ticket there will be a clown*
> If 10 people preorder the ticket there will be a clown orchestra (in a small
> car)
> il 100 people preorder the ticket there will be a golden statue of a clown.
>
> I have no problem with the "buying tickets thing", but I couldn't find in
> django-packages anything related to milestones or goals.
>
> Do you know if there is already something I can use? Or should I create it?
>
> Thanks!
>
> * if you hate clowns you can replace them with cookies
>
> --
> 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/-/2y9biFnbiIUJ.
> 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.



Newbie question - setting a model form foriegn key

2012-10-01 Thread Keir Lawson
Sorry if this is a dumb question, just picking up Django.

I've set up a payments form, to create payments associated with a contact 
(see payments model) however I'm having trouble figuring out how to save 
the payment with the relevant contact associated, as the contact isnt 
selected as part of the form (its in the URL instead).  I've included both 
the payment view and the view for processing it, my current approach 
results in a validation error. Anyone able to help?

Thanks

Keir

class Payment(models.Model):
amount = models.DecimalField(max_digits=10, decimal_places=2)
date = models.DateField()
contact = models.ForeignKey(Contact)

def payments_view(request, contact_id):
contact = get_object_or_404(Contact, pk=contact_id)
payments = Payment.objects.filter(contact=contact_id)
rctx = RequestContext(request,{
'contact': contact, 'payments': payments, 'form' : PaymentForm()
})
return render_to_response('CRMSite/contact_payments.html',rctx)

def save_payment(request,contact_id):
PaymentForm(request.POST,contact=contact_id).save()
return payments_view(request, contact_id)

-- 
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/-/g4cNoMI7bEoJ.
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: app for kickstarter-like goals

2012-10-01 Thread Kurtis Mullins
haha, I'm not sure of anything that already implements this but it
shouldn't be too difficult to build yourself.

On Sun, Sep 30, 2012 at 3:10 PM, Matteo Suppo wrote:

> I'm developing a website for a non-profit organization.
>
> They want something similar to kickstarter, only based on people instead
> of money.
>
> Let's say there's an event. A birthday.
>
> If 5 people preorder the ticket there will be a clown*
> If 10 people preorder the ticket there will be a clown orchestra (in a
> small car)
> il 100 people preorder the ticket there will be a golden statue of a clown.
>
> I have no problem with the "buying tickets thing", but I couldn't find in
> django-packages anything related to milestones or goals.
>
> Do you know if there is already something I can use? Or should I create it?
>
> Thanks!
>
> * if you hate clowns you can replace them with cookies
>
> --
> 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/-/2y9biFnbiIUJ.
> 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: select_related and use_for_related_field

2012-10-01 Thread John Bazik
Does use_for_related_fields work with ManyToMany fields?  From the source, 
it looks like it does not.  Can anyone confirm that?

-- 
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/-/pOygA1eL7cIJ.
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 implement a form to update the quantity?

2012-10-01 Thread Anton Baklanov
it *is good idea* to submit...

missed some words, lol

On Mon, Oct 1, 2012 at 9:52 PM, Anton Baklanov wrote:

> it to submit forms with ajax, to not reload entire page every time.
>



-- 
Regards,
Anton Baklanov

-- 
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 implement a form to update the quantity?

2012-10-01 Thread Anton Baklanov
Hi!

You can use something like:

{% for item in garage.garagecar_set.all %}
Car:  {{item.car.name}}
Price:{{item.car.price}}
Quantity: {{item.quantity}}
ID:   {{item.car.id}}

  {{form.q}}
  

 {% endfor %}

and view like

def update_q(request, garagecar_id):
# get garagecar by id here, create form from request, set new value, save()


it to submit forms with ajax, to not reload entire page every time.


P.S.

it looks you are implementing Many-to-Many-Through relation. Django
has support for it out of the box
https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships



-- 
Regards,
Anton Baklanov

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



formfield_overrides causes all fields in admin to use the last marx_length in a model definition.

2012-10-01 Thread Paul Kenjora
I noticed this on several of my sites after adding formfield_overrides for 
Text fields in my admin.  I set the size of all the admin fields.

This caused all my fields to have the same length.  Coincidentally the 
length is always the max_length for the last field defined for that model 
in my models.py.

Is there a patch or a bug for this as I would expect "max_length" to be 
unaffected by setting the "size".

Yes, I know I can do it in CSS too, but its still sounds like a bug.

-- 
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/-/v_Bc-3vH4XEJ.
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: non-root SCRIPT_NAME, mod_wsgi and RewriteRule

2012-10-01 Thread m1chael
is it a problem with the trailing slash?

On Sun, Sep 30, 2012 at 7:57 AM, Sebastiaan Snoeckx <
sebastiaan.snoe...@gmail.com> wrote:

> I have my Django website and my static files deployed under the same
> directory (i.e. no separate 'static' directory), according to the following
> Apache RewriteRule:
>
> RewriteEngine on
> RewriteCond %{DOCUMENT_ROOT}%{REQUEST_**FILENAME} !-d
> RewriteCond %{DOCUMENT_ROOT}%{REQUEST_**FILENAME} !-f
> RewriteRule ^.*$ /django/$1  [QSA,PT,L]
>
> WSGIScriptAlias /django/ 
> /var/www/domain.com/django/**site/wsgi.py
>
> My site-wide urlconf looks like this:
>
> urlpatterns = patterns('',
> url(r'^blog/', include('blog.urls')),
> url(r'', include('home.urls')),
> )
>
> With my app-specific urlconf ('home.urls') is simply this:
>
> urlpatterns = patterns('home.views',
> url(r'^(?P[a-z0-9-]+)/?$'**, 'page_by_uri'),
> url(r'^$', 'index'),
> )
>
> So when I visit my site domain.com I should see the index view (which it
> does), and when I visit domain.com/foo I should see the
> page_by_uri('foo') view, *which it doesn't*. Instead, it shows the index
> view. (And I thought it should give an error!)
>
> Having surfed around a little bit, I reckon it's got something to do with
> Django's handling of SCRIPT_NAME (which should be equal to the mount point,
> in my case '/dj'). Various solutions are proposed, generally involving
> adding the mount point to my urlconf (bad!) until I tried it and it doesn't
> even work...
>
> Basically, how in the name of all that is holy and sacred can I get this
> to work?!
>
> Thanks in advance
>
>

-- 
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 implement a form to update the quantity?

2012-10-01 Thread enemybass
Hi. How to implement a form to update the quantity Car? I have no idea how 
to do it. Thanks

Code: http://dpaste.com/808558/

or here:

class Car(models.Model):
name = models.CharField(max_length=50)
price = models.DecimalField()

class GarageCar(models.Model):
car = models.ForeignKey('Car')
garage = models.ForeignKey('Garage')
quantity = models.IntegerField()

class Garage(models.Model):
name = models.CharField("Garage_Name", max_length=30)
cars = models.ManyToManyField('Car', through='GarageCar', 
blank=True, null=True)
owner = models.ForeignKey(User, related_name='owner_garage', 
verbose_name='Owner Garage')

In this way updates the quantity:

In [2]: c = Car.objects.get(id=1) #here I need car ID

In [3]: g = Garage.objects.get(owner=1)

In [4]: q = 33 #here I need data from form

In [5]: c= GarageCar.objects.filter(car=c, garage=g).update(quantity=q)



views:

def show(request):
user = request.user
garage = Garage.objects.get(owner=user)

return render_to_response('garage.html', {'garage': garage, 
'form':form})


in garage.html:

{% for item in garage.garagecar_set.all %}
Car:  {{item.car.name}}
Price:{{item.car.price}} 
Quantity: {{item.quantity}} 
ID:   {{item.car.id}}
{% endfor %}


in forms.py:

from django import forms

class QuantityForm(forms.Form):
q = forms.IntegerField

How to create ORM query to update quantity?

How to display a form field next to each car in template (with button 
"Update")?

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



Re: New Project 403 Forbidden Error

2012-10-01 Thread Bestrafung
Ok, I'm very new to all of this. I assumed following that guide would give 
me a basic working setup including some kind of "default" or starting 
pages/templates. If I understand correctly I have to create some kind of 
pages and/or templates still. I'm trying to figure that out now.

On Thursday, September 27, 2012 8:24:25 AM UTC-4, Amyth wrote:
>
> What View are you getting the error on ? can you post the code to the View 
> and the template ?
>
> Thanks & Regards
> 
>
> Amyth [Admin - Techstricks]
> Email - aroras@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/fXmuHgEoqW4J.
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: Add your own template library

2012-10-01 Thread Javier Guerra Giraldez
On Sun, Sep 30, 2012 at 11:59 PM, Ashish Jain  wrote:
> After which I am referring it into my website.

... and on settings.py?

-- 
Javier

-- 
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: GeometryField in OSMGeoAdmin

2012-10-01 Thread geonition
Hi,

It is really convenient for me to use GeometryField for saving arbitrary 
geometry types and thus I only had the problem with using the Django admin 
in viewing these geometries.

I was able to solve this issue and like to post it here if anyone else sees 
some value in the solution, or on the other side criticism on why the 
solution is bad.

So I solved the issue creating a database view for each geometry type in 
PostGIS database:

*CREATE OR REPLACE VIEW PolygonFeature AS SELECT * FROM 
geojson_rest_feature WHERE GeometryType(geometry) = 'POLYGON';*

These SQL View creation code I set in sql/ folder to be loaded as initial 
data. For each view created I created a django model with managed = False

*class PolygonFeature(FeatureBase):*
*geometry = gismodels.PolygonField(srid = getattr(settings, 
'SPATIAL_REFERENCE_SYSTEM_ID', 4326))*
**
*class Meta:*
*managed = False*
*db_table = 'polygonfeature'*


After this it is quite straight forward to register these models with the 
admin and everything seems to work fine except: 

   1. syncdb has to be run twice as geodjango creates the geometry fields 
   with the indexes and initial data is loaded before indexes.
   2. ManyToMany Fields will still create manytomany tables for views
   3. sqlflush and almost all other Django db management commands will break
   4. Django tests will break

But otherwise everything is ok,

b.r.
Kristoffer

On Friday, August 24, 2012 2:24:44 AM UTC+3, Melvyn Sopacua wrote:
>
> On 23-8-2012 10:41, geonition wrote: 
>
> > It is very convenient for me to use GeometryField as I can save any 
> > geometry type into the same field. The database logic will become more 
> > complex if I am required to create a separate table or field for e.g. 
> > points and linestrings. 
> > 
> > Still looking for a workaround, or is there a reason for me not to save 
> all 
> > geometries into the same field? 
>
> Well, the reason is that it's kind of like XML. As long as it validates, 
> programs don't complain, but to do anything useful with it you have to 
> understand the structure and capabilities of the specific dialect. 
> And this is exactly what is biting you. As soon as you try to do 
> something useful with it, you need to know exactly what you stored. This 
> applies to the admin but certainly also to queries: 
> What exactly have you stored in relation to the rest of the fields? For 
> a house, you store a point, for a street a line string, for a 
> state/province a polygon - so what exactly is in the table and if you it 
> contains addresses does the geometry field apply to the address/house, 
> to the street or to the province? 
>
> I don't really understand the fear of using multiple tables, but I do 
> see many problems trying to make sense of your data if a field is 
> polymorphic. The reason you put stuff into a database is to organize 
> things so you can explore relationships between all the bits pieces. 
> That implies you need to cut things up first. 
> -- 
> Melvyn Sopacua 
>

-- 
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/-/Zf1yUK2EfdYJ.
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: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:58 PM, Babatunde Akinyanmi
 wrote:
> Oooops. I see the question has already been answered. My phone didn't
> get the update on time.
No worries, Thanks anyways

> On 10/1/12, Babatunde Akinyanmi  wrote:
>> Its possible that when you refresh the form and the POST request gets
>> submitted, the form doesn't pass the form.is_valid() if conditional.
>> In your code, you didn't make any provision for when the form fails
>> the is_valid() test and from your code, execution stops once
>> is_valid() returns False so I **guess** that's where the problem lies.
>>
>> Try re-rendering the submitted form if is_valid is False or doing a
>> redirect.
>>
>> On 10/1/12, Satinderpal Singh  wrote:
>>> I made a model form and a view which accepts input as a form and
>>> display it in the html format. As when i refresh the html page or try
>>> to fill another entry in the form, it gives the following error:
>>>
>>> The view Automation.report.views.chemical_analysis didn't return an
>>> HttpResponse object.
>>>
>>> Here is the views that creates this problem:
>>> def chemical_analysis(request):
>>>  if request.method=='POST':
>>>  form = chem_analysisForm(request.POST)
>>>  if form.is_valid():
>>>  cd = form.cleaned_data
>>>  form.save()
>>>  chem = chem_analysis.objects.all()
>>>  #return HttpResponseRedirect(chem)
>>>  return 
>>> render_to_response('report/chemical_analysis.html',
>>> {'chem': chem,},context_instance=RequestContext(request))
>>>
>>>  else:
>>>  form = chem_analysisForm()
>>>  return render_to_response('report/report.html', 
>>> {"form":form},
>>> context_instance=RequestContext(request))
>>>
>>> Any help regarding this will be highly appreciated.
>>>
>>> --
>>> 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.
>>>
>>>
>>
>> --
>> Sent from my mobile device
>>
>
> --
> Sent from my mobile device
>
> --
> 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.
>



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



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Babatunde Akinyanmi
Oooops. I see the question has already been answered. My phone didn't
get the update on time.

On 10/1/12, Babatunde Akinyanmi  wrote:
> Its possible that when you refresh the form and the POST request gets
> submitted, the form doesn't pass the form.is_valid() if conditional.
> In your code, you didn't make any provision for when the form fails
> the is_valid() test and from your code, execution stops once
> is_valid() returns False so I **guess** that's where the problem lies.
>
> Try re-rendering the submitted form if is_valid is False or doing a
> redirect.
>
> On 10/1/12, Satinderpal Singh  wrote:
>> I made a model form and a view which accepts input as a form and
>> display it in the html format. As when i refresh the html page or try
>> to fill another entry in the form, it gives the following error:
>>
>> The view Automation.report.views.chemical_analysis didn't return an
>> HttpResponse object.
>>
>> Here is the views that creates this problem:
>> def chemical_analysis(request):
>>  if request.method=='POST':
>>  form = chem_analysisForm(request.POST)
>>  if form.is_valid():
>>  cd = form.cleaned_data
>>  form.save()
>>  chem = chem_analysis.objects.all()
>>  #return HttpResponseRedirect(chem)
>>  return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
>>  
>>  else:
>>  form = chem_analysisForm()
>>  return render_to_response('report/report.html', 
>> {"form":form},
>> context_instance=RequestContext(request))
>>  
>> Any help regarding this will be highly appreciated.
>>
>> --
>> 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.
>>
>>
>
> --
> Sent from my mobile device
>

-- 
Sent from my mobile device

-- 
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: The view didn't return an HttpResponse object.

2012-10-01 Thread Babatunde Akinyanmi
Its possible that when you refresh the form and the POST request gets
submitted, the form doesn't pass the form.is_valid() if conditional.
In your code, you didn't make any provision for when the form fails
the is_valid() test and from your code, execution stops once
is_valid() returns False so I **guess** that's where the problem lies.

Try re-rendering the submitted form if is_valid is False or doing a redirect.

On 10/1/12, Satinderpal Singh  wrote:
> I made a model form and a view which accepts input as a form and
> display it in the html format. As when i refresh the html page or try
> to fill another entry in the form, it gives the following error:
>
> The view Automation.report.views.chemical_analysis didn't return an
> HttpResponse object.
>
> Here is the views that creates this problem:
> def chemical_analysis(request):
>   if request.method=='POST':
>   form = chem_analysisForm(request.POST)
>   if form.is_valid():
>   cd = form.cleaned_data
>   form.save()
>   chem = chem_analysis.objects.all()
>   #return HttpResponseRedirect(chem)
>   return 
> render_to_response('report/chemical_analysis.html',
> {'chem': chem,},context_instance=RequestContext(request))
>   
>   else:
>   form = chem_analysisForm()
>   return render_to_response('report/report.html', 
> {"form":form},
> context_instance=RequestContext(request))
>   
> Any help regarding this will be highly appreciated.
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: The view didn't return an HttpResponse object.

2012-10-01 Thread Tom Evans
On Mon, Oct 1, 2012 at 12:11 PM, Satinderpal Singh
 wrote:
> On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans  wrote:
>> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
>>  wrote:
> I add the following to my code,
>>> I made a model form and a view which accepts input as a form and
>>> display it in the html format. As when i refresh the html page or try
>>> to fill another entry in the form, it gives the following error:
>>>
>>> The view Automation.report.views.chemical_analysis didn't return an
>>> HttpResponse object.
>>>
>>> Here is the views that creates this problem:
>>> def chemical_analysis(request):
>>> if request.method=='POST':
>>> form = chem_analysisForm(request.POST)
>>> if form.is_valid():
>>> cd = form.cleaned_data
>>> form.save()
>>> chem = chem_analysis.objects.all()
>>> #return HttpResponseRedirect(chem)
>>> return 
>>> render_to_response('report/chemical_analysis.html',
>>> {'chem': chem,},context_instance=RequestContext(request))
> else:
> return HttpResponse("There was an error with 
> your
> submission. Please try again.")
>>>
>>> else:
>>> form = chem_analysisForm()
>>> return render_to_response('report/report.html', 
>>> {"form":form},
>>> context_instance=RequestContext(request))
>>>
>>> Any help regarding this will be highly appreciated.
>>>
>>
>> If the request method is POST, but the form is not valid, then no
>> response is returned. You must return a response from every code path.
> Thanks, it works and now gives the error message, can you please tell
> me that why the input values are not saved in the database and it
> gives only the error message. Point me where i am wrong.
>

The form is not valid; check the data you are submitting and the form
definition to see why. The invalid form object itself will specify why
it is invalid, see the docs:

https://docs.djangoproject.com/en/1.4/topics/forms/#using-a-form-in-a-view
https://docs.djangoproject.com/en/1.4/ref/forms/api/#using-forms-to-validate-data

Cheers

Tom

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



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans  wrote:
> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
>  wrote:
I add the following to my code,
>> I made a model form and a view which accepts input as a form and
>> display it in the html format. As when i refresh the html page or try
>> to fill another entry in the form, it gives the following error:
>>
>> The view Automation.report.views.chemical_analysis didn't return an
>> HttpResponse object.
>>
>> Here is the views that creates this problem:
>> def chemical_analysis(request):
>> if request.method=='POST':
>> form = chem_analysisForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> form.save()
>> chem = chem_analysis.objects.all()
>> #return HttpResponseRedirect(chem)
>> return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
else:
return HttpResponse("There was an error with 
your
submission. Please try again.")
>>
>> else:
>> form = chem_analysisForm()
>> return render_to_response('report/report.html', 
>> {"form":form},
>> context_instance=RequestContext(request))
>>
>> Any help regarding this will be highly appreciated.
>>
>
> If the request method is POST, but the form is not valid, then no
> response is returned. You must return a response from every code path.
Thanks, it works and now gives the error message, can you please tell
me that why the input values are not saved in the database and it
gives only the error message. Point me where i am wrong.

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



Re: django and mysql versions

2012-10-01 Thread Tom Evans
On Sun, Sep 30, 2012 at 5:18 PM, Elizabeth Rachel Lemon
 wrote:
> According to this page:
> https://docs.djangoproject.com/en/dev/ref/databases/
> "Django supports MySQL 5.0.3 and higher."
>
> But the next section says that MySQLdb is required, and when you click the
> link to MySQLdb from that page, it goes to this page:
> http://sourceforge.net/projects/mysql-python/
>
> which states that the supported versions are:
> "MySQL versions from 3.23 to 5.1"
>
> Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and higher"
> seems to me to imply that this would work, but if MySQLdb is required for
> Django and MySQLdb only supports up to 5.1, then that implies that it is at
> least not supported. Anyone tried it?
>

5.5 will work completely fine.

5.1 was Sun's 'new features' branch, which was to be the way
everything was going to go, but after Oracle bought Sun and
re-purposed their engineering so that it wasn't quite so gung-ho, it
was clear 5.1 was a dead end. 5.5 is Oracle's reboot of that, and is
closer to 5.0 than 5.1.

Most of these new features in both branches are orthogonal to working
with Django's ORM however, as the client API has remained completely
stable, with only new features being added.

Cheers

Tom

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



Re: The view didn't return an HttpResponse object.

2012-10-01 Thread Tom Evans
On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
 wrote:
> I made a model form and a view which accepts input as a form and
> display it in the html format. As when i refresh the html page or try
> to fill another entry in the form, it gives the following error:
>
> The view Automation.report.views.chemical_analysis didn't return an
> HttpResponse object.
>
> Here is the views that creates this problem:
> def chemical_analysis(request):
> if request.method=='POST':
> form = chem_analysisForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> form.save()
> chem = chem_analysis.objects.all()
> #return HttpResponseRedirect(chem)
> return 
> render_to_response('report/chemical_analysis.html',
> {'chem': chem,},context_instance=RequestContext(request))
>
> else:
> form = chem_analysisForm()
> return render_to_response('report/report.html', 
> {"form":form},
> context_instance=RequestContext(request))
>
> Any help regarding this will be highly appreciated.
>

If the request method is POST, but the form is not valid, then no
response is returned. You must return a response from every code path.

Cheers

Tom

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



The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
I made a model form and a view which accepts input as a form and
display it in the html format. As when i refresh the html page or try
to fill another entry in the form, it gives the following error:

The view Automation.report.views.chemical_analysis didn't return an
HttpResponse object.

Here is the views that creates this problem:
def chemical_analysis(request):
if request.method=='POST':
form = chem_analysisForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
form.save()
chem = chem_analysis.objects.all()
#return HttpResponseRedirect(chem)
return 
render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))

else:
form = chem_analysisForm()
return render_to_response('report/report.html', 
{"form":form},
context_instance=RequestContext(request))

Any help regarding this will be highly appreciated.

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



Re: Tools - Slow in python django fw

2012-10-01 Thread Cal Leeming [Simplicity Media Ltd]
Yeah, you're going to need to give us much more information than that.

Here is a great link to show the kind of information you'd need to give;

https://code.djangoproject.com/wiki/UsingTheMailingList

Once you've sent more information, I'm sure someone will be able to help :)

Cal

On Mon, Oct 1, 2012 at 5:58 AM, siva <85s...@gmail.com> wrote:

> Hi ,
>
> We have converted our tools from php to django framework but tool
> performance is very slow compare to php .
>
> Please let us what are things we have to do ...
>
> Thanks,
> Siva
>
> --
> 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/-/7s9SZXW-TYUJ.
> 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: Tools - Slow in python django fw

2012-10-01 Thread Sergiy Khohlov
Have you disabled debug in setting.py ?

2012/10/1 Babatunde Akinyanmi :
> There are reasons why your app is slow but nobody would be able to
> tell you without viewing your sources. You can profile the app and
> pinpoint where exactly is slow and ask for advise from the list.
>
> You can install django-debug-toolbar to profile your database queries.
>
> On 10/1/12, siva <85s...@gmail.com> wrote:
>> Hi ,
>>
>> We have converted our tools from php to django framework but tool
>> performance is very slow compare to php .
>>
>> Please let us what are things we have to do ...
>>
>> Thanks,
>> Siva
>>
>> --
>> 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/-/7s9SZXW-TYUJ.
>> 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.
>>
>>
>
> --
> Sent from my mobile device
>
> --
> 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: Add your own template library

2012-10-01 Thread Ashish Jain

Thanks for the reply. Got the code working.
It was my mistake the way I was using template in my html page.

I had html page as: 

  {%load repeat%}
  ..
  {% repeat data %} {% endrepeat %}

I was not required to add  "*{%load repeat%}*" line, which was resulting 
into error. Straightway the repeat can be used.

- Thanks

On Monday, 1 October 2012 14:13:28 UTC+5:30, Tom Evans wrote:
>
> On Mon, Oct 1, 2012 at 5:59 AM, Ashish Jain 
>  
> wrote: 
> > Hi, 
> > 
> > Yes it do have __init__.py 
> > 
> > I have created a simple project of template tags and have installed it 
> as a 
> > python package with setup.py. 
> > 
> > After which I am referring it into my website. 
> > 
> > - Thanks for reply 
> > 
>
> You can only load template libraries from apps. Is your template 
> library contained within an app listed in INSTALLED_APPS? 
>
> Cheers 
>
> Tom 
>

-- 
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/-/u1ibfrtyIlsJ.
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: Add your own template library

2012-10-01 Thread Tom Evans
On Mon, Oct 1, 2012 at 5:59 AM, Ashish Jain  wrote:
> Hi,
>
> Yes it do have __init__.py
>
> I have created a simple project of template tags and have installed it as a
> python package with setup.py.
>
> After which I am referring it into my website.
>
> - Thanks for reply
>

You can only load template libraries from apps. Is your template
library contained within an app listed in INSTALLED_APPS?

Cheers

Tom

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



Re: Django project and SVN loads older code versions

2012-10-01 Thread Gjorge Karakabakov
I've solved this problem by removing all .pyc files in all the folders. 
Here is the official answer to my question that worked on stackoverflow: 
http://stackoverflow.com/questions/12578602/django-project-and-svn-loads-older-code-versions

On Tuesday, 25 September 2012 16:50:37 UTC+2, Joris wrote:
>
> The reason why you are seeing this behaviour is because apache caches the 
> compiled python scripts. As apache has multiple threads, some still carry 
> old information, and some new. As HTTP is stateless, this is why you get 
> inconsistent behaviour. The situation is resolved by either reloading 
> apache or by using the testing server. The behaviour you describe cannot be 
> a result of SVN, as SVN is not affected upon refresh. 
>
> jb
>
> Op dinsdag 25 september 2012 14:19:04 UTC+2 schreef Leo het volgende:
>>
>> Let me understand: you commit code to a SVN repository and put in in 
>> production? Did you restart Apache?
>>
>> Leo
>>
>> 2012/9/25 Gjorge Karakabakov 
>>
>>> I can't explain it but Django + SVN for code version control loads older 
>>> buggy versions of files every time i hit refresh on the web site i'm 
>>> working on.
>>>
>>> So if I changed something in a file 2 days ago (made lots of commits 
>>> since then) it will show up now. Next time I hit refresh another change 1 
>>> day ago appears.
>>>
>>> I'm using: Django 1.4, Apache, SVN
>>>  -- 
>>> 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/-/4UNbERN1NxoJ.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> -- 
>> Leonardo Giordani
>>
>>

-- 
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/-/rPB1DtHDiGQJ.
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: Tools - Slow in python django fw

2012-10-01 Thread Babatunde Akinyanmi
There are reasons why your app is slow but nobody would be able to
tell you without viewing your sources. You can profile the app and
pinpoint where exactly is slow and ask for advise from the list.

You can install django-debug-toolbar to profile your database queries.

On 10/1/12, siva <85s...@gmail.com> wrote:
> Hi ,
>
> We have converted our tools from php to django framework but tool
> performance is very slow compare to php .
>
> Please let us what are things we have to do ...
>
> Thanks,
> Siva
>
> --
> 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/-/7s9SZXW-TYUJ.
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: Add your own template library

2012-10-01 Thread Ashish Jain

For reference, I have manage.py as:

*#!/usr/bin/env python* 

*import os*

*import sys*

*
*

*# http://djangosnippets.org/snippets/342/*

*def load_templatetags():*

*  from django.conf import settings*

*  from django.template import add_to_builtins*

*
*

*  try:*

*   for lib in settings.TEMPLATE_TAGS:*

* print 'loading template tag %s'% lib*

* add_to_builtins(lib)*

*   print django.template.builtins[3].tags*

*   t = django.template.Template('{% load repeat %}')*

*   print t*

*  except AttributeError:*

*  pass*

*
*

*if __name__ == "__main__":*

*  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")*

 *  from django.core.management import execute_from_command_line*

*
*

*  execute_from_command_line(sys.argv)*

*
*

*  load_templatetags()*


In the print statements, I get the third loaded library has tags 'repeat'
but, 
   t = django.template.Template('{% load repeat %}')
throws the same error.

- Regards
Ashish

On Monday, 1 October 2012 10:29:44 UTC+5:30, Ashish Jain wrote:
>
> Hi,
>
> Yes it do have __init__.py
>
> I have created a simple project of template tags and have installed it as 
> a python package with setup.py.
>
> After which I am referring it into my website.
>
> - Thanks for reply
>
> On Monday, 1 October 2012 09:45:46 UTC+5:30, Laxmikant Gurnalkar wrote:
>>
>> Hi Ashish, 
>> Is there __init__.py in your templatetags directory ? 
>>
>> cheers
>> *Laxmikant*
>>
>>
>> On Mon, Oct 1, 2012 at 9:36 AM, Ashish Jain  wrote:
>>
>>> Hi,
>>>
>>> I have created a custom template tags library which I would like to use 
>>> across my application.
>>> I referred this code snippet, http://djangosnippets.org/snippets/342/
>>>
>>> but still when I refer the tag in my code as: {% load repeat %}.
>>>
>>> It says 'repeat' is not a valid tag library, tried 
>>> django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat
>>>
>>> Any help would be appreciated.
>>>
>>> - Thanks
>>> Ashish
>>>
>>> -- 
>>> 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/-/4AqRRolTYK0J.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> -- 
>> * 
>>
>>  GlxGuru
>>
>> *
>>
>

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