Re: JSONField filter fails with TypeError: can only concatenate tuple (not "list") to tuple

2019-11-01 Thread Raffaele Salmaso
On Fri, Nov 1, 2019 at 10:38 PM John-Paul Navarro 
wrote:

> The following fails with Django 2.2.6 but works with Django 1.11.x.
>
https://code.djangoproject.com/ticket/30826

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JuOC3D0iKdye9y_Orpw4kKFu-xZZWo7Y%2B%2BATtWSQbF1Bg%40mail.gmail.com.


Re: 404 error when posting a multipart/form-data form

2019-03-22 Thread Raffaele Salmaso
On Thu, Mar 21, 2019 at 2:42 PM Manlio Perillo 
wrote:

> The view code is here:
> https://gist.github.com/perillo/2f828209cea84ff8c753f6f2524119f1
>
I don't see the {% csrf_token %} in the template

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JsbmPbXrso8UXFWg-G1hLm%3DMDTzV%3DSvh2SUcb5tvQ0rjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] django-service-urls 1.1.0

2019-01-19 Thread Raffaele Salmaso
I'm happy to announce the 1.1.0 release of django-service-urls package, an
evolution of dj-database-url which can handle CACHES and EMAIL_BACKEND setting
other than DATABASES.

*News*
Simplified installation: instead of modifying the setting file (possibility
that is always available) just add import service_urls.patch in your
manage.py/wsgi.py files.

*Urls*
pypi and docs: https://pypi.org/project/django-service-urls/
main repo (bitbucket/mercurial):
https://bitbucket.org/rsalmaso/django-service-urls/
github mirror: https://github.com/rsalmaso/django-service-urls
gitlab mirror: https://gitlab.com/rsalmaso/django-service-urls
(I accept patches from every repository)

*Install*
$ python3 -m pip install django-service-urls


Add import service_urls.patch to manage.py and wsgi.py

*manage.py:*
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
import service_urls.patch

def main():
   os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
   try:
   from django.core.management import execute_from_command_line
   except ImportError as exc:
   raise ImportError(
   "Couldn't import Django. Are you sure it's installed and "
   "available on your PYTHONPATH environment variable? Did you "
   "forget to activate a virtual environment?"
   ) from exc
   execute_from_command_line(sys.argv)


if __name__ == '__main__':
   main()


*wsgi.py:*import os
import service_urls.patch
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
application = get_wsgi_application()

*Usage*
Configure your setting (see docs for better example).

DATABASES = {
'default': os.environ.get('DATABASE_DEFAULT',
'postgres://myuser:mypasswd@localhost:5432/mydb'),
}
CACHES = {
'default': os.environ.get('CACHE_DEFAULT', ''memcached://127.0.0.1:11211
'),
}
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'smtp://localhost:25')


-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4Jsy4PXQXLj5SQc0FOq7fAAW%2BEcRexy2u9XV40-ry4uJXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] django-service-urls 1.0.1

2018-12-23 Thread Raffaele Salmaso
I'm happy to announce the release of django-service-urls package, an
evolution of dj-database-url which can handle CACHES and EMAIL_BACKEND
setting other than DATABASES.

*Urls*
pypi and docs: https://pypi.org/project/django-service-urls/
main repo (bitbucket): https://bitbucket.org/rsalmaso/django-service-urls/
github mirror: https://github.com/rsalmaso/django-service-urls
gitlab mirror: https://gitlab.com/rsalmaso/django-service-urls
(I accept patches from every repository)

*Install*
$ python3 -m pip install django-service-urls

In your settings.py file add at the end one handler for each setting you use
import service_urls
DATABASES = service_urls.db.parse(DATABASES)
CACHES = service_urls.cache.parse(CACHES)
if service_urls.email.validate(EMAIL_BACKEND):
for k, v in service_urls.email.parse(EMAIL_BACKEND).items():
setting = 'EMAIL_' + ('BACKEND' if k == 'ENGINE' else k)
globals()[setting] = v

*Usage*
Configure your setting (see docs for better example).

DATABASES = {
'default': os.environ.get('DATABASE_DEFAULT',
'postgres://myuser:mypasswd@localhost:5432/mydb'),
}
CACHES = {
'default': os.environ.get('CACHE_DEFAULT', ''memcached://127.0.0.1:11211
'),
}
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'smtp://localhost:25')

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JuDanE0KegwNBmZ1qq1QmeQHn1-%3DLGqNtu2mHXz%3DLW7uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DEFAULT_FILE_STORAGE and tests

2018-09-20 Thread Raffaele Salmaso
On Thu, Sep 20, 2018 at 3:25 PM sandro dentella 
wrote:

>
>
> from django.conf import settings
> from django.test.runner import DiscoverRunner
>
>
> class GeneraliDiscoverRunner(DiscoverRunner):
> def __init__(self, *args, **kwargs):
> settings.DEFAULT_FILE_STORAGE = 'web.storage.TestStorage'
> super().__init__(*args, **kwargs)
>
> It seems that this changes the Storage in all situations apart from the
> fields declared in the models via the storage=ThumbnailStorage. I guess
> when model are read the settings from the runner has not yet been set. Is
> there a way to set the Storage in due time?
>
> Not really sure, but you can use override_settings from django.test.utils
as

from django.test.utils import override_settings
@override_settings(DEFAULT_FILE_STORAGE='web.storage.TestStorage')
class GeneraliDiscoverRunner(DiscoverRunner):
pass

(override_settings does a lot of other things)

or use a custom DJANGO_SETTINGS_MODULE

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JsQ93KtvRqs0F00hoLTp7_M%2BAqrLFn65iTtS%3DeBJ9YQvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-04 Thread Raffaele Salmaso
On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng <zen1...@gmail.com> wrote:
>
> When I use django==1.10.7, this does not happen.
> When I use django==1.11a1 this happens.
>
Why 1.11a1? Current is 1.11.4

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: EMAIL_BACKEND doesn't works with Amazon SES!?

2016-03-29 Thread Raffaele Salmaso
On Tue, Mar 29, 2016 at 2:56 AM, Neto <paulosouzamac...@gmail.com> wrote:
>
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # this is
> default
> EMAIL_HOST = 'email-smtp...amazonaws.com'
> EMAIL_PORT = 465
> EMAIL_HOST_USER = '...'
> EMAIL_HOST_PASSWORD = '...'
> EMAIL_USE_TLS = True
>

My config
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "email-smtp.$zone.amazonaws.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "$USER"
EMAIL_HOST_PASSWORD = "$PASSWORD"
EMAIL_USE_TLS = True

Different port.
I'm using python 3.4

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JtaLbpDdFo7JzBA7R9BjEE6kU9nKRPT406N9SAttdC%2B9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the AdminSite instance (and class) to use BEFORE the autodiscover runs

2016-01-22 Thread Raffaele Salmaso
On Fri, Jan 22, 2016 at 11:38 PM, Luis Masuelli <luisfmasue...@gmail.com>
wrote:

> I would like to create a custom AdminSite instance, using a custom
> subclass of my own, and provide some project-level urls for the AdminSite.
> However, I would like to still benefit from the autodiscover feature.
>
> Is there a way I can instance a custom AdminSite subclass, and have that
> instance reachable as `admin.site` import path? This means, the following
> line:
>
> from django.contrib.admin import site
>
> returning my custom AdminSite instance, if I want to override it. In this
> way, installed apps register their model admins against my custom AdminSite
> instance. For this to work, I want this to be executed *before* the
> autodiscover process is run in the app registry.
>
> How can I do it?
>

You can use django.contrib.admin.apps.SimpleAdminConfig and call
autodiscover yourself.

In your settings
INSTALLED_APPS = [
...
"django.contrib.admin.apps.SimpleAdminConfig",
...
"myproject.apps.Config",
...
]

and in myproject/apps.py

from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _


class Config(AppConfig):
name = "myproject"
verbose_name = _("My Project")

def ready(self):
super(Config, self).ready()

from django.contrib import admin
from myproject.admin.sites import site
admin.site = site
admin.autodiscover()



-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4JukPvnT-U%2BkS7YkGVi-4A8d97fOdY3xZULc320tG9u5ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I really about to give up Django

2013-08-22 Thread Raffaele Salmaso
{{ form.brinq.descricao }} ?

On Thu, Aug 22, 2013 at 4:28 PM, Fellipe Henrique <felli...@gmail.com> wrote:
> Hi guys,
>
> I really about to give up from Django, because? I try to do something simple
> and I looking, looking around the internet and don't find anything about
> this... try this simple example: http://pastebin.com/epazpBcZ
>
> I just want to get "descricao" field, from "Brinq" model, using a
> inlineformSet.
>
> I can't do this.. I try:  {{ form.brinq__descricao }} , {{
> form.brinq_id__descricao }}, {{ form.brinq.descricao }} and {{
> form.brinq_id__descricao }}
>
> I think it`s simple thing to do.. but I don't found anything to do this in
> internet..
>
> Can any one help me in this simple question?
>
> Thanks.
>
> --
> 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.



-- 
| Raffaele Salmaso
| http://salmaso.org
| https://bitbucket.org/rsalmaso
| http://gnammo.com

-- 
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 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined

2012-11-02 Thread Raffaele Salmaso
On Fri, Nov 2, 2012 at 10:11 AM, Michael Muster
<michael.mus...@googlemail.com> wrote:
>   File "/home/michael/www/project/news/models.py", line 28, in News
> author = models.ForeignKey(settings.AUTH_USER_MODEL)
> NameError: name 'settings' is not defined
> NameError: name 'settings' is not defined
did you forget to include
from django.conf import settings
in /home/michael/www/project/news/models.py?

--
| Raffaele Salmaso
| http://salmaso.org
| https://bitbucket.org/rsalmaso
| http://gnammo.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: Django with Apache and mod_python

2010-06-05 Thread Raffaele Salmaso
Jagdeep Singh Malhi wrote:
> MOD_PYTHON ERROR

> please  help...
use mod_wsgi, mod_python is old and not more mantained
http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-deployment-modwsgi

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele dot salmaso at gmail dot 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-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: Generic Relations and Django Admin?

2010-01-19 Thread Raffaele Salmaso
Victor Hooi wrote:
> I tried that, and the fields aren't there, but when I try to save the
> object, I get a:
> 
> IntegrityError at /admin/people/address/add/
> people_address.content_type_id may not be NULL
> 
> so obvoiusly Django doesn't like it if those fields aren't filled.
it's a bug http://code.djangoproject.com/ticket/12577

> How do people normally do this sort of thing, with a polymorphic
> object that's referenced by multiple other objects?
use this hack until it's fixed

if 'django.contrib.contenttypes' in settings.INSTALLED_APPS:
# patch django.contrib.contenttypes.generic.BaseGenericInlineFormSet
# to provide the instance.pk
# see http://code.djangoproject.com/ticket/12577
from django.contrib.contenttypes import generic

def save_new(self, form, commit=True):
# Avoid a circular import.
from django.contrib.contenttypes.models import ContentType
kwargs = {
self.ct_field.get_attname():
ContentType.objects.get_for_model(self.instance).pk,
self.ct_fk_field.get_attname(): self.instance.pk,
}
new_obj = self.model(**kwargs)
return generic.save_instance(form, new_obj, commit=commit)
setattr(generic.BaseGenericInlineFormSet, 'save_new', save_new)

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele dot salmaso at gmail dot 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-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: Generic Relations and Django Admin?

2010-01-18 Thread Raffaele Salmaso
Victor Hooi wrote:
> class AddressAdmin(VersionAdmin):
> pass
> class AddressInline(generic.GenericTabularInline):
> model = Address
> ...
  fields = (the fields you want to display)
or
  exclude = ('content_type', 'object_id',)

> class HospitalAdmin(admin.ModelAdmin):
> inlines = [
> AddressInline,
> ]
> ...
> admin.site.register(Address, AddressAdmin)

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele dot salmaso at gmail dot 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-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: Changing database name on the fly

2009-12-24 Thread Raffaele Salmaso
S.Selvam wrote:
> Hi all,
> 
>   I have a a need to decide the database dynamically.On submitting the
> form,i would check a parameter action in my views.py.
> 
>  if action=="dummy":
>DATABASE_NAME=maindb_tmp
>  else:
>DATABASE_NAME=maindb
> 
> But that does not work,it always chooses table from maindb.
> 
> How could i force it to choose maindb_tmp ?,
Use django trunk from svn, or wait for django 1.2, which has multi-db
support
http://docs.djangoproject.com/en/dev/topics/db/multi-db/#topics-db-multi-db

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele dot salmaso at gmail dot 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-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: optional parameter url

2009-02-25 Thread Raffaele Salmaso

Adonis wrote:
> (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> {'document_root': '/mesa'}),
this takes *everything* as 'path'
> (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> 'django.views.static.serve', {'document_root': '/mesa'}),
this takes only digits as 'xexe', but it never get called because it
cames after .*

swap them as
(r'^appname/mainpage/(?P\d+)/(?P.*)$',
 'django.views.static.serve', {'document_root': '/mesa'}),
(r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
 {'document_root': '/mesa'}),

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

--~--~-~--~~~---~--~~
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: Multiple static media roots?

2009-01-24 Thread Raffaele Salmaso

John Baker wrote:
> Any suggestions?
write a custom file storage
http://docs.djangoproject.com/en/dev/topics/files/

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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



Re: splitting tests.py

2009-01-23 Thread Raffaele Salmaso

gderazon wrote:
>> tests/
>> +- __init__.py
>> +- test1.py
>> +- test2.py
>> \- test3.py

if you are using unittest in __init__.py:

from test1.py import *
from test2.py import *
from test3.py import *

if you are using doctest in __init__.py:

from test1 import MY_TEST1
from test2 import MY_TEST2
from test3 import MY_TEST3

__test__ = {
  'test1' : MY_TEST1,
  'test2' : MY_TEST2,
  'test3' : MY_TEST3,
}

docs:
http://docs.djangoproject.com/en/dev/topics/testing/
http://docs.python.org/library/unittest.html
http://docs.python.org/library/doctest.html

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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



Re: splitting tests.py

2009-01-23 Thread Raffaele Salmaso

gderazon wrote:
> My tests.py has become too big, I want to split it to several test
> files and still be able to run the tests with manage.py tests ...
> How can I do that?
> I'm working with django 1.0 stable release.
tests/
+- __init__.py
+- test1.py
+- test2.py
\- test3.py

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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

2008-10-14 Thread Raffaele Salmaso

Alfredo Alessandrini wrote:
> I don't understand where is the difference...
indentation, so different code paths

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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



Re: modelForm

2008-10-14 Thread Raffaele Salmaso

Alfredo Alessandrini wrote:
> def setup_player(request):
> if request.method == 'POST':
> form = PlayerForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect(form_successfully)
> else:
> form = PlayerForm()
> return render_to_response('player_form.html', {'form': form})
def setup_player(request):
if request.method == 'POST':
form = PlayerForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(form_successfully)
else:
form = PlayerForm()
return render_to_response('player_form.html', {'form': form})

notice the last three lines

the usual pattern is
if POST:
form = MyForm(POST)
if form.is_valid():
return HttpResponseRedirect('all_ok.html')
else: # no POST data
form = MyForm()
return render_to_response(..., {...})

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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



Re: 'maxlength problem'

2008-09-03 Thread Raffaele Salmaso

zissan wrote:
> title = models.CharField(maxlength=200)
now is max_length

> Is there something has been chaged sine 0.96?
a lot
see http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges for
a full list

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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