Re: Strange behaviour of django of form submit by POST

2015-04-07 Thread Luigi Cirillo
sorry, I posted the code of thefile 
venv/local/lib/python2.7/site-packages/django/template/response.py at line 
83 with the # but the real code that I execute is:
#
...
@property
def rendered_content(self):
"""Returns the freshly rendered content for the template and 
context 
 

described by the 
TemplateResponse.   
 


  

This *does not* set the final content of the response. To set 
the 

response content, you must either call render(), or set 
the 
  

content explicitly using the value of this 
property.   
   

"""
template = self.resolve_template(self.template_name)
context = self.resolve_context(self.context_data)
content = template.render(context)
import ipdb; 
ipdb.set_trace()


return content
...
###


-- 
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/bcd70fe0-caef-4ffa-aacf-b4d802f5d3ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload above apache web root?

2015-04-07 Thread Daniel Roseman
On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
>
> I've implemented this same solution (using custom file storage and the 
> "upload_to" parameter) but now cannot get the uploaded files to display 
> from my template. I would normally use {{ STATIC_URL }} but, since I've now 
> specified a custom location, I'm not sure why my path, which I've 
> hard-coded in the template, isn't working...any ideas?
>
> fs = FileSystemStorage(location='/data/www/upload')
> def image_location(instance, filename):
> return '/'.join(['thumbnails', str(instance.dataset_id), filename])
> class DataModel(models.Model):
> name = models.CharField()
> date = models.DateField(blank=True)  
> image = models.ImageField(storage=fs, upload_to=image_location, 
> blank=True)
>
> template.html
>
> 
> 
>
>
But /data/www/upload/... is the file path of your upload, not the URL. You 
still need an actual URL that is served by your webserver. Obviously, a 
browser can't access arbitrary file paths on your server.
--
DR. 

-- 
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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flexible For loop

2015-04-07 Thread Nkansah Rexford
Thanks for pointing out. That's the solution then!

-- 
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/e3f8d088-d08a-4e8e-abfb-ccf0e9314a89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: KeyError: 'default'

2015-04-07 Thread Flavia Missi
Hi,

>From Django 1.6 to Django 1.7 *migration *handling was added to Django, so
I suppose you cannot run your project with 1.7 without performing the
required changes. If you're using south, take a look here:
https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south

Also, I see you're using sqlite3 for development, although this is very
fast, it may have considerable differences from using Postgres. So I think
it's a good idea to run your tests on postgres (at least on the CI).

Hope it helps.

Regards,
-
Flavia
@flaviamissi

On Mon, Apr 6, 2015 at 11:06 PM Mike Dewhirst  wrote:

> On 7/04/2015 1:07 AM, Pavel Kuchin wrote:
> > Hi Mike,
> >
> > I think the issue is that Django can't find your default DB settings.
> > Please take a
> > look: https://docs.djangoproject.com/en/1.8/ref/settings/#databases
>
> Pavel
>
> Thanks for responding. I have had that setting running since they were
> first called for in release notes for 1.6 (I think) anyway, for quite a
> long time. My test routine uses (settings.test) SQLite in memory as
> follows ...
>
> DATABASES = {
>  "default": {
>  "ENGINE": "django.db.backends.sqlite3",
>  "NAME": ":memory:",
>  "USER": "",
>  "PASSWORD": "",
>  "HOST": "",
>  "PORT": "",
>  },
>  }
>
> In production (settings.base) it is ...
>
> dbhost = getcreds('db.host', PROJECT)
> DATABASES = {
>  'default': {
>  'ENGINE':   'django.db.backends.postgresql_psycopg2',
>  'NAME': PROJECT,
>  'USER': dbhost[0],
>  'PASSWORD': dbhost[1],
>  'HOST': dbhost[2],
>  'PORT': dbhost[3],
>  }
> }
>
> Trying to run the tests in Postgres delivers the same error but with an
> additional final line ...
>
>  return self.cursor.execute(sql, params)
> django.core.serializers.base.DeserializationError: Problem installing
> fixture
> 'C:\Users\mike\env\xxex3\ssds\substance\fixtures\initial_data.json':
> relation "django_content_type" does not exist
> LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
>   ^
>
> In case that doesn't line up properly in the email, the caret is
> positioned like this ...
>
> FROM "django_co...
>   ^
>
> The dev server runs and the software (unmigrated) works. I just cannot
> get my unit tests to run under 1.7. It is like the nightmare of finding
> yourself naked in Times Square!
>
> Mike
>
> >
> > Best regards, Pavel
> >
> > понедельник, 6 Ð°Ð¿Ñ€ÐµÐ»Ñ  2015 г., 15:44:01 UTC+3
> > пользователь Mike Dewhirst Ð½Ð°Ð¿Ð¸Ñ Ð°Ð»:
> >
> > Can someone please explain what KeyError: 'default' means?
> >
> > This is the first time I have tried Django 1.7 and without doing any
> > migrations all I have done here is this ...
> >
> > (xxex3) C:\Users\mike\env\xxex3\ssds>copy
> > substance\fixtures\test_data.json substance\fixtures\initial_
> data.json
> >
> > (xxex3) C:\Users\mike\env\xxex3\ssds>python manage.py test
> > --settings=ssds.settings.test --verbosity=1 common refer substance
> > company workplace credit
> >
> > Python:   3.4
> > Django:   1.7.7
> > 17:40:04
> > SQLite3:  memory
> >
> > Creating test database for alias 'default'...
> > Traceback (most recent call last):
> > File
> > "C:\Users\mike\env\xxex3\lib\site-packages\django\contrib\
> contenttypes\models.py",
> >
> > line 19, in get_by_natural_key
> >   ct = self.__class__._cache[self.db][(app_label, model)]
> > KeyError: 'default'
> >
> > During handling of the above exception, another exception occurred:
> >
> > Traceback (most recent call last):
> > File
> > "C:\Users\mike\env\xxex3\lib\site-packages\django\db\
> backends\utils.py",
> >
> > line 65, in execute
> >   return self.cursor.execute(sql, params)
> > File
> > "C:\Users\mike\env\xxex3\lib\site-packages\django\db\
> backends\sqlite3\base.py",
> >
> > line 485, in execute
> >   return Database.Cursor.execute(self, query, params)
> > sqlite3.OperationalError: no such table: django_content_type
> >
> > (there is more but the bottom line is ...)
> >
> >   return Database.Cursor.execute(self, query, params)
> > django.core.serializers.base.DeserializationError: Problem
> installing
> > fixture 'C:\Users\
> > mike\env\xxex3\ssds\substance\fixtures\initial_data.json': no such
> > table: django_content_type
> >
> > (xxex3) C:\Users\mike\env\xxex3\ssds>
> >
> >   From my settings ...
> >
> > SESSION_SERIALIZER =
> > 'django.contrib.sessions.serializers.JSONSerializer'
> >
> > #CACHES = {
> > #'default': {
> > #'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
> > #}
> > #}
> >
> > The same error occurs whether CACHES is commented out or not.
> >
> > Not sure where to look i

Re: Upload above apache web root?

2015-04-07 Thread Stephanie Socias
Thank you very much for responding, Daniel.

I'm sorry I don't quite follow- I've never done this before. I should use
the URL {{ datamine.image.url }} in the template?

On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman 
wrote:

> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
>>
>> I've implemented this same solution (using custom file storage and the
>> "upload_to" parameter) but now cannot get the uploaded files to display
>> from my template. I would normally use {{ STATIC_URL }} but, since I've now
>> specified a custom location, I'm not sure why my path, which I've
>> hard-coded in the template, isn't working...any ideas?
>>
>> fs = FileSystemStorage(location='/data/www/upload')
>> def image_location(instance, filename):
>> return '/'.join(['thumbnails', str(instance.dataset_id), filename])
>> class DataModel(models.Model):
>> name = models.CharField()
>> date = models.DateField(blank=True)
>> image = models.ImageField(storage=fs, upload_to=image_location, 
>> blank=True)
>>
>> template.html
>>
>> 
>> 
>>
>>
> But /data/www/upload/... is the file path of your upload, not the URL. You
> still need an actual URL that is served by your webserver. Obviously, a
> browser can't access arbitrary file paths on your server.
> --
> DR.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAOw%3DD6XU%2BQmk8ZoqJXoFuAtFzKvZG487_eUZ%3DkkyphQDdVgN3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.8, django-formtools and 3rd party app setup.py

2015-04-07 Thread Troy Grosfield
The full discussion on this topic can be found at:

   - https://github.com/Bouke/django-two-factor-auth/pull/90
   
In summary, with the release of django 1.8 all the formtools logic was 
moved to a separate repo.  The question is, how does a 3rd party app that 
requires formtools setup the install_requires portion of the setup.py file 
to work for both django < 1.8 and django >= 1.8 when the django-formtools 
app requires django version >= 1.7 
 
which will cause conflicts with users using django < 1.7 on install? 

-- 
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/5488b6f6-e05e-4f71-94b2-b5763e75b94e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom field definition for an iterable Python object

2015-04-07 Thread David Pick

I'm trying to write a custom field definition for a Python object that 
happens to be iterable. Most of the time it works, but sometimes I get an 
error generated in 'django/db/models/sql/where.py' in '_prepare_data' where 
the code tries to generate all the values in the iterable object because 
it's assuming that because the object is iterable it is a actually a list 
of objects that are part of a constraint.

I'm wondering if anyone with more intimate knowledge of Django can tell me 
if this is a localised assumption or if it's more general and could be 
amenable to patching.

Incidentally, the object is to make it possible to have an IPNetwork object 
from the 'netaddr' package usable as a database object. The results of an 
iteration of this type is a list of the individual IP addresses defined by 
the network object.

-- 
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/6d2caec7-6206-4660-811a-6bf51c4684f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple Django Forms

2015-04-07 Thread Stephanie Socias

Thank you all for you suggestions/help. I was finally able to get this 
working by using django-dynamic-formset 

Bill Blanchard helped me figure it out! I will post a more detailed 
solution in my other post here on this forum ("Help with Dynamically Adding 
Forms to a Formset!!")


On Saturday, April 4, 2015 at 1:28:40 PM UTC-4, luisza14 wrote:
>
> mmm Maybe you should use form wizard if you have too many forms 
> https://docs.djangoproject.com/en/1.7/ref/contrib/formtools/form-wizard/
>
>
>
>
> 2015-03-31 5:11 GMT-06:00 Bill Blanchard  >:
>
>> Hi Stephanie, 
>> Ping me offline, I might be able to help you out. 
>> On Mar 30, 2015 1:43 PM, "Stephanie Socias" > > wrote:
>>
>>> Thank you for your suggestions!
>>>
>>> Unfortunately, as I am very green at the moment, I nee more help to 
>>> implement all of these new techniques. Given that what I'm trying to 
>>> accomplish requires more extensive Django and javascript knowledge, is 
>>> there anyone who would be willing to do a video screen share with me to 
>>> help me out?? I can pay you!
>>>
>>> Thank you,
>>> Stephanie
>>>
>>> On Monday, March 30, 2015 at 7:47:48 AM UTC-4, François GUÉRIN wrote:

 1/ use generic views : ProcessFormView by example
 2/ use prefixes in your forms with there name (it's a param in form 
 cctor)
 3/ in your template, use the {%for form in forms %}{% form.as_p 
 %}{%endfor %} if you put your forms into a 
 list form forms

 Good coding !
  

>>>  -- 
>>> 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.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9d1c60b2-a194-40ef-8ef1-5065c1c8184e%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAP7uED%2BDyjCwTP%3DWnEK-M2SCy48CXdvvOZjLbG5BaGWj%3D36yzA%40mail.gmail.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
> 

-- 
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/743b580e-bd33-4751-9ce8-ddf7b3587ea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I work with pyserial and django form?

2015-04-07 Thread Bill Freeman
It sounds as though you have a set of sensors (scales, license readers,
barcode readers) which provide their readings over asynchronous serial
(that's what pyserial can connect with).  You have some computer or set of
computers that collectively provide a sufficient number of serial ports to
interface to your set of sensors.

And I believe you are wondering how to use a browser (Firefox, Chrome,
Safari, IE) to read from the serial ports and post the data to Django.  You
might be able to write a Firefox extension that does this, but it would be
a lot of work, and sensitive to updates to the browser.

If I had the task of reading the sensors and sending the data to Django, I
would write a small python program using pyserial and requests (or if you
are a glutton for punishment, use urllib2 directly) to POST to your Django
instance, using rest or an ad hoc protocol.  You can POST to a form page,
but the fact that forms are designed to appear to humans will just make
things a bit harder.

If you need a GUI to control the program you could add one with wxPython
(or other alternatives) or you could run a simple web server (python comes
with on) in a separate thread.

If the serial ports are run on the same box as Django or on a box that can
access the same database as Django is using, you could do the process as a
custom Django management command that uses pyserial to talk to the ports
and stores the results in the database directly.  GUI based control could
be via an extra table in the database controlled by an extra Django page.

There are other possibilities.  But trying to get a browser involved sounds
like a recipe for frustration.

Or maybe I misunderstand your needs?

On Mon, Apr 6, 2015 at 8:36 PM, Vijay Khemlani  wrote:

> I'm still not sure whether you are trying to load the value in the form
> input from the server or from the browser of the client.
>
> On Mon, Apr 6, 2015 at 5:42 PM, José Jesús Palacios 
> wrote:
>
>> I'm trying read serial to put in a field on a form and submit to database
>> . Data can be a weight of weighbridge, number of  car plate or reading a
>> barcode.
>> Outside the browser, It's not problem, but I want to use it as user
>> interface.
>>
>> El domingo, 5 de abril de 2015, 19:55:02 (UTC+2), Vijay Khemlani escribió:
>>>
>>> What are you trying to do exactly?
>>>
>>> On Sun, Apr 5, 2015 at 10:27 AM, José Jesús Palacios 
>>> wrote:
>>>
 How can I work with pyserial and django form to read from serial to
  field?
 Is it possible?

 Thanks to everyone.

 --
 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.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/aa063945-c98d-488f-ba0f-16d66809395e%
 40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  --
>> 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/8bc3e63e-599c-4fa0-a276-70cbbb24706b%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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/CALn3ei22C7ipPoVnEtQMb1a%3DS9qnzJWppvUpnpiBCe8jShoZCg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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, sen

Re: Help with Dynamically Adding Forms to Formset!!

2015-04-07 Thread Stephanie Socias
Thank you SO much to Bill Blanchard for helping me figure this out!

The main issue was that {{ formset.management_form }} was in the div being 
used by the javascrip to add/delete forms. So, it was causing the error. We 
moved it out of the div, just before the closing  tag and it worked 
great!

On Tuesday, March 31, 2015 at 12:11:42 AM UTC-4, Stephanie Socias wrote:
>
> Hello Again,
>
> I don't mean to take advantage of your kindness and generosity in helping 
> me- I'm so appreciativeI'm just still stuck on the ValidationError 
>
> [u'ManagementForm data is missing or has been tampered with']
>
> Error during template rendering
>
> In template 
> /Users/stephani/git/data/data/databank_fr/templates/data/register_dataset.html,
>  
> error at line *6*
> ManagementForm data is missing or has been tampered with1{% load 
> crispy_forms_tags %} 2 3 4 $(function() { 5 
> $('.authorFormset').formset({ 6 prefix: '{{ formset.prefix }}', 7 
> addText: 'Add Author', 8 deleteText: 'Remove Author', 9 }) 10 }) 11 
> 12 13 enctype="multipart/form-data"> 14 15 16  
> Traceback Switch to copy-and-paste view 
>
>- 
>
> /Users/stephaniesocias/.virtualenvs/databank2/lib/python2.7/site-packages/django/core/handlers/base.py
> in get_response
>1. 
>   
>   response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
>   
>   ...
>▶ Local vars 
>- /Users/stephan/git/data/databank_fr/databa/apps/databank/views.py in 
>register
>1. 
>   
>   'formset': author_formset, 'author_formset_helper': 
> author_formset_helper, 'contact_form': contact_form, 'terms_form': 
> terms_form})
>   
>   ...
>▶ Local vars 
>- 
>
> /Users/stephan/.virtualenvs/data/lib/python2.7/site-packages/django/shortcuts.py
> in render
>1. 
>   
>   return HttpResponse(loader.render_to_string(*args, **kwargs),
>   
>   ...
>▶ Local vars 
>- 
>
> /Users/stephan/.virtualenvs/data/lib/python2.7/site-packages/django/template/loader.py
> in render_to_string
>1. 
>   
>   return t.render(context_instance)
>   
>   ...
>▶ Local vars 
>
>
>
>
>
> I read that it might be an issue with having a form and a formset next to 
> each other? If I don't use the "add" or "remove" links, I can submit my page 
> (which contains other forms in addition to my formset) with just one form of 
> the formset. But, when I do 'add' or 'delete' to add another form to the 
> formset, I get the error. The post data, though, does seem to register the 
> additional form... 
>
> views.py
>
> def register(request):
>
> dataset_form = DatasetForm()
> facility_form = FacilityForm()
> contact_form = FacilityContactForm()
> terms_form = TermsForm()
>
> author_formset = AuthorFormset(prefix='author')
> author_formset_helper = AuthorFormsetHelper()
>
> if request.method == 'POST':
> dataset_form = DatasetForm(request.POST, request.FILES)
> facility_form = FacilityForm(request.POST)
> author_formset = AuthorFormset(data=request.POST, prefix='author')
>
>
> contact_form = FacilityContactForm(request.POST)
>
> return render(request, 'databank/register.html', {'dataset_form': 
> dataset_form, 'facility_form': facility_form, 
> 'formset': author_formset, 'author_formset_helper': 
> author_formset_helper, 'contact_form': contact_form, 'terms_form': 
> terms_form})
>
>
>
>
>
> On Mon, Mar 30, 2015 at 10:57 PM, Lachlan Musicman  
> wrote:
>
> likewise. likewise.
> --
>  It is through this shadowy emptiness (of negative space) that we
> walk, talk, see, and live; negative space is the impossible cellophane
> layer that drapes the known world and is invisible to all but to the
> most perceptive minds.
>
> It is possible to learn to see negative space though, in both the
> visual and imagined worlds. The first step is developing the ability
> to see, and the second is learning — as romantic poet John Keats put
> it — to be “capable of being in uncertainties, mysteries, doubts,
> without any irritable reaching after fact & reason.”
> 
> Seeking Genius in Negative Space, Chris Messina
>
> https://medium.com/genius-week/seeking-genius-in-negative-space-4e7c755f641f
>
>
> On 31 March 2015 at 13:50, Bill Blanchard  
> wrote:
> > I fought with formsets for a week when I started. Glad I could pay it
> > forward a bit.
> >
> > On Mar 30, 2015 10:46 PM, "Stephanie Socias"  
> wrote:
> >>
> >> Ah finally!
> >> I had jquery.formset.js in my base.html header. I moved it to my {%
> >> block footer_js %}  and it worked!! Not sure why that's the 
> caseanyways,
> >> now on to the next issue ([u'ManagementForm data is missing or has been
> >> tampered with']) but I think I 

Re: Upload above apache web root?

2015-04-07 Thread Stephanie Socias
Do I need to update/add something to my urls.py?

On Tuesday, April 7, 2015 at 9:51:56 AM UTC-4, Stephanie Socias wrote:
>
> Thank you very much for responding, Daniel.
>
> I'm sorry I don't quite follow- I've never done this before. I should use 
> the URL {{ datamine.image.url }} in the template? 
>
> On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman  
> wrote:
>
>> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
>>>
>>> I've implemented this same solution (using custom file storage and the 
>>> "upload_to" parameter) but now cannot get the uploaded files to display 
>>> from my template. I would normally use {{ STATIC_URL }} but, since I've now 
>>> specified a custom location, I'm not sure why my path, which I've 
>>> hard-coded in the template, isn't working...any ideas?
>>>
>>> fs = FileSystemStorage(location='/data/www/upload')
>>> def image_location(instance, filename):
>>> return '/'.join(['thumbnails', str(instance.dataset_id), filename])
>>> class DataModel(models.Model):
>>> name = models.CharField()
>>> date = models.DateField(blank=True)  
>>> image = models.ImageField(storage=fs, upload_to=image_location, 
>>> blank=True)
>>>
>>> template.html
>>>
>>> 
>>> 
>>>
>>>
>> But /data/www/upload/... is the file path of your upload, not the URL. 
>> You still need an actual URL that is served by your webserver. Obviously, a 
>> browser can't access arbitrary file paths on your server.
>> --
>> DR. 
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/b015d26d-c95a-4435-bd93-107244d5a798%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Docs not found

2015-04-07 Thread Eugene Yeo
Django Docs seems down except its latest development.

https://docs.djangoproject.com/en/1.8/ (Not working)
https://docs.djangoproject.com/en/dev/ (Working)

It would be good to let the django docs team to restore the docs for all 
version.

-- 
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/e9ab4fe6-8c9e-46bb-98ad-cf4c4daa8c3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Docs not found

2015-04-07 Thread Larry Martell
On Tue, Apr 7, 2015 at 11:44 AM, Eugene Yeo  wrote:
> Django Docs seems down except its latest development.
>
> https://docs.djangoproject.com/en/1.8/ (Not working)

Works for me.

-- 
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/CACwCsY5_ut0A%2BOfjsgjhSnYCsTQQg%2BNcipP0sk7uzjFdCwaNfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Problem with url template tag and namespaces

2015-04-07 Thread donarb
I'm having a problem with a generated url using the url template tag, 
currently using Django 1.6.5.

The appname is 'dashboard', here is the main urls.py:

urlpatterns = patterns("",
(r'^dashboard/', include('dashboard.urls', namespace='dashboard')),
)



Here is the dashboard urls.py:

# dashboard/urls.py
urlpatterns = patterns("",
(r'^players/', include('players.urls', namespace='players')),
)


Here is the players urls.py:

# dashboard/players/urls.py
urlpatterns = patterns("",
url(r'^search/?', views.PlayerSearchView.as_view(), name='search'),
)



When I code this in the template:

{% url "dashboard:players:search" %}



I get this url:

/dashboard/playerssearch


Any idea why there is no path separator between 'players' and 'search'?

-- 
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/5e041c5f-8b68-43f2-9a32-0266e5d50588%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload above apache web root?

2015-04-07 Thread Luis Zárate
Hi,

Django provide for development MEDIA_URL and MEDIA_ROOT for uploaded file,
for production used static deploy strategy, see the documentation about
static files.

Model file field has an url attribute that return a media url, you use in
template like {{obj.file.url}}


El martes, 7 de abril de 2015, Stephanie Socias 
escribió:
> Do I need to update/add something to my urls.py?
>
> On Tuesday, April 7, 2015 at 9:51:56 AM UTC-4, Stephanie Socias wrote:
>>
>> Thank you very much for responding, Daniel.
>>
>> I'm sorry I don't quite follow- I've never done this before. I should
use the URL {{ datamine.image.url }} in the template?
>>
>> On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman 
wrote:
>>>
>>> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:

 I've implemented this same solution (using custom file storage and the
"upload_to" parameter) but now cannot get the uploaded files to display
from my template. I would normally use {{ STATIC_URL }} but, since I've now
specified a custom location, I'm not sure why my path, which I've
hard-coded in the template, isn't working...any ideas?

 fs = FileSystemStorage(location='/data/www/upload')

 def image_location(instance, filename):
 return '/'.join(['thumbnails', str(instance.dataset_id), filename])

 class DataModel(models.Model):
 name = models.CharField()
 date = models.DateField(blank=True)
 image = models.ImageField(storage=fs, upload_to=image_location,
blank=True)

 template.html

 
 
 
>>>
>>> But /data/www/upload/... is the file path of your upload, not the URL.
You still need an actual URL that is served by your webserver. Obviously, a
browser can't access arbitrary file paths on your server.
>>> --
>>> DR.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
.
>>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/b015d26d-c95a-4435-bd93-107244d5a798%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyNHO5H1m_dtE3WVrPE4FgSZ%3D%3Dckj-YFZWdoEWVxU4AKgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload above apache web root?

2015-04-07 Thread Stephanie Socias
Hi Luis,

Yes, I used {{ datamine.image.url }} in my template but it doesn't work.
I'm not sure how to format my urls.py since I haven't changed the MEDIA_URL
and MEDIA_ROOT. I want to upload these images to a location not in my
MEDIA_ROOT...?

This is my urls.py:
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'tt.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),
url(r'^', include('myproj.urls', namespace='myproj')),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

On Tue, Apr 7, 2015 at 12:30 PM, Luis Zárate  wrote:

> Hi,
>
> Django provide for development MEDIA_URL and MEDIA_ROOT for uploaded file,
> for production used static deploy strategy, see the documentation about
> static files.
>
> Model file field has an url attribute that return a media url, you use in
> template like {{obj.file.url}}
>
>
> El martes, 7 de abril de 2015, Stephanie Socias 
> escribió:
> > Do I need to update/add something to my urls.py?
> >
> > On Tuesday, April 7, 2015 at 9:51:56 AM UTC-4, Stephanie Socias wrote:
> >>
> >> Thank you very much for responding, Daniel.
> >>
> >> I'm sorry I don't quite follow- I've never done this before. I should
> use the URL {{ datamine.image.url }} in the template?
> >>
> >> On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman 
> wrote:
> >>>
> >>> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
> 
>  I've implemented this same solution (using custom file storage and
> the "upload_to" parameter) but now cannot get the uploaded files to display
> from my template. I would normally use {{ STATIC_URL }} but, since I've now
> specified a custom location, I'm not sure why my path, which I've
> hard-coded in the template, isn't working...any ideas?
> 
>  fs = FileSystemStorage(location='/data/www/upload')
> 
>  def image_location(instance, filename):
>  return '/'.join(['thumbnails', str(instance.dataset_id), filename])
> 
>  class DataModel(models.Model):
>  name = models.CharField()
>  date = models.DateField(blank=True)
>  image = models.ImageField(storage=fs, upload_to=image_location,
> blank=True)
> 
>  template.html
> 
>  
>  
>  
> >>>
> >>> But /data/www/upload/... is the file path of your upload, not the URL.
> You still need an actual URL that is served by your webserver. Obviously, a
> browser can't access arbitrary file paths on your server.
> >>> --
> >>> DR.
> >>>
> >>> --
> >>> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> >>> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
> >>> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>
> > --
> > 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/b015d26d-c95a-4435-bd93-107244d5a798%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAG%2B5VyNHO5H1m_dtE3WVrPE4FgSZ%3D%3Dckj-YFZWdoEWVxU4AKgA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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

Re: Upload above apache web root?

2015-04-07 Thread Luis Zárate
You are not set base_url in FileSystemStorage so you are using MEDIA_URL by
default.

The imagefield url property is called like this

def _get_url(self):
self._require_file() # check if It is an object
return self.storage.url(self.name)
url = property(_get_url)

And self.storage.url throw exception if base_url is not set.


def url(self, name):
if self.base_url is None:
raise ValueError("This file is not accessible via a URL.")
return urljoin(self.base_url, filepath_to_uri(name))

So, I should try to call datamine.image.url() in shell and see what happen


2015-04-07 10:47 GMT-06:00 Stephanie Socias :

> Hi Luis,
>
> Yes, I used {{ datamine.image.url }} in my template but it doesn't work.
> I'm not sure how to format my urls.py since I haven't changed the MEDIA_URL
> and MEDIA_ROOT. I want to upload these images to a location not in my
> MEDIA_ROOT...?
>
> This is my urls.py:
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'tt.views.home', name='home'),
> # url(r'^blog/', include('blog.urls')),
>
> url(r'^admin/', include(admin.site.urls)),
> url(r'^', include('myproj.urls', namespace='myproj')),
> ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
> On Tue, Apr 7, 2015 at 12:30 PM, Luis Zárate  wrote:
>
>> Hi,
>>
>> Django provide for development MEDIA_URL and MEDIA_ROOT for uploaded
>> file, for production used static deploy strategy, see the documentation
>> about static files.
>>
>> Model file field has an url attribute that return a media url, you use in
>> template like {{obj.file.url}}
>>
>>
>> El martes, 7 de abril de 2015, Stephanie Socias 
>> escribió:
>> > Do I need to update/add something to my urls.py?
>> >
>> > On Tuesday, April 7, 2015 at 9:51:56 AM UTC-4, Stephanie Socias wrote:
>> >>
>> >> Thank you very much for responding, Daniel.
>> >>
>> >> I'm sorry I don't quite follow- I've never done this before. I should
>> use the URL {{ datamine.image.url }} in the template?
>> >>
>> >> On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman 
>> wrote:
>> >>>
>> >>> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
>> 
>>  I've implemented this same solution (using custom file storage and
>> the "upload_to" parameter) but now cannot get the uploaded files to display
>> from my template. I would normally use {{ STATIC_URL }} but, since I've now
>> specified a custom location, I'm not sure why my path, which I've
>> hard-coded in the template, isn't working...any ideas?
>> 
>>  fs = FileSystemStorage(location='/data/www/upload')
>> 
>>  def image_location(instance, filename):
>>  return '/'.join(['thumbnails', str(instance.dataset_id), filename])
>> 
>>  class DataModel(models.Model):
>>  name = models.CharField()
>>  date = models.DateField(blank=True)
>>  image = models.ImageField(storage=fs, upload_to=image_location,
>> blank=True)
>> 
>>  template.html
>> 
>>  
>>  
>>  
>> >>>
>> >>> But /data/www/upload/... is the file path of your upload, not the
>> URL. You still need an actual URL that is served by your webserver.
>> Obviously, a browser can't access arbitrary file paths on your server.
>> >>> --
>> >>> DR.
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to a topic in
>> the Google Groups "Django users" group.
>> >>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
>> >>> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
>> .
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> > --
>> > 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/b015d26d-c95a-4435-bd93-107244d5a798%40googlegroups.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>>
>> --
>> "La utopía sirve para caminar" Fernando Birri
>>
>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an

uploadhandler.py comparing str with int

2015-04-07 Thread Jason Wilson
Line 167 in django/core/files/uploadhandler.py 
printing the type of the object settings.FILE_UPLOAD_MAX_MEMORY_SIZE shows 
this object is read as a string at this point in the code.
Therefore, the comparison always returns False and self.activated is True
'

--
class MemoryFileUploadHandler(FileUploadHandler):
"""
File upload handler to stream uploads into memory (used for small 
files).
"""

def handle_raw_input(self, input_data, META, content_length, boundary, 
encoding=None):
"""
Use the content_length to signal whether or not this handler should 
be in use.
"""
# Check the content-length header to see if we should
# If the post is too large, we cannot use the Memory handler.
if content_length > settings.FILE_UPLOAD_MAX_MEMORY_SIZE:   
 ## THIS LINE COMPARES INT WITH STR
self.activated = False
else:
self.activated = True

-- 
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/1acb37fa-7eb6-4ae5-88c0-c1460dc327e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


show code in template

2015-04-07 Thread Hanz
Hi everyone,
i want to show some piece of code on my website. What is the best way to do 
it? (embed into template)

>>> {{ object.name }}

Regards,
Hanz

-- 
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/681ea031-1078-4e5f-ab27-f806c4906663%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: show code in template

2015-04-07 Thread Luis Zárate
I don't understand what you want to do but I guest it's like verbatim

https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#verbatim

2015-04-07 12:18 GMT-06:00 Hanz :

> Hi everyone,
> i want to show some piece of code on my website. What is the best way to
> do it? (embed into template)
>
> >>> {{ object.name }}
>
> Regards,
> Hanz
>
> --
> 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/681ea031-1078-4e5f-ab27-f806c4906663%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyN5WiMNeqiGnPO%3DPYGeKh9AKmjyOexfiaMUFpwWZFq-HA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Model with two e-mail fields uniques

2015-04-07 Thread victor menezes
Hi there,

What would be the best way to make a model with two e-mail fields uniques?
I was thinking about writing some validation in the save() method but would
like to know whether Django has some built-in way to deal with it.

class Person(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
email1 = models.EmailField(null=True, blank=True)
email2 = models.EmailField(null=True, blank=True)
def __unicode__(self):
return self.last_name + ', ' + self.first_name
def save(self):
if (len(self.email1) == 0 and len(self.email2) == 0):
raise ValueError('At least one e-mail is needed to proceed.')
super(Member, self).save()


John = Person()
John.email1 = 'someEmail'
John.save()

Kane = Person()
Kane.email1 = 'anotherEmail
Kane.email2 = 'someEmail' #same email used by John on email1 field
Kane.save() #should raise error because email2 is already used by John on
email1 field

Thanks


Victor Menezes
"Geek by nature, Linux by choice"

-- 
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/CAAgFNMmFNGYNEQwdGxvW9x81S1RNb-Wm_LYuk3cZ1YD4rb7RLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model with two e-mail fields uniques

2015-04-07 Thread Javier Guerra Giraldez
On Tue, Apr 7, 2015 at 2:20 PM, victor menezes  wrote:
> What would be the best way to make a model with two e-mail fields uniques? I
> was thinking about writing some validation in the save() method but would
> like to know whether Django has some built-in way to deal with it.


it's a very bad idea to have plurality by adding a number of similar
fields.  instead, you should have a related table

class Person(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)

class Email(models.Model):
person = models.ForeignKey(Person)
email = models.EmailField(unique=True)


-- 
Javier

-- 
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/CAFkDaoTruUKGUxS0nKn6zyQFCy%2BY%2BY%2B4-kOBTOAgwOWQHR5AtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload above apache web root?

2015-04-07 Thread Stephanie Socias
Thank you all for your input. It turns out my settings file was improperly
configured. I needed to change MEDIA_ROOT and MEDIA_URL

On Tue, Apr 7, 2015 at 12:30 PM, Luis Zárate  wrote:

> Hi,
>
> Django provide for development MEDIA_URL and MEDIA_ROOT for uploaded file,
> for production used static deploy strategy, see the documentation about
> static files.
>
> Model file field has an url attribute that return a media url, you use in
> template like {{obj.file.url}}
>
>
> El martes, 7 de abril de 2015, Stephanie Socias 
> escribió:
> > Do I need to update/add something to my urls.py?
> >
> > On Tuesday, April 7, 2015 at 9:51:56 AM UTC-4, Stephanie Socias wrote:
> >>
> >> Thank you very much for responding, Daniel.
> >>
> >> I'm sorry I don't quite follow- I've never done this before. I should
> use the URL {{ datamine.image.url }} in the template?
> >>
> >> On Tue, Apr 7, 2015 at 5:36 AM, Daniel Roseman 
> wrote:
> >>>
> >>> On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote:
> 
>  I've implemented this same solution (using custom file storage and
> the "upload_to" parameter) but now cannot get the uploaded files to display
> from my template. I would normally use {{ STATIC_URL }} but, since I've now
> specified a custom location, I'm not sure why my path, which I've
> hard-coded in the template, isn't working...any ideas?
> 
>  fs = FileSystemStorage(location='/data/www/upload')
> 
>  def image_location(instance, filename):
>  return '/'.join(['thumbnails', str(instance.dataset_id), filename])
> 
>  class DataModel(models.Model):
>  name = models.CharField()
>  date = models.DateField(blank=True)
>  image = models.ImageField(storage=fs, upload_to=image_location,
> blank=True)
> 
>  template.html
> 
>  
>  
>  
> >>>
> >>> But /data/www/upload/... is the file path of your upload, not the URL.
> You still need an actual URL that is served by your webserver. Obviously, a
> browser can't access arbitrary file paths on your server.
> >>> --
> >>> DR.
> >>>
> >>> --
> >>> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> >>> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
> >>> To unsubscribe from this group and all its topics, 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/e14088d0-7c4a-4965-b88a-2fd0b26ec3cb%40googlegroups.com
> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>
> > --
> > 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/b015d26d-c95a-4435-bd93-107244d5a798%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/aHa0WWHGreY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAG%2B5VyNHO5H1m_dtE3WVrPE4FgSZ%3D%3Dckj-YFZWdoEWVxU4AKgA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAOw%3DD6Wod%3DGaReJsjbieHODQtJxy%3DG_kX7uztxWYp3FoVRT7-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Modifying admin add behaviour

2015-04-07 Thread Larry Martell
I have a model and I want to have this behaviour in admin:

1. Only the add button is shown.
2. When the user clicks the add button, it brings up the standard
page, but with just 1 custom button shown.
3. When the user clicks that custom button, I execute an ajax call and
display the results below the add div, and this page is shown until
the user clicks a button.

I have all this coded, but I am facing the following problems:

1. I am not getting the response back from my ajax call. In the Chrome
developers tools, in the network tab for this request, in the
Status/Text column, it says "(cancelled)" - not sure what that means.
If I run the same request from my browser I do get a response. On the
server side I am getting 'error: (32, 'Broken pipe')' Googling that
revealed that it's because the browser has already moved on, so there
is nothing to receive the response. I've tried setting the timeout to
a large value, but no joy. How can I get it to wait for the response?

2. It immediately returns back to the main admin page - how can I get
it to stay on the add page until the users clicks a button?

3. After my code returns, a row is added to the database. How can I
prevent the row from being added?

This is my change_form.html:

{% extends "admin/change_form.html" %}

{% block submit_buttons_bottom %}







function configureTools(tcd) {
var toolConfigData = tcd;
$.ajax({
type : 'GET',
url: '{% url 'motor.configuration.views.configure' %}',
data: 'toolConfigData='+toolConfigData,
success: function(configOut) {
$('.submit-row').after(
$('')
.html('
 Confguration succeded\n'+configOut+'
') ); }, error: function(configOut) { $('.submit-row').after( $('') .html('
 Confguration failed\n'+configOut+'
') ); } }); }; {% endblock %} -- 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/CACwCsY7N7B%3DEJn1Gny4jVpLuDPoRW6h%2BnrGgP5_Jux06Gbp2pA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

Issues downloading documentation offline

2015-04-07 Thread Nkansah Rexford
Downloading offline documentation doesn't work from the djangoproject.com

This link: https://docs.djangoproject.com/m/docs/django-docs-1.8-en.zip 
results in a mere 22bytes size .zip file with no content in the package.

Same for the PDF

Even this one: http://media.readthedocs.org/pdf/django/1.8.x/django.pdf 
leads to a dead-end.

Epub seems to be working.

-- 
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/5aa89cf7-697f-43cc-b5d6-4c5e15c8c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model with two e-mail fields uniques

2015-04-07 Thread victor menezes
Thanks for the help, I end up doing it was easy to implement the email as 
TabularInline inside the Person form in the Admin but how would you make 
mandatory to have at least one e-mail?
Should I validate inside the save() method of Person class?


On Tuesday, April 7, 2015 at 3:55:26 PM UTC-4, Javier Guerra wrote:
>
> On Tue, Apr 7, 2015 at 2:20 PM, victor menezes  > wrote: 
> > What would be the best way to make a model with two e-mail fields 
> uniques? I 
> > was thinking about writing some validation in the save() method but 
> would 
> > like to know whether Django has some built-in way to deal with it. 
>
>
> it's a very bad idea to have plurality by adding a number of similar 
> fields.  instead, you should have a related table 
>
> class Person(models.Model): 
> first_name = models.CharField(max_length=100) 
> last_name = models.CharField(max_length=100) 
>
> class Email(models.Model): 
> person = models.ForeignKey(Person) 
> email = models.EmailField(unique=True) 
>
>
> -- 
> Javier 
>

-- 
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/14e85fe3-ff59-4568-82b3-aa40ae488b94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with url template tag and namespaces

2015-04-07 Thread donarb
On Tuesday, April 7, 2015 at 9:19:17 AM UTC-7, donarb wrote:
>
> I'm having a problem with a generated url using the url template tag, 
> currently using Django 1.6.5.
>
> The appname is 'dashboard', here is the main urls.py:
>
> urlpatterns = patterns("",
> (r'^dashboard/', include('dashboard.urls', namespace='dashboard')),
> )
>
>
>
> Here is the dashboard urls.py:
>
> # dashboard/urls.py
> urlpatterns = patterns("",
> (r'^players/', include('players.urls', namespace='players')),
> )
>
>
> Here is the players urls.py:
>
> # dashboard/players/urls.py
> urlpatterns = patterns("",
> url(r'^search/?', views.PlayerSearchView.as_view(), name='search'),
> )
>
>
>
> When I code this in the template:
>
> {% url "dashboard:players:search" %}
>
>
>
> I get this url:
>
> /dashboard/playerssearch
>
>
> Any idea why there is no path separator between 'players' and 'search'?
>


Just to follow up, I found the problem. The search url pattern had an 
optional trailing '/', so it was not creating the url correctly. Once I 
removed the optional from the regex, it worked. 

-- 
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/a86d7bed-046a-4097-b607-5a6d7d6ecbd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Modifying admin add behaviour

2015-04-07 Thread Larry Martell
On Tue, Apr 7, 2015 at 5:40 PM, Larry Martell  wrote:
> I have a model and I want to have this behaviour in admin:
>
> 1. Only the add button is shown.
> 2. When the user clicks the add button, it brings up the standard
> page, but with just 1 custom button shown.
> 3. When the user clicks that custom button, I execute an ajax call and
> display the results below the add div, and this page is shown until
> the user clicks a button.
>
> I have all this coded, but I am facing the following problems:
>
> 1. I am not getting the response back from my ajax call. In the Chrome
> developers tools, in the network tab for this request, in the
> Status/Text column, it says "(cancelled)" - not sure what that means.
> If I run the same request from my browser I do get a response. On the
> server side I am getting 'error: (32, 'Broken pipe')' Googling that
> revealed that it's because the browser has already moved on, so there
> is nothing to receive the response. I've tried setting the timeout to
> a large value, but no joy. How can I get it to wait for the response?

I solved the above issue - I was not returning false from the onclick
hander. Once i did that I started getting the response.


But I am still trying to solved the 2 issues below.

> 2. It immediately returns back to the main admin page - how can I get
> it to stay on the add page until the users clicks a button?
>
> 3. After my code returns, a row is added to the database. How can I
> prevent the row from being added?
>
> This is my change_form.html:
>
> {% extends "admin/change_form.html" %}
>
> {% block submit_buttons_bottom %}
> 
>  name="configure"
> onclick="configureTools(document.getElementById('id_tool_configuration').value);"
> />
> 
>
> 
>
> 
> function configureTools(tcd) {
> var toolConfigData = tcd;
> $.ajax({
> type : 'GET',
> url: '{% url 'motor.configuration.views.configure' %}',
> data: 'toolConfigData='+toolConfigData,
> success: function(configOut) {
> $('.submit-row').after(
> $('')
> .html('
 Confguration succeded\n'+configOut+'
') > ); > }, > error: function(configOut) { > $('.submit-row').after( > $('') > .html('
 Confguration failed\n'+configOut+'
') > ); > } > }); > }; > > > {% endblock %} -- 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/CACwCsY7bOGA%2B%3D44YgL6ZCuTJDPdoP_N4je3j7R%2BpFq__Bgfccg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

Re: KeyError: 'default'

2015-04-07 Thread Mike Dewhirst

On 7/04/2015 8:48 PM, Flavia Missi wrote:

Hi,

 From Django 1.6 to Django 1.7 /migration**/handling was added to
Django, so I suppose you cannot run your project with 1.7 without
performing the required changes. If you're using south, take a look
here:
https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south


I haven't used South. All my table changes have been done manually to date.

The project actually works fine running under the dev server. The 
software seems ok under 1.7.


The problem is the test suite won't get started.

My test process is ...

1. Copy a set of fixtures to initial_data.json

2. Run the tests

3. Delete initial_data.json

The fixtures exclude all tables except for some reference info which 
must exist and would be too tricky to recreate from scratch each time. 
Also, the reference data is part of some of the tests. So, I'm more or 
less committed to using fixtures for testing.


Mike




Also, I see you're using sqlite3 for development, although this is very
fast, it may have considerable differences from using Postgres. So I
think it's a good idea to run your tests on postgres (at least on the CI).


Yes I do that. SQLite in dev and Postgres for staging.



Hope it helps.

Regards,
-
Flavia
@flaviamissi

On Mon, Apr 6, 2015 at 11:06 PM Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote:

On 7/04/2015 1:07 AM, Pavel Kuchin wrote:
 > Hi Mike,
 >
 > I think the issue is that Django can't find your default DB settings.
 > Please take a
 > look:
https://docs.djangoproject.__com/en/1.8/ref/settings/#__databases


Pavel

Thanks for responding. I have had that setting running since they were
first called for in release notes for 1.6 (I think) anyway, for quite a
long time. My test routine uses (settings.test) SQLite in memory as
follows ...

DATABASES = {
     "default": {
         "ENGINE": "django.db.backends.sqlite3",
         "NAME": ":memory:",
         "USER": "",
         "PASSWORD": "",
         "HOST": "",
         "PORT": "",
         },
     }

In production (settings.base) it is ...

dbhost = getcreds('db.host', PROJECT)
DATABASES = {
     'default': {
         'ENGINE':   'django.db.backends.__postgresql_psycopg2',
         'NAME':     PROJECT,
         'USER':     dbhost[0],
         'PASSWORD': dbhost[1],
         'HOST':     dbhost[2],
         'PORT':     dbhost[3],
     }
}

Trying to run the tests in Postgres delivers the same error but with an
additional final line ...

     return self.cursor.execute(sql, params)
django.core.serializers.base.__DeserializationError: Problem installing
fixture
'C:\Users\mike\env\xxex3\ssds\__substance\fixtures\initial___data.json':
relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM
"django_co...
                                            Â
                ^

In case that doesn't line up properly in the email, the caret is
positioned like this ...

FROM "django_co...
      ^

The dev server runs and the software (unmigrated) works. I just cannot
get my unit tests to run under 1.7. It is like the nightmare of finding
yourself naked in Times Square!

Mike

 >
 > Best regards, Pavel
 >
 > à ¿à ¾à ½à µà ´à µà »ÑŒà ½à ¸à º, 6
à °à ¿Ñ€à µà »Ñ  2015 à ³., 15:44:01 UTC+3
 > à ¿à ¾à »ÑŒà ·à ¾à ²à °Ñ‚à µà »ÑŒ Mike
Dewhirst à ½à °à ¿à ¸Ñ à °à »:
 >
 >Â  Â  Â Can someone please explain what KeyError: 'default' means?
 >
 >Â  Â  Â This is the first time I have tried Django 1.7 and without
doing any
 >Â  Â  Â migrations all I have done here is this ...
 >
 >Â  Â  Â (xxex3) C:\Users\mike\env\xxex3\ssds>__copy
 >Â  Â  Â substance\fixtures\test_data.__json
substance\fixtures\initial___data.json
 >
 >Â  Â  Â (xxex3) C:\Users\mike\env\xxex3\ssds>__python manage.py test
 >Â  Â  Â --settings=ssds.settings.test --verbosity=1 common refer
substance
 >Â  Â  Â company workplace credit
 >
 >Â  Â  Â Python:Â  Â 3.4
 >Â  Â  Â Django:Â  Â 1.7.7
 >Â  Â  Â 17:40:04
 >Â  Â  Â SQLite3:Â  memory
 >
 >Â  Â  Â Creating test database for alias 'default'...
 >Â  Â  Â Traceback (most recent call last):
 >Â  Â  Â  Â  Â File
 >Â  Â
 
"C:\Users\mike\env\xxex3\lib\__site-packages\django\contrib\__contenttypes\models.py",
 >
 >Â  Â  Â line 19, in get_by_natural_key
 >Â  Â  Â  Â  Â  Â ct = self.__class__._cache[self.db]__[(app_label,
model)]
 >Â  Â  Â KeyError: 'default'
 >
 >Â  Â  Â During handling of

Re: Issues downloading documentation offline

2015-04-07 Thread Tim Graham
Hi Nkansah,

Just wanted to acknowledge that I'm aware of these issues and am looking 
into it.

I believe the latter issue needs to be resolved on the readthedocs end. See 
https://github.com/django/django/pull/4436 for some discussion.

Tim

On Tuesday, April 7, 2015 at 6:35:26 PM UTC-4, Nkansah Rexford wrote:
>
> Downloading offline documentation doesn't work from the djangoproject.com
>
> This link: https://docs.djangoproject.com/m/docs/django-docs-1.8-en.zip 
> results in a mere 22bytes size .zip file with no content in the package.
>
> Same for the PDF
>
> Even this one: http://media.readthedocs.org/pdf/django/1.8.x/django.pdf 
> leads to a dead-end.
>
> Epub seems to be working.
>

-- 
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/e82021c5-1190-4f0c-a6c6-c8d1ee91a8d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model with two e-mail fields uniques

2015-04-07 Thread victor menezes
Would it be a bad approach to use a ManyToMany with properties null/blank 
False?

class Email(models.Model):
email = models.EmailField(unique=True)
def __unicode__(self):
return self.email

class Person(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
emails = models.ManyToManyField(Email, null=False, blank=False)
def __unicode__(self):
return self.last_name + ', ' + self.first_name
 

On Tuesday, April 7, 2015 at 6:48:22 PM UTC-4, victor menezes wrote:
>
> Thanks for the help, I end up doing it was easy to implement the email as 
> TabularInline inside the Person form in the Admin but how would you make 
> mandatory to have at least one e-mail?
> Should I validate inside the save() method of Person class?
>
>
> On Tuesday, April 7, 2015 at 3:55:26 PM UTC-4, Javier Guerra wrote:
>>
>> On Tue, Apr 7, 2015 at 2:20 PM, victor menezes  
>> wrote: 
>> > What would be the best way to make a model with two e-mail fields 
>> uniques? I 
>> > was thinking about writing some validation in the save() method but 
>> would 
>> > like to know whether Django has some built-in way to deal with it. 
>>
>>
>> it's a very bad idea to have plurality by adding a number of similar 
>> fields.  instead, you should have a related table 
>>
>> class Person(models.Model): 
>> first_name = models.CharField(max_length=100) 
>> last_name = models.CharField(max_length=100) 
>>
>> class Email(models.Model): 
>> person = models.ForeignKey(Person) 
>> email = models.EmailField(unique=True) 
>>
>>
>> -- 
>> Javier 
>>
>

-- 
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/b3064bc1-6a3c-4989-adbd-8d71da35db36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.