What is Django/python equivalent of this - Display textarea content with line breaks in html page?

2009-01-10 Thread zweb


Javascript:
document.getElemnetById(’textareacontent’).value.replace(/\n/
g,’’);
PHP:
preg_replace(”/\n/”,””,$_REQUEST['t1']);
Ruby:
(teaxtareacontent).gsub(/\n/,””)

( reference - 
http://rkutti.wordpress.com/2008/01/31/display-textarea-content-with-line-breaks-in-html-page/)

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



How to receive Emails in my django app

2009-01-16 Thread zweb

i can send emails easily using django.

I want to set up an email address, where users can send email to the
app (designated email address) and my django application receives it,
parses it and stores it in database.

What would be the easiest way to do it. ie " To receive email from
users in  Django application"

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



How to display html text in database back on screen?

2009-02-13 Thread zweb

I have tiny mce editor instead of text area for description field. For
rich text markup it generates and stores text with HTML markup in
database.

Now When I display this field data as {{form.description}},  I think
django automatically converts <> to < > for security reasons.
Any way to stop it or escape it so that html tags do does not show on
web page?





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



django-tinymce plugin question

2009-02-13 Thread zweb

I am using django-tinymce widget instead of text are widget. It is
displaying the formatting menu bar on bottom instead of top of the
field?
Anyway to tell it to show formatting menu bar on top of the editor
area?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



two html and django forms on a page issue?

2009-03-02 Thread zweb

I have two html forms on a page. Each html form has a django form
associated.
One form has validations.
When I submit the form (form1) which does not have validations, it
submit the other form (form2) on page as well and triggers the
validation on the form2. I do not want the form2 to validate on form1
submit. How to achieve that ?

I am doing form submit in javascript like this

 document.getElementById("id_project").onchange = submitForm;

function submitForm(){
document.form1.action='pages url';
document.form1.submit();
}

where id_project is a dropdown in form1.


--~--~-~--~~~---~--~~
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: Viewing uploaded files ?

2009-06-21 Thread zweb

I can add the field uploadedfile in model. what type is it and What
should I store in it?


On Jun 21, 8:56 pm, Kenneth Gonsalves  wrote:
> On Monday 22 June 2009 09:16:59 ydjango wrote:
>
> > 2) How do I dynamically get the url of the uploaded file? is it as
> > simple as /site_media//
> > where file is the uploaded Django file object.
>
> if your model has a field called uploadedfile, then the url in the template
> would be
> {{ object.uploadedfile.url }}
> --
> regards
> kghttp://lawgon.livejournal.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread zweb

What book or resource would you recommend to learn advanced Python?
(other than python docs)

On Jun 30, 7:49 am, James Bennett  wrote:
> On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote:
> > What is the python Magic going on here to make this possible?
>
> So, you want to read up on how Python descriptors work.
>
> One application of a descriptor is the ability to create something
> which behaves like a "normal" attribute, but under the hood calls a
> method to return the actual value. In this case, Django takes
> advantage of that to tell whether the manager attached to the class is
> being accessed from the class itself or from an instance, and raises
> an exception in the latter case.
>
> > My background is C++ and these look like methods/objects that are
> > static to the class, not part of the instances.  I just can't figure
> > out how to declare and instantiate them in python.
>
> You may want to step back a bit and re-think how you're approaching
> Python; truly "static" class members -- of the type you'd find in C++
> -- are very rarely actually needed/used.
>
> This is actually targeted more at Java folks, but you may want to have
> a look at Phillip Eby's old rant "Python is not Java"; it covers some
> common cases where directly bringing over ideas from other languages
> isn't the best way to approach programming in Python:
>
> http://www.dirtsimple.org/2004/12/python-is-not-java.html
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using email as username for django auth

2009-07-04 Thread zweb

i just increased the size of username in auth_user table to 100 and I
enter email as user name from my register user web page.

 Django auth is working fine. I use my own form and view but django's
authenticate and login methods.

It did not give me any errors saying I cannot enter or use (at) sign.

Am I missing something? Why are people writing alternate auth backends
for this?
--~--~-~--~~~---~--~~
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: ChoiceField, TypedChoiceField, ModelChoiceField and empty_label

2009-07-05 Thread zweb

I also agree this is a needed feature.

On Jul 3, 5:17 pm, maplye  wrote:
> I also agree that
>
> 2009/7/3 ristretto.rb :
>
>
>
> > Hello,
>
> > I have stepped through code, and cruised the django docs, forums, and
> > internet in general looking for how to setup an empty label with
> > TypedChoiceField (or ChoiceField.)  I suspected it would be done
> > similar to the way it is done with ModelChoiceField.
>
> > With ModelChoiceField, we can specify anempty_label.  But, with
> > TypeChoice and Choice you have to put an empty field in our choices
> > list.  And, None doesn't work, it has to be ''.
>
> > I have code that is working fine.  But, my question is...  Is there
> > any design reasonempty_labelwas not included in the other Choice
> > fields?
>
> > thanks
> > ristretto
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



TIME_ZONE = 'UTC' how does it work?

2009-09-05 Thread zweb

I am on mac os x and linux. I use mysql

How does the TIME_ZONE='UTC" in django settings.py work?

If i enter date time from web page and store it in mysql db. And no
timezone is associated with the datetime, does django assumes datetime
is in UTC and saves it without changing or does it assume it is in
local timezone of the server django is running on and converts it in
to utc?

Can anyone explain how does django use TIME_ZONE in settings.py. I
have read the documentation.

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



Pytz time conversion issue

2009-09-05 Thread zweb

When I convert from Pacific time to UTC
to db local Timzone: America/Los_Angeles
 to db local_dt 2009-09-07 00:00:00-08:00
 to db utc_dt 2009-09-07 08:00:00+00:00

when convert from UTC to Pacific time
utc_dt 2009-09-07 08:00:00+00:00
local_tz America/Los_Angeles
local_dt 2009-09-07 01:00:00 America/Los_Angeles


I see that I started with
local time 2009-09-07 00:00:00 to
 utc = 2009-09-07 08:00:00+00:00 and back to
local time = 2009-09-07 01:00:00

what did I miss?
Is it a DST issue?


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



DST or not

2009-09-05 Thread zweb

Is there any way to know if for a timezone , on a praticular date
time, is DST active or not?
it is required by localize command of pytz. How to find it
programatically?

>>> est_dt = eastern.localize(loc_dt, is_dst=True)
>>> edt_dt = eastern.localize(loc_dt, is_dst=False)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pytz time conversion issue

2009-09-05 Thread zweb

Converting from local to utc:

local Timzone: America/Los_Angeles
local_dt 2009-09-17 00:00:00-08:00
utc_dt 2009-09-17 08:00:00+00:00 ( after converting from local to utc)

when I convert back from UTC to America/Los_Angeles, I get back
local_dt 2009-09-24 01:00:00

which is one hour from where I started. Any clues how to fix it?

My code below:

>From Local to UTC:
local_timezone = timezone(local_tz)
local_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,
tzinfo=local_timezone)
utc_dt = utc.normalize(local_dt.astimezone(pytz.utc))

>From UTC to Local:
utc_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second, tzinfo=pytz.utc)
local_tz1 = timezone(local_tz)
loc_dt = local_tz1.normalize(utc_dt.astimezone(timezone(local_tz)))
--~--~-~--~~~---~--~~
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: Pytz time conversion issue

2009-09-05 Thread zweb

I figured it out.

 I should be using pytz localize function and not passing tzinfo to
datetime.
WRONG: local_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,tzinfo=local_timezone)
RIGHT:local_dt = local_timezone.localize(datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second))

On Sep 5, 2:47 pm, zweb  wrote:
> Converting from local to utc:
>
> local Timzone: America/Los_Angeles
> local_dt 2009-09-17 00:00:00-08:00
> utc_dt 2009-09-17 08:00:00+00:00 ( after converting from local to utc)
>
> when I convert back from UTC to America/Los_Angeles, I get back
> local_dt 2009-09-24 01:00:00
>
> which is one hour from where I started. Any clues how to fix it?
>
> My code below:
>
> From Local to UTC:
>     local_timezone = timezone(local_tz)
>     local_dt = datetime
> (dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,
> tzinfo=local_timezone)
>     utc_dt = utc.normalize(local_dt.astimezone(pytz.utc))
>
> From UTC to Local:
>     utc_dt = datetime
> (dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second, tzinfo=pytz.utc)
>     local_tz1 = timezone(local_tz)
>     loc_dt = local_tz1.normalize(utc_dt.astimezone(timezone(local_tz)))
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



I18n and varying text sizes on web page

2009-05-06 Thread zweb

Externalizing text for I18N is a great idea. But size of the text can
vary quite a lot depending on the language. How do you make sure space
for the text on web page resizes appropriately so that  string does
not get cutoff or page does not look ugly.

How do you design and build such a page/form in html and in flash?

Any experiences & techniques in html and/or flash?
--~--~-~--~~~---~--~~
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: Looking for something lighter than Sproutcore or Cappuccino that integrates well with Django

2009-05-10 Thread zweb

Hi,

I am also looking at Qooxdoo. What has been your experience so far?

Will it integrate with Django templates and views?



On Apr 8, 2:19 pm, Raymond Cote 
wrote:
> Rob Madole wrote:
> > The reason I'm posting is to ask the community if they have know of
> > anything that is at a higher level than jQuery + jQuery UI and a lower
> > level than Sproutcore/Cappuccino.  I'd like to find something that has
> > this kind of stuff in it:
>
>  From what I've seen, once you make that leap of higher than
> JQuery/Dojo/Mootools/Prototype/etc. you really do leap into a fully
> client-side environment like Cappuccino or Sproutcore and relegate your
> Django-side to be JSON-RPC or XML-RPC server.
>
> We've recently done the dance through a wide range of tools and ended up
> selectingQooxdoo(qooxdoo.org) for a variety of reasons.
> Also pretty heavy on the UI side, though it has capabilities to be used
> as a component on an otherwise static site.
> (we're drivingqooxdooagainst Twisted, and not Django, but the same
> principle applies).
>
> Of course, if you want a Gmail feel, there's always GWT (or, since this
> is a Python list, Pyjamas --http://code.google.com/p/pyjamas/)
> --Ray
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why django? Framework design or language

2009-06-14 Thread zweb

What would you consider a very good language?  What is missing or
irritating in python that makes you think python is not a very good
langauge.
I have been using python for couple of years, mainly as Django, and I
am at this point neutral to it.

On Jun 14, 4:23 am, Joshua Partogi  wrote:
> On Jun 14, 1:03 am, Jochem Berndsen  wrote:
>
> > I only use it because of (b), I don't care too much about Python and
> > don't think it is a very good language (I prefer statically typed and
> > functional languages). But Django makes it worth it :)
>
> Interesting comment. I feel the same way too. Yeah django makes python more
> worth it. Back then when there was no django, I felt python was quite
> irritating compared to perl. But django makes the good use of python.
>
> Cheers.
>
> --
> Join Scrum8.com.
>
> http://scrum8.com/member/jpartogi/http://scrum8.com/blog/jpartogi/http://twitter.com/scrum8
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Image for amazon EC2

2009-09-14 Thread zweb

Can you please refer me to any good images for Linux, Django 1 or 1.1,
mysql, apache images?

or alternatively any good blog or instruction on how to host a django
based web application on EC2 with mysql backend.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django error

2009-09-19 Thread zweb

When I try to download a file through django in IE , I get

[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] response =
func(request, response), referer: http://www.com
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/
pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in
fix_IE_for_vary, referer: http://www..com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] if response
['Content-Type'].split(';')[0] not in safe_mime_types:, referer:
http://www.com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError:
'list' object has no attribute 'split', referer: http://www.com/


I am doing,

 for f in range(len(filepath)):
file_data = open('%s' % (filepath[f]), "rb").read()
response = HttpResponse(file_data,mimetype= content_type)
response['Content-Disposition'] = 'filename ='+ fname
return response

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



Django error

2009-09-19 Thread zweb

When I try to download a file through django in IE , I get

[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] response =
func(request, response), referer: http://www.com
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/
pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in
fix_IE_for_vary, referer: http://www..com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] if response
['Content-Type'].split(';')[0] not in safe_mime_types:, referer:
http://www.com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError:
'list' object has no attribute 'split', referer: http://www.com/


I am doing,

 for f in range(len(filepath)):
file_data = open('%s' % (filepath[f]), "rb").read()
response = HttpResponse(file_data,mimetype= content_type)
response['Content-Disposition'] = 'filename ='+ fname
return response

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



Django error

2009-09-19 Thread zweb

When I try to download a file through django in IE , I get

[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] response =
func(request, response), referer: http://www.com
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/
pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in
fix_IE_for_vary, referer: http://www..com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] if response
['Content-Type'].split(';')[0] not in safe_mime_types:, referer:
http://www.com/
[Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError:
'list' object has no attribute 'split', referer: http://www.com/


I am doing,

 for f in range(len(filepath)):
file_data = open('%s' % (filepath[f]), "rb").read()
response = HttpResponse(file_data,mimetype= content_type)
response['Content-Disposition'] = 'filename ='+ fname
return response

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



Django Tiny Mce: focus on tab

2009-10-01 Thread zweb

I have a tinymce field like this...

When I tab, the cursor just skips the tinymce text area and moves to
next field. ie it jumps from field tabindex 1 to field with tabindex
3. tinymce editor has tabindex 2. I am using django tinymce.

If anyone has come across this problem and know answer or see problem
with line below, please let me know

  description=forms.CharField(label=' Description*', widget=TinyMCE
(attrs={'cols': 90, 'rows': 20,'tabindex':'2'}),error_messages=
{'required':'! You must enter a Description.'})

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



django-wikiapp reviews?

2009-10-06 Thread zweb

Has anyone used django wikiapp in production.

Any reviews of this app - Features you liked?

Any major issues or shortcomings one should be aware of?

Any alternatives you can recommend, I should evaluate 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
-~--~~~~--~~--~--~---



Putting django based site on HTTPS

2009-10-26 Thread zweb

I want to serve whole of my site on HTTPS.
But HttpResponseRedirect  is sending to http by default.

Any way to tell django that it should use https and not http

I am using mod_python on one site and mod_wsgi on another. Both need
to go to HTTPS



--~--~-~--~~~---~--~~
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: Redirects on HTTPS

2009-10-27 Thread zweb

for me this worked

SetEnvIf X-Forwarded-Proto https HTTPS=1

 as specified in this thread 
http://groups.google.com/group/django-users/browse_thread/thread/cdece5ef2e7fd280



On Oct 26, 6:01 am, "Tim Sawyer"  wrote:
> I still can't get this to work (original thread 
> athttp://groups.google.com/group/django-users/browse_thread/thread/cdec...).
>  I'm looking to get a HttpResponseRedirect in my django app to redirect to
> HTTPS not HTTP.
>
> I've tried:
>
> * proxy server Apache (the one doing the SSL) does:
> SetEnv X-Forwarded-Proto=https
> * Apache running django/mod_wsgi does this:
> SetEnvIf X-Forwarded-Proto https HTTPS=on
>
> I've also tried:
> * Hard coding HttpRequest.is_secure() in django to True
>
> I've tried changing my wsgi file to do this:
> _application = django.core.handlers.wsgi.WSGIHandler()
>
> def application(environ, start_response):
>     environ['HTTPS'] = 'on'
>     return _application(environ, start_response)
>
> but no luck.
>
> With everything I've tried, it still redirects back to HTTP on a
> HttpResponseRedirect.
>
> Any clues anyone?
>
> thanks,
>
> Tim.
--~--~-~--~~~---~--~~
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 remove " " from text for email

2009-11-08 Thread zweb



I have

description|safe|striptags

but description has some " " in addition to html tags. How do I
strip that off?


--~--~-~--~~~---~--~~
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 show site down for maintenance page

2009-12-05 Thread zweb
What is the best way to show site down for maintenance page ?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Equivalent of php json_encode?

2010-05-04 Thread zweb
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 converting these special characters is
causing problem on javascript side.

A php programmer suggested I use equivalent of php json_encode.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



permissions at per specific object instance

2010-05-05 Thread zweb
"Permissions are set globally per type of object, not per specific
object instance. For example, it's possible to say "Mary may change
news stories," but it's not currently possible to say "Mary may change
news stories, but only the ones she created herself" or "Mary may only
change news stories that have a certain status, publication date or
ID." The latter functionality is something Django developers are
currently discussing."

I need to build "permissions at per specific object instance" for my
app.

Anyone has already done it ?  Also it says django developers are
already discussing it..

You can please refer me to the threads or blog posts on it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



wierd template issue with perms (django auth)

2010-05-10 Thread zweb
I have
 {% if perms.core.add_project %} which is expected to be false but it
is returning true.

 I am running it on webfaction (mod_wsgi, python 2.5 , django 1,1,1).

I do {{perms.user}} in my html on webfaction and I get - perms:
set([u'core.view_project']) which is correct.
and {{perms.core.add_project }} return true which is not correct.

What am I missing??


when I run the same code on my local laptop using django test server
it works 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-us...@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.



Bug in Django auth

2010-05-10 Thread zweb
I displayed following values in my html template. I am running it on
wsgi, python 2.5 and Django 1.1.1 on webfaction.
{{perms.user}}Value displayed: set([])
{{perms.core}}Value displayed: set([])
{{perms.core.add_project}}   Value Displayed: True ( BUG: should be
false as perms.user and perms.core are both empty}


I also tried by adding a permission view_project. perms.user and
perms.core displayed that permission but perms.core.add_project still
returned true.

I have following in my settings.py

MIDDLEWARE_CLASSES = (

   'django.middleware.common.CommonMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.middleware.doc.XViewMiddleware',
)

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


It works fine on my Mac laptop using Django test server.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Bug in Django auth

2010-05-10 Thread zweb
thanks so much Allison.

That was the reason. test account I was using had is_superuser set to
1 in DB. Spent 4 hours debugging it.

Thanks a lot.



On May 10, 2:44 pm, Alisson Patrício  wrote:
> Maybe you're logged in with a superuser, superuser can do everything :)
>
>
>
> On Mon, May 10, 2010 at 3:52 PM, zweb  wrote:
> > I displayed following values in my html template. I am running it on
> > wsgi, python 2.5 and Django 1.1.1 on webfaction.
> > {{perms.user}}    Value displayed: set([])
> > {{perms.core}}    Value displayed: set([])
> > {{perms.core.add_project}}   Value Displayed: True ( BUG: should be
> > false as perms.user and perms.core are both empty}
>
> > I also tried by adding a permission view_project. perms.user and
> > perms.core displayed that permission but perms.core.add_project still
> > returned true.
>
> > I have following in my settings.py
>
> > MIDDLEWARE_CLASSES = (
>
> >   'django.middleware.common.CommonMiddleware',
> >   'django.contrib.sessions.middleware.SessionMiddleware',
> >   'django.contrib.auth.middleware.AuthenticationMiddleware',
> >   'django.middleware.doc.XViewMiddleware',
> > )
>
> > AUTHENTICATION_BACKENDS = (
> >    'django.contrib.auth.backends.ModelBackend',
> >  )
>
> > It works fine on my Mac laptop using Django test server.
>
> > --
> > 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
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Alisson Patríciohttp://alisson.net
>
> --
> 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.
> For more options, visit this group 
> athttp://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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Form Validation question

2010-05-13 Thread zweb
I am using a model form to edit (change) an exisiting row in db.

in clean_xxx() method I want to compare the old (existing) value
versus new value.

I can get new value from cleaned_data.


How do I get the old (existing) value?

If I do a db query to get the existing row from DB how do I get the PK
as it is not a form field.

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



Re: Form Validation question

2010-05-13 Thread zweb

I am doing this

 form = ContactForm(request.POST) # A form bound to the POST data
 if form.is_valid(): # All validation rules pass


As clean is called by is_valid() and at this point form in bound to
POST data, I cannot use self.instance unless I do this

form = ContactForm(request.POST, instance= contact)

Any downside to doing this ... as I have done either form =
ContactForm(request.POST) or  form = ContactForm( instance= contact)
but never both together.

On May 13, 7:51 am, Shawn Milochik  wrote:
> "Also, a model form instance bound to a model object will contain a 
> self.instance attribute that gives model form methods access to that specific 
> model instance."
>
> From:http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/
>
> So you can refer to self.instance in your validation code, assuming the form 
> is bound (not a new, unsaved instance created by the current form submission).
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django CSV module encoding issue

2010-05-14 Thread zweb
I am using DJango CSV module and doing writerrow() on some text data
generated through tinyce text editor.

I am getting  following error

ascii' codec can't encode character u'\\u2019' in position 337:
ordinal not in range(128)

 for some reason it cannot handle the single quote in text. How do I
fix it.

My code:

import csv
writer = csv.writer(response)
writer.writerow(["Description:  " + description])

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Any Experiences with Sphinx Search and Django-sphinx?

2010-06-01 Thread zweb
I am looking to provide search. All content is in MYSQL DB in innodb
tables. That rules out Mysql full text search option, which would have
been my first choice.

Other option I am looking at it is Sphinx search with django-sphinx.
Any experiences with it good and bad?

Other thing I looked at is Haystack, but I do not want to run and
maintain Solr.  Xapien or Whoosh with Haystack is second choce after
Sphinx.

Any pros or cons I need to consider before making a decision?

I am looking for
1) Full Text search over MYSQL innodb tables ( which are all available
as Django Models)
2) Reasonably good performance
3) Low Maintenance
4) Low memory usage
5) Very reliable solution.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to do user defined fields in Django?

2010-06-18 Thread zweb
I want users of my app to be able to define their own fields in
addition to the already existing fields.

These fields will be displayed on webpage, in form and saved in
database.

Fields can be of any of the standard types.

Any way to do it in django?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Chase Paymentech

2010-06-18 Thread zweb
I thought Chase Paymentech uses authorize.net.  Please correct me...

so any sample code to integrate django based web app to authorize.net
without going to chase or authorize.net hosted pages?



On Jun 18, 11:09 am, surtyaar  wrote:
> Hi Bobby,
>
> You might be interested in a django clone of the sample shopping cart
> chase paymentech provided (http://store.e-xact.com/).
>
> You can get the code and setup instructions here 
> :http://github.com/gitaaron/E-xact-django-clone
>
> Rgds/
> Aaron
>
> On Apr 20, 10:34 am, Bobby Roberts  wrote:
>
>
>
> > Hey Bill -
>
> > It is my understanding that as long as you do not store credit card
> > information on your servers, PCI compliance is not an issue.  Chase,
> > Authorize.net, Paypal, ilovechecks.com etc all have API gateways to
> > handle the transactions via https protocol which satisfies the
> > industry financial standards.  I'm just wondering if anyone has infact
> > worked with the Chase API before
>
> > On Apr 20, 10:17 am, Bill Freeman  wrote:
>
> > > Beware!  There are a number of security vulnerabilities you can have when
> > > handling credit card numbers.  There is something called PCI (Payment Card
> > > Industry, if I'm not mistaken) compliance, the intent of which is to
> > > try to avoid
> > > some of the big credit card number stealing hacks that have been in the 
> > > news
> > > in recent years.
>
> > > For most sites it is better to deal with someone like Authorize.net:  
> > > These
> > > services let you point your "checkout" link at them, either with a back 
> > > channel
> > > identified by order number (which you add to the url) to pick up the 
> > > total, and
> > > perhaps the item list, or a way to provide that in the get or post
> > > with a suitable
> > > signature.  They host a page that you get to style, so you can have,
> > > for example,
> > > your color scheme and logo.  They accept the credit card information, do 
> > > the
> > > dance with the payment processor (such as Chase Paymentech), and, if
> > > payment is successful, send you a packet, email, or provide a webservice
> > > where you can check, so that you know to "ship".  These services do all 
> > > the
> > > PCI compliance diligence.  You are safe because the credit card 
> > > information
> > > never touches your website.
>
> > > On Mon, Apr 19, 2010 at 10:17 AM, Bobby Roberts  
> > > wrote:
> > > > Has anyone out there integrated a payment module in django over to
> > > > Chase Paymentech to process credit cards?  I'm looking for sample code.
>
> > > > --
> > > > 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.
> > > > For more options, visit this group 
> > > > athttp://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-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Sphinx or haystack Xapian

2010-06-19 Thread zweb
I need to implement search solution over models in mysql.

Anyone has experience with both or has gone through same decision
making?

What should I consider before choosing one or other?

(Mysql text search will not work as I use INNODB. Solr is powerful but
I heard it is very memory hungry and it is in Java. Whoosh is not yet
as mature as others. So that leaves choice between Django Sphinx and
Haystack Xapian.)

thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Sphinx or haystack Xapian

2010-06-19 Thread zweb
 I am tilting towards Haystack Xapian solution over django sphinx
mainly for two reasons
1) Haystack supports  - Solr, Xapian and Whoosh. So in future I can
easily migrate  from Xapian to Solr as my need grows.
2) Sphinx  has slow index update.  Updating index takes as much time
as building a new one.


My views are based on quick reading of material and opinions on web
and not on my experience yet. Once I will try haystack xapian this
weekend and let you know.



On Jun 19, 10:54 am, Nick Arnett  wrote:
> On Sat, Jun 19, 2010 at 9:21 AM, zweb  wrote:
>
> > (Mysql text search will not work as I use INNODB. Solr is powerful but
> > I heard it is very memory hungry and it is in Java. Whoosh is not yet
> > as mature as others. So that leaves choice between Django Sphinx and
> > Haystack Xapian.)
>
> I meant to mention that although I'm using InnoDB, I'm storing a copy of the
> searchable text in a MyISAM table and using the MySQL search on it.  That's
> okay for now, but I'm looking for clustering, faceted search and other fancy
> stuff.
>
> I've worked in search-related technology for a long time and I should know
> that search performance always demands lots of memory...  So I may bite the
> bullet and use Solr, after all.  I just wish there were a way to trade off
> the memory for speed until I'm ready to deploy a real working version.
>
> Nick

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Real time search using Django Sphinx or haystack Xapian

2010-06-19 Thread zweb
" I'm storing a copy of the
searchable text in a MyISAM table and using the MySQL search on it."


I need to search results to be immediately available as soon as they
are updated in DB.
This will require me to update the index in real time which is not
very efficient.

Haystack does provide real time index update. Has anyone used it.

http://docs.haystacksearch.org/dev/searchindex_api.html#keeping-the-index-fresh

other than that I have two other options:
1) Search db for data updated after the last search index update date
and time and then show results from both Db and search engine. Risk is
search index result could return stale data or I might get duplicates.
2) Use an appoach like yours - " copy of the
searchable text in a MyISAM table and using the MySQL search on it."



On Jun 19, 10:54 am, Nick Arnett  wrote:
> On Sat, Jun 19, 2010 at 9:21 AM, zweb  wrote:
>
> > (Mysql text search will not work as I use INNODB. Solr is powerful but
> > I heard it is very memory hungry and it is in Java. Whoosh is not yet
> > as mature as others. So that leaves choice between Django Sphinx and
> > Haystack Xapian.)
>
> I meant to mention that although I'm using InnoDB, I'm storing a copy of the
> searchable text in a MyISAM table and using the MySQL search on it.  That's
> okay for now, but I'm looking for clustering, faceted search and other fancy
> stuff.
>
> I've worked in search-related technology for a long time and I should know
> that search performance always demands lots of memory...  So I may bite the
> bullet and use Solr, after all.  I just wish there were a way to trade off
> the memory for speed until I'm ready to deploy a real working version.
>
> Nick

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Jaspersoft or Pentaho with Django?

2010-06-25 Thread zweb
Has anyone used Jaspersoft or Pentaho with DJango or Python in
production?

Are there any Python equivalent of Jaspersoft/Pentaho?

Any experiences?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Personalization and preferences?

2010-07-01 Thread zweb
On my web pages I have  labels for text fields. I want user to be able
to personalize the labels.

Example :
default label: Employee, alternative is that user can choose -
Associate or Staff Member.
Depending on which label an user chooses, all screens should show that
label for that user. Other users can see other label they choose.
I am ok in providing fixed set of labels to choose from if that
simplifies things.
This problem is very similar to I18N except it is not based on locale.
What is the best approach?

Approach:
1. When user logs in - gets his preferences from DB and save it in
session.

2. I create a custom template {% getlabeltext employee %}

something like ** psuedo code **
def getLabelText('employee'):

   if 'employee' in request.session:
return request.session['employee']
   else:
   return DEFAULT

Is there a better approach or some one already done in this?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Personalization and Preferences?

2010-07-02 Thread zweb
On my web pages I have  labels for text fields. I want user to be able
to personalize the labels.

Example :
default label: Employee, alternative is that user can choose and
save-  Associate or Staff Member as label to be shown on all screens.


Approach I can think of:

1. When user logs in - gets his preferences from DB and save it in
session.

2. I create a custom template tag {% getlabeltext Employee %}

which is something like ( following is the psuedo code)

def getlabeltext(label):
''' if user has choosen another label use it else return the
default.'''
   if label in request.session:
return request.session[label]
   else:
   return label


Is there a better approach I should look at?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



many to many and different requests - Strange behavior?

2010-07-08 Thread zweb
I am seeing unexpected strange behaviour.

I have two tables:  student and study_class which have many to many
relationship.

1. when user A (student a) logs in, in run time he does,

student_a.study_classs = [class_physics]   #in DB, this student does
not have class_physics

#does not Save.


2. User B logs into separate browser.

 Student.objects.get(Study_class__exact = class_physics)

It returns "student_a" as one of the students even though student_a
above never saved.

3. User A logs out without saving. User B again does
Student.objects.get(study_class__exact = class_physics). This time
student_a is not returned.

Why this happening? (I use wsgi with django 1.1.1 and python 2.5 on
apache.)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django auth/many to many issue?

2010-07-09 Thread zweb
if i do,

request.user.groups = [group1]

Sometimes it saves this in DB auth_user_group , sometimes it does not.
I do not have any save() stmt.

What is the expected behavior?

I do not want it to save it in DB without explicit save, How do I
achieve that?

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



Django auth/many to many issue?

2010-07-09 Thread zweb
if i do,

request.user.groups = [group1]

Sometimes it saves this in DB auth_user_group , sometimes it does not.
I do not have any save() stmt.

What is the expected behavior?

I do not want it to save it in DB without explicit save, How do I
achieve that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 modify many to many data without auto saving to DB?

2010-07-09 Thread zweb
Assume there is many to many between publication and article. (example
from django docs)

By default following stmt will auto save the relationship between
a_publication and article11 in database.

a_publication.articles = [article11]

how do I get that so that it changes only in memory (for session) but
does not get saved in DB unless explicitly told to save?

[I cannot change the table structure  to remove many to many]

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to dynamically update model fields?

2010-07-09 Thread zweb
I want to provide a method as follows,

def update_some_model_field(key, field_name, value):
  '''user provides the primary key of row, field name in model and the
value and the method updates the field for that row with the value'''

1.  model_obj = Some_model.objects.get(pk = key)
2.  model_obj."field_name" = value  ## HOW to make this line generic??
I do not want to do lots of If as shown below.
3. model_obj.save()


For line 2 another way to write it is  as follows, which I want to
avoid:

if field_name == "field_a":
model_obj.field_a = value
elif field_name == "field_b":
   model_obj.field_b = value
and so on... for 20 fields of 20 models

Any suggestions?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django causing unnessary 301 permanent redirect

2009-12-24 Thread zweb
in fire bug I see my program issue
http://localhost:8000/readme?startIndex=0&results=25   301 MOVED
PERMANENTLY


http://localhost:8000/readme/?startIndex=0&results=25 200 OK


Any way to avoid this 301 MOVED PERMANENTLY ?

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




auth_group: dropping unique on name

2010-01-19 Thread zweb

I am planning to drop unique key constraint on "name" column of
auth_group table.

Any possible issues it may cause?


thanks
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: auth_group: dropping unique on name

2010-01-19 Thread zweb
Since all my looks up are by id and I am not using admin, I should be
ok.
I was not sure if django auth framework used it internally anywhere.



On Jan 19, 6:03 am, Karen Tracey  wrote:
> On Tue, Jan 19, 2010 at 3:17 AM, zweb  wrote:
>
> > I am planning to drop unique key constraint on "name" column of
> > auth_group table.
>
> > Any possible issues it may cause?
>
> Yes.  With the unique constraint in place, .get() by name is guaranteed to
> either find a single group or none with a matching name.  Removing the
> unique constraint removes that guarantee, opening up the possibility that
> .get() by name will raise MultipleObjectsReturned.
>
> Karen
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




packager, installer and upgrade?

2010-01-26 Thread zweb
I have one django app using Mysql which I want to package and install
easily on various servers.
I want it be to be easy non tech user kind of installer.

1) Would you know of any open source or commercial software I can use
for this purpose?

2) What is the best way to push upgrades to the servers without doing
the full install? (automated solution)

3)  How can I do python source code obfuscation?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Python app Installers

2010-01-27 Thread zweb
What is the best way to build installer for python/django based
software product ?
Like in Microsoft world you can have .exe and installshield?

I need to way which can guide user to setup database, run DB script,
set up parameters and guide him through installation. Also want to
give the option to do full install or apply only a patch/upgrade.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



read only django admin

2010-01-28 Thread zweb
Is it possible to have a read only django admin, ie user cannot add,
delete or update. User can only view data.

or may be one user can be view only and other user has add/delete /
update as well in Django admin.

How to do that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



admin error

2010-01-30 Thread zweb
Upgraded to 1.1.1
added admin for first time per instructions in settings.py and urls.py
after upgrading to 1.1.1. No admin.py at this point.
created new super user
logged in to admin console for first time. and got the following
error:




In template /Library/Python/2.5/site-packages/django/contrib/admin/
templates/admin/base.html, error at line 30
Caught an exception while rendering: dict objects are unhashable
20  
21  
22  
23  {% block branding %}{% endblock %}
24  
25  {% if user.is_authenticated and user.is_staff %}
26  
27  {% trans 'Welcome,' %}
28  {% firstof user.first_name user.username %}.
29  {% block userlinks %}
30  {% url django-admindocs-docroot as docsroot %}
31  {% if docsroot %}
32  {% trans 'Documentation' %} /
33  {% endif %}
34  {% url admin:password_change as password_change_url %}
35  {% if password_change_url %}
36  
37  {% else %}
38  
39  {% endif %}
40  {% trans 'Change password' %} /

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



TemplateSyntaxError at /admin/ - 'module' object has no attribute 'rindex'

2010-01-31 Thread zweb
after login to admin,  now I get this error, any clues on what to look
for?

using django 1.1.1

Ashish

TemplateSyntaxError at /admin/

Caught an exception while rendering: 'module' object has no attribute
'rindex'

Original Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/Library/Python/2.5/site-packages/django/template/
defaulttags.py", line 370, in render
url = reverse(self.view_name, args=args, kwargs=kwargs,
current_app=context.current_app)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 350, in reverse
*args, **kwargs)))
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 275, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 195, in _get_reverse_dict
self._populate()
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 187, in _populate
lookups.appendlist(pattern.callback, (bits, p_pattern))
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 136, in _get_callback
mod_name, func_name = get_mod_func(self._callback_str)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 80, in get_mod_func
dot = callback.rindex('.')
AttributeError: 'module' object has no attribute 'rindex'

Request Method: GET
Request URL:http://localhost:8000/admin/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: 'module' object has no attribute
'rindex'

Original Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/Library/Python/2.5/site-packages/django/template/
defaulttags.py", line 370, in render
url = reverse(self.view_name, args=args, kwargs=kwargs,
current_app=context.current_app)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 350, in reverse
*args, **kwargs)))
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 275, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 195, in _get_reverse_dict
self._populate()
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 187, in _populate
lookups.appendlist(pattern.callback, (bits, p_pattern))
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 136, in _get_callback
mod_name, func_name = get_mod_func(self._callback_str)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 80, in get_mod_func
dot = callback.rindex('.')
AttributeError: 'module' object has no attribute 'rindex'

Exception Location: /Library/Python/2.5/site-packages/django/template/
debug.py in render_node, line 81
Python Executable:  /System/Library/Frameworks/Python.framework/
Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.5.1
Python Path:['/Users/ashishgupta/dev/pmc', '/Library/Python/2.5/site-
packages/setuptools-0.6c8-py2.5.egg', '/Library/Python/2.5/site-
packages/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg', '/Library/
Python/2.5/site-packages/pytz-2009g-py2.5.egg', '/Library/Python/2.5/
site-packages/pycountry-0.10-py2.5.egg', '/Library/Python/2.5/site-
packages/PIL-1.1.6-py2.5-macosx-10.5-i386.egg', '/System/Library/
Frameworks/Python.framework/Versions/2.5/lib/python25.zip', '/System/
Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', '/
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/
2.5/lib/python2.5/plat-mac', '/System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-
scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/
2.5/Extras/lib/python', '/System/Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/lib-tk', '/System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Library/
Python/2.5/site-packages', '/System/Library/Frameworks/
Python.framework/Versions/2.5/Extras/lib/python/PyObjC']
Server time:Sun, 31 Jan 2010 17:27:52 +
Template error

In template /Library/Python/2.5/site-packages/django/contrib/admin/
templates/admin/base.html, error at line 30
Caught an exception while rendering: 'module' object has no attribute
'rindex'
20  
21  
22  
23  {% block branding %}{% endblock %}
24  
25  {% if user.is_authenticated and user.is_staff %}
26  
27  {% trans 'Welcome,' %}
28  {% firstof user.first_name user.username %}.
29  {% block userlinks %}
30  {% url django-admindocs-docroot as docsroot %}
31  {% if docsroot %}

Re: TemplateSyntaxError at /admin/ - 'module' object has no attribute 'rindex'

2010-01-31 Thread zweb
In my urls.py I see only two possible places where I do not have
quotes,

1.(r'^admin/', include(admin.site.urls)),

I tried putting include('admin.site.urls')) but it could not find
'admin.site.urls'

2.   (r'^register/$', register,{'opensource':True}),

True is not in quotes. But it is working fine on the site without
admin.

Any clues what {% url django-admindocs-docroot as docsroot %}  is
looking for to throw that error?


On Jan 31, 10:07 am, "Martin J. Laubach" 
wrote:
> > Caught an exception while rendering: 'module' object has no attribute
> > 'rindex'
>
>   Sounds you are using foo.bar instead of 'foo.bar' somewhere (ie.
> module instead of string).
>
>         mjl

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Regression

2010-02-20 Thread zweb
What are best practices to regress django views?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ORM: get, filter and DoesNotExist

2010-04-04 Thread zweb
after some debugging, just found out that
filter method does not throw DoesNotExist while get does.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: code repetition in views

2010-04-12 Thread zweb
To Summarize, two options are,

1) Template method pattern which Thierry suggested
http://en.wikipedia.org/wiki/Template_method_pattern

2) Django Decorators


On Apr 10, 11:38 pm, Thierry Chich  wrote:
> I have written my functions as méthods of classes. Then it allow to  
> use inheritance.
>
> Le 11 avr. 2010 à 05:58, ydjango  a écrit :
>
> > I find all my view method have identical code in start and in end:
>
> > anyway to avoid repetition...?
>
> > Example:
>
> > def typical_view_method(request):
>
> >   Check if user is authenticated.
> >   Get user and group
> >   Get some session variables
>
> >   try:
> >         Method specific logic
> >   except Exception, e:
> >         view_logger.error('error in typical_view_method:%s', e)
>
> >    response = HttpResponse(json_data, mimetype = 'application/json')
> >    response.__setitem__('Cache-Control', 'no-store,no-cache')
> >    response.__setitem__('Pragma', 'no-cache')
> >    response.__setitem__('Expires', '-1')
> >    return response
>
> > --
> > 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
> > .
> > For more options, visit this group 
> > athttp://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-us...@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.



ORM Query question

2010-04-12 Thread zweb
how do i do this kind of condition in django orm filter:

( 1 < a < 5)  or ( 20 < b < 70)

select * from table where (a between 1 and 5) or (b between 20 and 70)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Profiling tools?

2012-10-21 Thread zweb

I am using Django 1.3.1

I want to know in my application how much time is taken by a) database 
access b) creation of XML c) other parts of code. What would be some good 
tools to profile my application?

The code to be profiled is in django view and uses Django ORM and Python 
2.6 and lxml to generate XML. It is called from AJAX request and returns 
XML.

Please recommend both open source and commercial tools.

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



Django for non web clients

2013-06-29 Thread zweb

I am writing an Python application which will expose REST API. It will be 
client agnostic. In future I will provide a Web client and a mobile client 
and may be a rich desktop client. These clients will connect to application 
using the REST api only. 

Should I use Django for this? or is Django for Web based applications only 
as it is web framework. What advantage does Django brings in such a 
architecture.

Would it be much simpler if I use simple python with some python rest  web 
services framework on top of it instead of Django?

I am a big fan of Django but not sure if a Web framework such as django is 
good fit for REST Services based architecture. I not building a 
(monolithic) web application.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django for non web clients

2013-06-30 Thread zweb
Thanks Rahul,

I thought about that. 

I do not need Django's ORM as I do not use relational db and I do not need 
Django's Templates as I use rest api. So I am not sure what value does 
django add in my case?



On Sunday, June 30, 2013 12:24:28 AM UTC-7, Rahul Gaur wrote:
>
> Hi, 
> What about change-tastypie or django-restframework or something similar ?
> As a part of my GSoC project [1] , I am implementing a project sharing web 
> site with social features.
> I need RESTful APIs so that the functionality of the site could be 
> integrated into SugarLabs [2]. 
>
> I am planing to use Django with one of the above rest frameworks to serve 
> RESTful APIs  and a web client in backbone.js which will consume the APIs 
> as well.
>
> [1] - https://github.com/aregee/moksaya
> [2] - http://sugarlabs.org 
> On Jun 30, 2013 12:13 PM, "zweb" > wrote:
>
>>
>> I am writing an Python application which will expose REST API. It will be 
>> client agnostic. In future I will provide a Web client and a mobile client 
>> and may be a rich desktop client. These clients will connect to application 
>> using the REST api only. 
>>
>> Should I use Django for this? or is Django for Web based applications 
>> only as it is web framework. What advantage does Django brings in such a 
>> architecture.
>>
>> Would it be much simpler if I use simple python with some python rest  
>> web services framework on top of it instead of Django?
>>
>> I am a big fan of Django but not sure if a Web framework such as django 
>> is good fit for REST Services based architecture. I not building a 
>> (monolithic) web application.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How to profile Django App?

2013-07-31 Thread zweb

I have a web page that is loading very slow.

It uses a Javascript tree grid component - data loaded via XML - XML 
generated by LXML - Django view - Django ORM - MYSQL DB.

I need to find out where is the performance bottleneck. It could be one or 
more of the above components.

What are the best tools - Free or Commercial which can help me profile this 
whole path? 




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Are Web frameworks useful in mobile first world?

2013-08-05 Thread zweb

Are web frameworks useful in mobile first world of today?

With apps required to support multiple front ends including Mobile and Web, 
is using a web framework like ROR or Django more of a liability.

Would not a light weight rest framework be better?

( Note: I really like Django. It is an awesome web framework.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Locking?

2013-08-06 Thread zweb

 Can we use "with LOCK" in django views. I am using Apache, mod_wsgi, 
Django 1.3.1, mysql.

Any conflicts or Known issues.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Stripped Django?

2014-01-20 Thread zweb
I am planning to use django rest as rest API server. In one presentation I 
read, that stripped Django as REST server outperforms some other 
microframeworks.

What would be stripped django?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d3b2eba-def0-4246-afdf-3a7dfd9cb390%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Dyanmically changing Django Storage?

2014-01-27 Thread zweb

I am planning to use django-storages. It uses django settings, as

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'


I read it is bad practice to change django settings during runtime. I am 
not using Django's FileField.

During run time, based on file size and type,  I want to use a different 
storage backend. How to do it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bf2fa7b-d265-49d6-9694-edbb88b624e1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Angular and Django

2014-06-22 Thread zweb

I was looking at Angular and looks like it does many of the thing Django 
Templates does but on the client side. 

Are you using Angular with Django? How is the experience? What are the 
/pros/cons? What are using django for and what are you using angular for?
Is django pretty much a rest framework  with business logic and DB access? 
(when used with Angular)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54c6aeed-4bd5-4fe9-975f-21defd3481ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.