Re: CAS and Django cache

2011-10-27 Thread Malcolm Box
Yes, get followed by set can lead to data loss. What you want is cache.add(). This sets the value if and only if there is no existing value. Its atomic on backends that support it - notably memcached. Sent from my iPhone, please excuse any typos On 27 Oct 2011, at 07:26, Dan Julius wrote:

How to create unique tags based on Taggit

2011-10-27 Thread Tsung-Hsien
I use Taggit to create a list of tags, and want to create unique tags of the list. I have a list as below tags=[[], [], [], [], [],[], [], []] and write this for i in range(0,len(tags)): if tags[i] not in s: s.append(tags[i]) However, the output s is same as tags. s=[[],

Re: Deploying Django

2011-10-27 Thread sakthi
Ok. I installed mod_wsgi and did all configrations. i created django.wsgi file in my app with all the entries and also added WSGIScriptAlias / /home/saki/gpc/apache/django.wsgi to the httpd.conf in apache. Still i am getting an apache internal error. misconfigured. i think its the problem with m

Re: CAS and Django cache

2011-10-27 Thread Tom Evans
On Wed, Oct 26, 2011 at 11:29 PM, dmitry b wrote: > Can I do check-and-set operations using Django's cache api? > > > Thanks > D. > Memcached reuse existing terminology and then complain that this causes confusion. Their CAS stands for 'compare and set', rather than the 'compare and swap' that yo

Re: Deploying Django

2011-10-27 Thread Daniel Roseman
On Thursday, 27 October 2011 10:13:56 UTC+1, sakthi wrote: > > Ok. I installed mod_wsgi and did all configrations. > > i created django.wsgi file in my app with all the entries and also > added WSGIScriptAlias / /home/saki/gpc/apache/django.wsgi to the > httpd.conf in apache. > > Still i am ge

Re: Field.Choices in Template

2011-10-27 Thread Tom Evans
On Wed, Oct 26, 2011 at 7:22 PM, Kurtis Mullins wrote: > Hey Guys, > I hate to bother you again. But -- is there a way to get the currently > selected data from this set? For example, a user hits the page and all > choices are displayed fine. But, they pick some choices. They haven't > finished ed

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 7:17 AM, angelika wrote: > Hello, > > I'm new to both Python and Django. A few months ago, I installed > Django on my mac (running Snow Leopard). I took me quite some time, > but I got it running. After that I didn't get around to doing anything > with it. A few weeks ago,

Re: Accuracy of GeoIP?

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 7:38 AM, Alan wrote: > Does anyone have experience with the accuracy of GeoIP? I'm getting > locations that are wildly off... > > When I plug in the IP from http://whatismyipaddress.com/ I get > somewhere in the middle of Kansas when I'm in Chicago. > > On the other hand us

Localization without translation

2011-10-27 Thread Raoul
Hi, is it possible to have localization available without translation? I've tried to figure this out without much success. What I did was removing the default LANGUAGE_CODE so that Django has to check HTTP_ACCEPT_LANGUAGE header. After that I set USE_I18N = False in my settings and leave USE_L10N

Re: How to create unique tags based on Taggit

2011-10-27 Thread Amao Zhao
hi, Tsung: your code for i in range(0,len(tags)): if tags[i] not in s: s.append(tags[i]) the tags[i] will return the tag.__unicode__() function and compare with the s List, so you will get the complete List as the beginning. If you want get your hope result, you can use the dj

Re: Help Required with Image Upload

2011-10-27 Thread Tom Evans
On Wed, Oct 26, 2011 at 9:06 PM, Swaroop Shankar V wrote: > Hello All, > Am pretty new to Django. I am trying to create a form which will upload an > image and then enable the user to crop visually (using JCrop plugin). Am > not completely sure on how to implement this in Django. I am thinking of

Database management commands

2011-10-27 Thread Daniele Procida
I keep getting errors like this: _mysql_exceptions.OperationalError: (1005, "Can't create table 'arkestra_medic_dev.#sql-51b_4a8' (errno: 150)") when running database management commands (syncdb, south migrate). Sometimes those commands work, sometimes they don't; it happens across a variety o

Logging messages higher than INFO level

2011-10-27 Thread Ahmed Refaey
Dear Community, I tried to configure simple logging system like this: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'simple': { 'format': '%(levelname)s: %(message)s' } }, 'handlers': { 'console':{

Re: Accuracy of GeoIP?

2011-10-27 Thread Ilya
Alan, try out our geolocation solution: Geobaza. We recently updated our Python API and make Django app. High accuracy level for US & exUSSR. Install from PyPi: http://pypi.python.org/pypi/geobaza Docs here: http://geobaza.ru/docs/python/v1/ Demo: http://geobaza.ru/try/ Feel free to send me your

Re: Database management commands

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 12:33 PM, Daniele Procida wrote: > I keep getting errors like this: > > _mysql_exceptions.OperationalError: (1005, "Can't create table > 'arkestra_medic_dev.#sql-51b_4a8' (errno: 150)") > > when running database management commands (syncdb, south migrate). > > Sometimes th

Re: Logging messages higher than INFO level

2011-10-27 Thread Masklinn
On 2011-10-27, at 11:53 , Ahmed Refaey wrote: > Dear Community, > > I tried to configure simple logging system like this: > LOGGING = { >'version': 1, >'disable_existing_loggers': False, >'formatters': { >'simple': { >'format': '%(levelname)s: %(message)s' >

Reg: Displaying the contents of the file at a dynamic location

2011-10-27 Thread Dhinesh Babu
Hi, Need some help on this: *Background: * In a django-based web application *Large* text encoded file is saved at a dynamic location (~ 10k lines) *Queries:* 1. Displaying the file contents onto the webpage (Either line by line or all at a time). 2. How to give the path of the file, i

Re: Reg: Displaying the contents of the file at a dynamic location

2011-10-27 Thread kenneth gonsalves
On Thu, 2011-10-27 at 17:41 +0530, Dhinesh Babu wrote: > In a django-based web application Large text encoded file is saved at > a dynamic location (~ 10k lines) what do you mean by 'dynamic location'? -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the G

Re: natural keys for auth.user and group

2011-10-27 Thread Simon Williams
Unfortunately, according to the Django ticket for this (https://code.djangoproject.com/ticket/13914) it seems that we aren't going to get this functionality built-in any time soon. However, after many hours of inspection in the Django source, I think I have found a solution... 1. In Django 1.3

Re: Database management commands

2011-10-27 Thread Daniele Procida
On Thu, Oct 27, 2011, Tom Evans wrote: >On Thu, Oct 27, 2011 at 12:33 PM, Daniele Procida wrote: >> I keep getting errors like this: >> >> _mysql_exceptions.OperationalError: (1005, "Can't create table >'arkestra_medic_dev.#sql-51b_4a8' (errno: 150)") >> >> when running database management comm

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread angelika
Thanks, Tom. I see. So basically I need to reinstall Django, if I want to run it on Python 2.7.1, is that it? As far as I can tell, the older versions of Python are still installed on my machine. Does that mean that it might be possible to run an older version instead, and not have to reinstall Dj

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Andre Terra
You can run different versions of python using virtualenv [1]. It is hands down the best way to handle multiple python environments. You can use virtualenvwrapper [2] to automate some of the process. I'm not sure how good it is on Mac OS, but you should be fine. I found a link [3] that looks like

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 2:43 PM, Andre Terra wrote: > You can run different versions of python using virtualenv [1]. It is hands > down the best way to handle multiple python environments. > > You can use virtualenvwrapper [2] to automate some of the process. I'm not > sure how good it is on Mac O

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Kurtis Mullins
Good luck with installing MySQL-python. You'll probably see an error at some point that the Module MySQLdb is missing if you use MySQL and don't install it. Last time, with Snow Leapord, I had to install "Mac Ports" to get it working. If you don't want to use the complexity of the virtual environm

Re: Reg: Displaying the contents of the file at a dynamic location

2011-10-27 Thread Kurtis Mullins
You would probably save these files just like any other User Uploaded Media. For example, in Django 1.3 this the Media Path setup in your settings.py. You would store a reference to the path in your database. Look up Storage Backends documentation for more information on this. As a side note, be

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Javier Guerra Giraldez
On Thu, Oct 27, 2011 at 9:20 AM, Kurtis Mullins wrote: > If you don't want to use the complexity of the virtual environment, just run > "sudo easy_install django" or "sudo pip install django" from your terminal. > This will install Django system-wide. the same commands work inside a virtualenv. w

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread bazaarsoft
Mac OS has always carried multiple Python installs. You can start python using python2.5, python2.6, and on Lion python2.7. Those installs are under /System/Library/Frameworks/Python.framework/ but links to the executables are in /usr/bin/. When you install Python packages, they get installed in /

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread creecode
Hello Angelika, As a test you may want to try the defaults command ( for more info "$ man defaults" and/or google "mac os x defaults" ) to see if your Django install is still in the site-packages of an older version of python. Try something like this on the command line... $ defaults write co

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread creecode
Angelika may not want to get into virtualenv and virtualenvwrapper at this point. If you're just getting into Python/Django it may be more overhead than you want to deal with conceptually at this time. If your project is simple or you're just learning then you may want to wait until you feel t

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Andre Terra
IMHO, If you can't understand how imports and sys.path work, it's best to put the Django book aside and read up on the basics of installing and running Python. Cheers, AT On Thu, Oct 27, 2011 at 1:55 PM, creecode wrote: > Angelika may not want to get into virtualenv and virtualenvwrapper at th

Re: Weird situation about static file

2011-10-27 Thread Nan
You may need to run manage.py collectstatic again, unless you used collectstatic -l when you first collected your static files. On Oct 26, 12:22 pm, Tsung-Hsien wrote: > I just change some style of css, but after runserver, the css is > nothing change. > I not only deleted the image file in the

Re: Possible to run manage.py sqlall [appname] without db connection?

2011-10-27 Thread Nan
Probably because due to quirks of each DB engine, the SQL differs depending on your DB connection info. On Oct 26, 6:18 pm, Jason wrote: > I need to be able to output the table creation code but I don't > necessarily have access to a database. > > Why does simply outputting the SQL require first

create object instance with ManyToManyField

2011-10-27 Thread Jaroslav Dobrek
Hello, how can I create an object instance with a ManyToManyField. Everything works fine via the admin interface. But I don't understand how to do it in Python. Example: I have this model: class Company(models.Model): name = models.CharField(max_length=200, unique=True) country = models

Re: create object instance with ManyToManyField

2011-10-27 Thread Leonardo Giordani
Hi Jaroslav, you have to do the following n = Company(name=my_name, country=my_country, isin=my_isin) n.save() n.indices.add(my_indices) See here https://docs.djangoproject.com/en/dev/topics/db/queries/#saving-foreignkey-and-manytomanyfield-fields Bye 2011/10/27 Jaroslav Dobrek : > Hello, > >

Re: Database management commands

2011-10-27 Thread Leonardo Giordani
This is a problem related to Innodb and MyISAM. Django uses this latter, while probably your imported DB is an Innodb one. Check here https://docs.djangoproject.com/en/dev/ref/databases/ Search Google for the matter too, you are not the only one experiencing it. I would suggest getting rid of the

Re: Possible to run manage.py sqlall [appname] without db connection?

2011-10-27 Thread Jason
Ah, I guess that makes sense - so depending on which Oracle version, etc. I'd still love to see it fall back to some kind of best guess. On Oct 27, 9:13 am, Nan wrote: > Probably because due to quirks of each DB engine, the SQL differs > depending on your DB connection info. > > On Oct 26, 6:18 

Re: Accuracy of GeoIP?

2011-10-27 Thread Kurtis Mullins
I just tried the demo and it put me about 2,500 miles away in Texas. Good luck! On Thu, Oct 27, 2011 at 7:31 AM, Ilya wrote: > Alan, try out our geolocation solution: Geobaza. We recently updated our > Python API and make Django app. > > High accuracy level for US & exUSSR. > > Install from PyPi

rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
Hello all, I stupidly flush my db with sqlflush. Please how do I do a rollback? Is it possible? Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: Possible to run manage.py sqlall [appname] without db connection?

2011-10-27 Thread Andre Terra
Isn't there a dummy database wrapper? django.db.backends.dummy.base.DatabaseWrapper or something like that You could also setup sqlite (very easy, little overhead) to get started right away Cheers, AT On Thu, Oct 27, 2011 at 2:59 PM, Jason wrote: > Ah, I guess that makes sense - so depending

Re: rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
The docs says "Prints the SQL statements that would be executed for the flush command." Why did it truncate the data in the tables? On Thu, Oct 27, 2011 at 6:16 PM, Kayode Odeyemi wrote: > Hello all, > > I stupidly flu

lowercase alphanumeric usernames

2011-10-27 Thread Andrew Marder
Dear Django Users, I want to restrict usernames to be lowercase alphanumeric characters like this: def clean_username(username): return re.sub(r'\W', '', username).lower() Now, I'm not sure where is best to do this. I thought it might be clever to do this using middleware like this: def pro

Re: Regression in blocktrans tag parsing between 1.2 and 1.3

2011-10-27 Thread SmileyChris
I think this may be that the previous format worked but wasn't really supported. The 1.2 documentation on the blocktrans tagsays: > Designate and bind a counter value with the name count [...] A

Re: Accuracy of GeoIP?

2011-10-27 Thread Charles Cossé
Hello, I've been using GeoIP for a few years ... but the trick is to use a different database than the default. Don't know where to get it, but it's called: GeoLiteCity.dat I'm sure it's readily available, but not with a default install (think). -Charles Cosse On Thu, Oct 27, 2011 at 11:13 AM,

Re: Regression in blocktrans tag parsing between 1.2 and 1.3

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 7:05 PM, SmileyChris wrote: > I think this may be that the previous format worked but wasn't really > supported. > The 1.2 documentation on the blocktrans tag says: >> >> Designate and bind a counter value with the name count >> >> [...] >> >> A more complex example: >> {%

Re: rollback django-admin.py sqlflush

2011-10-27 Thread Tom Evans
On Thu, Oct 27, 2011 at 6:24 PM, Kayode Odeyemi wrote: > The docs says "Prints the SQL statements that would be executed for > the flush command." > Why did it truncate the data in the tables? > sqlflush wouldn't - flush would. If your data is gone, it is not from sqlflush. You could only rollba

Re: rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
On Thu, Oct 27, 2011 at 8:06 PM, Tom Evans wrote: > On Thu, Oct 27, 2011 at 6:24 PM, Kayode Odeyemi wrote: > > The docs says "Prints the SQL statements that would be executed for > > the flush command." > > Why did it truncate the data in the tables? > > > > sqlflush wouldn't - flush would. If y

Re: Iteration over queryset in a model

2011-10-27 Thread eyscooby
I kinda came across an article about creating Proxy Models, that is what I tried and it really seemed to do what I needed, pretty cool. Here is what I coded ...(sorry for the formatting, if it looks goofy) Edit “models.py” file: (create the new Proxy Model) class RequestTicketCompleted(RequestT

Re: Database management commands

2011-10-27 Thread Russell Keith-Magee
On Fri, Oct 28, 2011 at 12:49 AM, Leonardo Giordani wrote: > This is a problem related to Innodb and MyISAM. Django uses this > latter, Incorrect. Django doesn't have any built in preference for InnoDB or MyISAM -- it uses the system default table type. On most systems, MyISAM is the default, but

FormPreview and template variables

2011-10-27 Thread NewsNerd
I'm a Django noob and fear the answer to my question is fairly obvious, but hoping someone can help. I'm building an app that includes the same form on every page, with the content surrounding the form and the model instance to which the form data is tied dependent on a value passed in the URL.

How to display {{}} in django template!

2011-10-27 Thread 沈澄
Dear all: How can I display {{}} or {%%} In django template without error! thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send em

Re: Accuracy of GeoIP?

2011-10-27 Thread Alex Mandel
You just need to go to the maxmind website to download it. GeoIP free data also comes from them but is slightly older and on their website you can choose country, city and regional datasets to use. Thanks, Alex On 10/27/2011 11:56 AM, Charles Cossé wrote: > Hello, I've been using GeoIP for a few

Re: How to display {{}} in django template!

2011-10-27 Thread Matías Aguirre
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#templatetag Excerpts from 沈澄's message of 2011-10-28 00:42:23 -0200: > Dear all: >How can I display {{}} or {%%} In django template without error! > > > thanks > -- You received this message because you are subs

Re: How to display {{}} in django template!

2011-10-27 Thread Yok Keen Hui
What exactly is the error you get? On Fri, Oct 28, 2011 at 2:55 PM, Matías Aguirre wrote: > > https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#templatetag > > Excerpts from 沈澄's message of 2011-10-28 00:42:23 -0200: > > Dear all: > >How can I display {{}} or {%%} I

Re: column user_id is not unique

2011-10-27 Thread Yok Keen Hui
Could this be because you did not have a primary key for your geofeed model and django automatically used your first column(user) as the primary key which returns such an error? On Thu, Oct 27, 2011 at 3:03 AM, Shark wrote: > There is problem in this project > I use Auth User and foreign key in

Re: column user_id is not unique

2011-10-27 Thread Jani Tiainen
Could you please post actual traceback you get? Because it feels that you had different model when you ran syncdb, changed something later but did not modified database schema to comply with your model(s). And if model doesn't have explicit PK django should create one named "id", it shouldn'