display thousand separator.
Hi list! I'm having a localization issue. The thing is that I have an AdminForms that contains a value field (wich is a model.BigInteger at the model ) and when the value is displayed at the admin form I would like it to show the THOUSAND_SEPARATOR as configured in setting.py. So this is what I've done USE_I18N = True USE_L10N = True USE_THOUSAND_SEPARATOR = True THOUSAND_SEPARATOR = '.' DECIMAL_SEPARATOR = ',' and then at the init method of my admin form I did this : self.fields['value'].localize = True self.fields['value'].is_localized = True So now I can input for example: 5.000.000 but after saving it it shows 500 Any solutions besides doing some javascript tampering? Thanks! -- Nicolas Emiliani Lo unico instantaneo en la vida es el cafe, y es bien feo. -- 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.
non-root SCRIPT_NAME, mod_wsgi and RewriteRule
I have my Django website and my static files deployed under the same directory (i.e. no separate 'static' directory), according to the following Apache RewriteRule: RewriteEngine on RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f RewriteRule ^.*$ /django/$1 [QSA,PT,L] WSGIScriptAlias /django/ /var/www/domain.com/django/site/wsgi.py My site-wide urlconf looks like this: urlpatterns = patterns('', url(r'^blog/', include('blog.urls')), url(r'', include('home.urls')), ) With my app-specific urlconf ('home.urls') is simply this: urlpatterns = patterns('home.views', url(r'^(?P[a-z0-9-]+)/?$', 'page_by_uri'), url(r'^$', 'index'), ) So when I visit my site domain.com I should see the index view (which it does), and when I visit domain.com/foo I should see the page_by_uri('foo') view, *which it doesn't*. Instead, it shows the index view. (And I thought it should give an error!) Having surfed around a little bit, I reckon it's got something to do with Django's handling of SCRIPT_NAME (which should be equal to the mount point, in my case '/dj'). Various solutions are proposed, generally involving adding the mount point to my urlconf (bad!) until I tried it and it doesn't even work... Basically, how in the name of all that is holy and sacred can I get this to work?! Thanks in advance smime.p7s Description: S/MIME Cryptographic Signature
django and mysql versions
According to this page: https://docs.djangoproject.com/en/dev/ref/databases/ "Django supports MySQL 5.0.3 and higher." But the next section says that MySQLdb is required, and when you click the link to MySQLdb from that page, it goes to this page: http://sourceforge.net/projects/mysql-python/ which states that the supported versions are: "MySQL versions from 3.23 to 5.1" Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and higher" seems to me to imply that this would work, but if MySQLdb is required for Django and MySQLdb only supports up to 5.1, then that implies that it is at least not supported. Anyone tried it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/gM8MX-Q3T9UJ. 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.
app for kickstarter-like goals
I'm developing a website for a non-profit organization. They want something similar to kickstarter, only based on people instead of money. Let's say there's an event. A birthday. If 5 people preorder the ticket there will be a clown* If 10 people preorder the ticket there will be a clown orchestra (in a small car) il 100 people preorder the ticket there will be a golden statue of a clown. I have no problem with the "buying tickets thing", but I couldn't find in django-packages anything related to milestones or goals. Do you know if there is already something I can use? Or should I create it? Thanks! * if you hate clowns you can replace them with cookies -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2y9biFnbiIUJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django and mysql versions
Thanks for the response -- this is really useful information about what MySQL features new to version 5.5 are not handled by MySQLdb. In this case, my reasons for asking about using MySQL 5.5 aren't really about wanting any features that are available only in 5.5, but more about a situation where the choice of MySQL version isn't entirely up to me. I'm hoping to avoid spending time configuring a development environment with this version only to find out that this actually doesn't work at all. So from your response I get that probably it would work. Is there anyone out there who's actually tried it and knows from experience what will happen? If not, I'll try it and update this thread with how it comes out. On Sunday, September 30, 2012 1:38:45 PM UTC-4, Dennis Lee Bieber wrote: > > On Sun, 30 Sep 2012 09:18:49 -0700 (PDT), Elizabeth Rachel Lemon > > declaimed the following in > gmane.comp.python.django.user: > > > Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and > > higher" seems to me to imply that this would work, but if MySQLdb is > > required for Django and MySQLdb only supports up to 5.1, then that > implies > > that it is at least not supported. Anyone tried it? > > The main features that have been added to MySQL are views, > triggers, > stored procedures... And "prepared statements". > > So far as I know, the only thing MySQLdb doesn't handle is the > "prepared statements" aspect -- it uses the query interface that is > common to all versions: it sends complete text queries. The main place > where the difference would be visible is if one does an .executemany(). > > The common-to-all versions would issue multiple complete > statements, > which need to be parsed and compiled by MySQL /each time/: > > insert into thetable (f1, f2, f3) values (v11, v12, v13) > insert into thetable (f1, f2, f3) values (v21, v22, v23) > insert into thetable (f1, f2, f3) values (v31, v32, v33) > > Prepared statements would send a parameterized statement to MySQL > to > be "compiled" > > insert into thetable (f1, f2, f3) values (?1, ?2, ?3) > > and then send the values separately, telling MySQL to use the already > compiled statement > > stmtref, v11, v12, v13 > stmtref, v21, v22, v23 > stmtref, v31, v32, v33 > > I'd find it highly unlikely that MySQL would have /removed/ some > portion of the API that would invalidate pre-existing application code. > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlf...@ix.netcom.com > HTTP://wlfraed.home.netcom.com/ > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/qmkYEYLqjc4J. 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.
Making form label a href
In an app I've inherited, there are forms generated with {{ form.as_p }} in the template. This generates HTML like this, for example: Group 12S 13S 22SOI Is there some way to have the form label be a href? -- 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: Making form label a href
> Is there some way to have the form label be a href? you'll have to change the forms templates to something like {% for field in form %} {{ field.label }} {{ field }} {% endfor %} -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_(") to help him gain world domination. -- 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: model field not null
null=True is the opposite of what you are asking for anyway. You can use null=False, and the column will be created with the database's version of: NOT NULL Which is the postgres spelling. This will prevent the database from allowing a database NULL from being stored there. But it will NOT prevent storing an empty string. Assuming that your database supports it, you could write a "trigger" or "constraint" that checks for non blank and fails the transaction otherwise. But, in so far as I know, Django provides no help in creating this constraint. Bill On Wed, Sep 26, 2012 at 4:47 PM, Jonas Geiregat wrote: > Hello, > > While setting up a new model I'm trying to have a strong data model. > > One of the requirements is that a certain field cannot be null. > > lastname = models.CharField( > blank=False, > default=None, > ..) > > I'm accomplishing this by the above code. This ensure that even on a database > level lastname will not be NULL, by setting default to None. > > I'm aware that I can just use blank=False to ensure that on a form level it > will never be allowed to be empty. But I want a strong, fully tested, > business model from the beginning. > > As this is a CharField, according to the docs, I cannot use null=True since > empty string will get stored as empty strings and not as NULL. > > Is this an appropriate way of modeling my models, or are there other > solutions ? > > Regards, > > Jonas. > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django and mysql versions
On Sun, Sep 30, 2012 at 12:38 PM, Dennis Lee Bieber wrote: > The main features that have been added to MySQL are views, triggers, > stored procedures... And "prepared statements". I beg to differ: http://dev.mysql.com/doc/refman/5.0/en/create-view.html http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html all these features were already implemented in MySQL 5.0 As far as I can tell, none of these is used by MySQLdb, so it doesn't make any difference. It would certainly be odd if it worked with 5.1 and not with 5.5 Note that recent Ubuntu distros install MySQL 5.5 by default. I guess that if there was any problem with that, we would be innundated by bug reports. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Add your own template library
Hi, I have created a custom template tags library which I would like to use across my application. I referred this code snippet, http://djangosnippets.org/snippets/342/ but still when I refer the tag in my code as: {% load repeat %}. It says 'repeat' is not a valid tag library, tried django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat Any help would be appreciated. - Thanks Ashish -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/4AqRRolTYK0J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to force django.views.i18n.set_language to use cookies
Hi All. Is there anyway to force django.views.i18n.set_language view to use cookies rather than session (I need that enabled but just for the admin not for my main app)? Thanks in advance. Ezequiel http://flickrock.com/mikelpierre -- 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.
Tools - Slow in python django fw
Hi , We have converted our tools from php to django framework but tool performance is very slow compare to php . Please let us what are things we have to do ... Thanks, Siva -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/7s9SZXW-TYUJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Add your own template library
Hi, Yes it do have __init__.py I have created a simple project of template tags and have installed it as a python package with setup.py. After which I am referring it into my website. - Thanks for reply On Monday, 1 October 2012 09:45:46 UTC+5:30, Laxmikant Gurnalkar wrote: > > Hi Ashish, > Is there __init__.py in your templatetags directory ? > > cheers > *Laxmikant* > > > On Mon, Oct 1, 2012 at 9:36 AM, Ashish Jain > > wrote: > >> Hi, >> >> I have created a custom template tags library which I would like to use >> across my application. >> I referred this code snippet, http://djangosnippets.org/snippets/342/ >> >> but still when I refer the tag in my code as: {% load repeat %}. >> >> It says 'repeat' is not a valid tag library, tried >> django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat >> >> Any help would be appreciated. >> >> - Thanks >> Ashish >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-users/-/4AqRRolTYK0J. >> To post to this group, send email to django...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> django-users...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > * > > GlxGuru > > * > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/I1f8NTaWQM4J. 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.