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:

> Couldn't that potentially overwrite a value set by a different thread?
> 
> Dan
> 
> On Thu, Oct 27, 2011 at 7:13 AM, Kurtis Mullins  
> wrote:
> umm, I'm not sure if "check-and-set" is some cache-specific lingo or not. But 
> if you want to see if a value isn't set, check to see if it's None type... 
> example:
> 
> if cache.get('key') is None:
> cache.set('key', 'value', cache_seconds)
> 
> Sorry if that's not at all what you're talking about :)
> 
> 
> On Wed, Oct 26, 2011 at 6:29 PM, dmitry b  wrote:
> Can I do check-and-set operations using Django's cache api?
> 
> 
> Thanks
> D.
> 
> --
> 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.
> 
> -- 
> 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.



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=[[], [], [], [],
[],[], [], []]

How to get s=[[], [], [], []]

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



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 mod_wsgi. because the 'WSGIScriptAlias'
didnt change color( i am using vim). and the other 'Alias' changes
color to blue.

Is that the problem. Please help.

Thankyou :)



On Oct 27, 3:19 am, Javier Guerra Giraldez  wrote:
> On Wed, Oct 26, 2011 at 5:14 PM, sakthi  wrote:
> > i installed mod_python and
>
> that's where you got it wrong.
>
> mod_python is obsolete and deprecated.  the supported way to deploy
> python apps with apache is mod_wsgi.  check
>
> https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
>
> --
> 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.



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 you would assume.

Django's cache API is designed to work with a number of backends, not
all of which offer an atomic compare and set method, so there is no
Django API for accessing compare and set on the memcached backend.

You can access the memcached client via django though:

>>> from django.core import cache
>>> c=cache.get_cache('default')
>>> help(c._client.cas)
Help on method cas in module memcache:

cas(self, key, val, time=0, min_compress_len=0) method of
memcache.Client instance
Sets a key to a given value in the memcache if it hasn't been
altered since last fetched. (See L{gets}).
... (do this yourself to see the whole docs)


Malcolm: compare and set is not equivalent to add. Compare and set is
used to change a cached value atomically, as long as it has not
already changed from the value you think it has. Add only sets a value
if it has not already been set.

Cheers

Tom

-- 
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: 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 getting an apache internal error. misconfigured. 
>

So, what does the Apache error log (probably /var/log/httpd/error_log 
or /var/log/apache2/error.log) say?
--
DR.

-- 
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/-/zt4RVSq0EaoJ.
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: 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 editing the form or maybe they made a mistake, anyways they land in
> the form_invalid land. I'd like to be able to use this same technique to
> make sure I properly display what the user has selected thus-far.
> Thanks!
>

Are you hand generating the widgets? That seems crazy, you lose all of
the benefits of django doing it for you.

To access the value of a BoundField, call the value() method on it. In
a template:

{% for field in form %}{{ field.value }}{% endfor %}


Cheers

Tom

-- 
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: 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, I upgraded my mac to run Lion and now, when
> I type import django in the python interpreter, it says No module
> named django.
>
> I found someone who had had a similar problem, and I'm guessing it
> could be connected to the fact that Lion comes with Python 2.7.1? My
> Django version is 1.2.5. Again, I know almost nothing about Python, so
> I could be way off base. Any ideas how I can solve this, or find out
> what the problem is?
>
> /Angelika
>

Python packages are installed for a specific minor version of python.
If you upgrade your minor version of python, then you will need to
reinstall all the python packages you use for that specific minor
version of python.

By 'minor version', I mean this: Python 2.7.1 has major version 2,
minor version 7 and minor minor version 1. You need to reinstall
whenever you change major or minor version.

Cheers

Tom

-- 
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: 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 using a Google IP address (mentioned in the example
> below) correctly gives the lat/long of Mountain View
>
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/
>
> I'm referencing data donwloaded from MaxMind:
> http://geolite.maxmind.com/download/geoip/database/
> As instructed by the link above.
>
> I didn't run into any installation problems, so I assume there's a
> data discrepancy somewhere; does anyone know of any known issues?
>
> Thanks
>

GeoIP is wildly inaccurate, particularly the free version. Using it to
predict reliably any more than the correct country is risky, and even
that fails a lot. Many GeoIP databases put me in Germany because my IP
address belongs to DeutscheTelecom and is leased to my (UK) ISP.

Cheers

Tom

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



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 = True and I added
django.middleware.locale.LocaleMiddleware to MIDDLEWARE_CLASSES right
after the SessionMiddleware.

I only want to use localized datetime fields in the admin interface,
no translation required or wished at all.

Thanks for your help.

-- 
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: 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 django core function:distinct().
Hope this can help you.

2011/10/27 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=[[], [], [], [],
> [],[], [], []]
>
> How to get s=[[], [], [], [ weather>]]
>
> 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 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: 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
> first saving the uploaded image into the disk as a jpeg file and then load
> and display the image as an overlay where the user can crop the image. I am
> able to create a form with the image field and then am passing over
> request.FILE to a function called handle_uploaded_image. Following is
> my handle_uploaded_image function
> def handle_uploaded_image(self, image):
>     """
>     This function is to handle uploaded image file
>     """
>     imageFile = Image.open(StringIO.StringIO(image.read()))
>     fileName = hashlib.md5(imageFile.getvalue()).hexdigest()+'.jpg'
> Now i am kind of confused on how to convert the uploaded image into jpg
> using PIL, and then saving into the disk. I had defined a field in my model
> to save the image file name which is as follows:
> class UserProfile(models.Model):
>
> avatar = models.ImageField(_('Avatar'),upload_to=settings.IMAGE_UPLOAD_PATH,
> null=True)
>
> I did this based on the django documentation, but it tells something about
> binding the form which am not able to correctly understand. Why do we need
> to bind a form with image field. Also whats the use of giving upload_to in
> model image field? Thanks in advance for any help.
> Regards,
>
> Swaroop Shankar V
>

http://www.pythonware.com/library/pil/handbook/introduction.htm

The section 'Reading and Writing Images' should make this clear.

Cheers

Tom

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



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

I am working on a database that was exported from one system and has been 
imported into a new one.

Running Django 1.3.1. I'm pretty sure the issue is something to do with my 
database/setup, rather than anything in the apps involved.

Any suggestions greatly appreciated.

Daniele


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



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':{
'level':'INFO',
'class':'logging.StreamHandler',
'formatter': 'simple'
}
},
'loggers': {
'xlogger': {
'handlers': ['console'],
'level': 'INFO'
}
}
}

Then in any module I tred:
logger.info('hello')
logger.debug('world')

then I just get the INFO messages in the stdout, but I expected to see all 
higher level message, why?

Thanks,

-- 
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/-/rcMu0GvIAMAJ.
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: 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 feedback ;)

On Thu, Oct 27, 2011 at 10:38, 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 using a Google IP address (mentioned in the example
> below) correctly gives the lat/long of Mountain View
>
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/
>
> I'm referencing data donwloaded from MaxMind:
> http://geolite.maxmind.com/download/geoip/database/
> As instructed by the link above.
>
> I didn't run into any installation problems, so I assume there's a
> data discrepancy somewhere; does anyone know of any known issues?
>
> 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 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: 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 those commands work, sometimes they don't; it happens across a 
> variety of apps.
>
> I am working on a database that was exported from one system and has been 
> imported into a new one.
>
> Running Django 1.3.1. I'm pretty sure the issue is something to do with my 
> database/setup, rather than anything in the apps involved.
>
> Any suggestions greatly appreciated.
>
> Daniele
>
>

errno 150 indicates that you tried to create an innodb table with an
incorrectly formed foreign key constraint.

http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html

Are you trying to reference a myisam table from an innodb table, or
are does the type of the column you are specifying as a foreign key
not match the type of the primary key of the table you are
referencing?

Cheers

Tom

-- 
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: 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'
>}
>},
>'handlers': {
>'console':{
>'level':'INFO',
>'class':'logging.StreamHandler',
>'formatter': 'simple'
>}
>},
>'loggers': {
>'xlogger': {
>'handlers': ['console'],
>'level': 'INFO'
>}
>}
> }
> 
> Then in any module I tred:
>logger.info('hello')
>logger.debug('world')
> 
> then I just get the INFO messages in the stdout, but I expected to see all 
> higher level message, why?
> 
> Thanks,

debug is a lower level than info, not higher (for standard `logging` levels,
critical > error > warning > info > debug).

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



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, in case we are displaying through
   html


Thanks,
Dhinesh

-- 
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: 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 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: 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 the User model already has it's own UserManager, so we 
must update that instead of overwriting it. This makes adding natural keys 
for Users much easier.
2. The ValidationError is because it's not even trying to use the natural 
keys- this code uses private fields like _default_manager, which were 
initialised before the manager was replaced. In the end, since we are only 
adding a method and nothing else, the most appropriate way to fix this is 
to change the __class__ of the objects member in Group.
3. I don't appear to need add_to_class(), but YMMV. An example would be 
good.

def uget_by_natural_key(self, username):
return self.get(username=username)
def gnatural_key(self):
return self.name
def unatural_key(self):
return self.username
class GroupManager(models.Manager):
def get_by_natural_key(self, name):
return self.get(name=name)

UserManager.get_by_natural_key = uget_by_natural_key
Group.objects.__class__ = GroupManager
User.natural_key = unatural_key
Group.natural_key = gnatural_key

For reference, I put this code in models.py.

Disclaimer: This kind of hackery may have serious side-effects, especially 
since Django has done a lot of initialisation by the time we get to this 
point.

-- 
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/-/v5rH2CqDHHoJ.
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: 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 commands (syncdb, south migrate).

>errno 150 indicates that you tried to create an innodb table with an
>incorrectly formed foreign key constraint.
>
>http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html
>
>Are you trying to reference a myisam table from an innodb table,

Not to my knowledge - certainly not deliberately!

> or
>are does the type of the column you are specifying as a foreign key
>not match the type of the primary key of the table you are
>referencing?

That's possible. I can understand how the complicated migration history might 
cause this though, but not a simple syncdb of easy_thumbnails!

Daniele

-- 
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: 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 Django? Can I run
different versions of Python on the same machine, and just switch
between the two?

/Angelika

On Oct 27, 11:28 am, Tom Evans  wrote:
> 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, I upgraded my mac to run Lion and now, when
> > I type import django in the python interpreter, it says No module
> > named django.
>
> > I found someone who had had a similar problem, and I'm guessing it
> > could be connected to the fact that Lion comes with Python 2.7.1? My
> > Django version is 1.2.5. Again, I know almost nothing about Python, so
> > I could be way off base. Any ideas how I can solve this, or find out
> > what the problem is?
>
> > /Angelika
>
> Python packages are installed for a specific minor version of python.
> If you upgrade your minor version of python, then you will need to
> reinstall all the python packages you use for that specific minor
> version of python.
>
> By 'minor version', I mean this: Python 2.7.1 has major version 2,
> minor version 7 and minor minor version 1. You need to reinstall
> whenever you change major or minor version.
>
> Cheers
>
> Tom

-- 
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: 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 a tutorial, but unfortunately blogspot.com is blocked for
me, so I can't read through it to assert its quality.


Good luck!
AT

[1] http://pypi.python.org/pypi/virtualenv
[2] http://www.doughellmann.com/projects/virtualenvwrapper/
[3] http://paintincode.blogspot.com/2010/08/install-pip-virtualenv.html



On Thu, Oct 27, 2011 at 11:30 AM, angelika wrote:

> 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 Django? Can I run
> different versions of Python on the same machine, and just switch
> between the two?
>
> /Angelika
>
> On Oct 27, 11:28 am, Tom Evans  wrote:
> > 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, I upgraded my mac to run Lion and now, when
> > > I type import django in the python interpreter, it says No module
> > > named django.
> >
> > > I found someone who had had a similar problem, and I'm guessing it
> > > could be connected to the fact that Lion comes with Python 2.7.1? My
> > > Django version is 1.2.5. Again, I know almost nothing about Python, so
> > > I could be way off base. Any ideas how I can solve this, or find out
> > > what the problem is?
> >
> > > /Angelika
> >
> > Python packages are installed for a specific minor version of python.
> > If you upgrade your minor version of python, then you will need to
> > reinstall all the python packages you use for that specific minor
> > version of python.
> >
> > By 'minor version', I mean this: Python 2.7.1 has major version 2,
> > minor version 7 and minor minor version 1. You need to reinstall
> > whenever you change major or minor version.
> >
> > Cheers
> >
> > Tom
>
> --
> 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: 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 OS, but you should be fine. I found a link [3]
> that looks like a tutorial, but unfortunately blogspot.com is blocked for
> me, so I can't read through it to assert its quality.
>
>

+1

For my projects I use virtualenv and pip, with all the required
packages specified in a requirements.pip file.

When I want to redeploy, it is simply a case of:

rm -rf environ
virtualenv --no-site-packages environ
source environ/bin/activate
pip install -r requirements.pip

requirements.pip is simple and looks like this:

django>=1.3,<1.4
south
MySQL-python
django-timezones
(etc)

Makes everything consistently reproducible. No packages get installed
in my system python folders, and my django app is insulated from any
packages added to the system python folders.

Cheers

Tom

http://www.pip-installer.org/en/latest/index.html
http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

-- 
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: 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 environment, just run
"sudo easy_install django" or "sudo pip install django" from your terminal.
This will install Django system-wide.

Of course a virtual environment seems to be a good idea by consensus and
Tom's instructions include a specific Django version which is the latest
stable available.

On Thu, Oct 27, 2011 at 9:59 AM, Tom Evans  wrote:

> 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 OS, but you should be fine. I found a link [3]
> > that looks like a tutorial, but unfortunately blogspot.com is blocked
> for
> > me, so I can't read through it to assert its quality.
> >
> >
>
> +1
>
> For my projects I use virtualenv and pip, with all the required
> packages specified in a requirements.pip file.
>
> When I want to redeploy, it is simply a case of:
>
> rm -rf environ
> virtualenv --no-site-packages environ
> source environ/bin/activate
> pip install -r requirements.pip
>
> requirements.pip is simple and looks like this:
>
> django>=1.3,<1.4
> south
> MySQL-python
> django-timezones
> (etc)
>
> Makes everything consistently reproducible. No packages get installed
> in my system python folders, and my django app is insulated from any
> packages added to the system python folders.
>
> Cheers
>
> Tom
>
> http://www.pip-installer.org/en/latest/index.html
> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
>
> --
> 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: 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 careful letting web users open files on your server. You
don't want them to get access to your /etc/passwd or even settings.py, for
example...

Good luck!

On Thu, Oct 27, 2011 at 8:18 AM, kenneth gonsalves
wrote:

> 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 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: 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. with the advantage of
being independent of what Apple does with the rest of the system.

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



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 /Library/
Python/VERSION#/site-packages/, so your django install is probably
under the 2.6 directory. Python 2.6 was the default python on Snow
Leopard - I believe Python 2.7 is the default on Lion and django isn't
installed in that directory which is why it stopped finding it.

Just FYI...

jay

On Oct 27, 8:30 am, angelika  wrote:
> 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 Django? Can I run
> different versions of Python on the same machine, and just switch
> between the two?
>
> /Angelika
>
> On Oct 27, 11:28 am, Tom Evans  wrote:
>
>
>
>
>
>
>
> > 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, I upgraded my mac to run Lion and now, when
> > > I type import django in the python interpreter, it says No module
> > > named django.
>
> > > I found someone who had had a similar problem, and I'm guessing it
> > > could be connected to the fact that Lion comes with Python 2.7.1? My
> > > Django version is 1.2.5. Again, I know almost nothing about Python, so
> > > I could be way off base. Any ideas how I can solve this, or find out
> > > what the problem is?
>
> > > /Angelika
>
> > Python packages are installed for a specific minor version of python.
> > If you upgrade your minor version of python, then you will need to
> > reinstall all the python packages you use for that specific minor
> > version of python.
>
> > By 'minor version', I mean this: Python 2.7.1 has major version 2,
> > minor version 7 and minor minor version 1. You need to reinstall
> > whenever you change major or minor version.
>
> > Cheers
>
> > Tom

-- 
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: 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 com.apple.versioner.python Version 2.6

( or 2.5, 2.4, etc depending on which version of Python you were using 
before ).

Log out and back into your shell.

$ python

>>> import django

Let us know what you find.

In the end though you may just want to reinstall Django into the current 
version of the Apple supplied "current" version of Python for Lion ( 2.7.x 
),  If you did the above test, just run the defaults command with 2.7 and 
log out/in, etc.  Then do your Django install.  Keep in mind that the older 
Django might still be hanging around in the old location so if your're 
concerned about disk space, you may want to attempt removal.  Otherwise it 
shouldn't cause a problem.

Toodle-looo
creecode

-- 
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/-/3bOHiiwStyMJ.
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: 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 the 
need for these tools.

Don't get me wrong these tools are fantastic and I use them myself!

Toodle-loo..
creecode

-- 
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/-/uzKtIhXl5qMJ.
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: 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 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 the
> need for these tools.
>
> Don't get me wrong these tools are fantastic and I use them myself!
>
> Toodle-loo..
> creecode
>
>  --
> 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/-/uzKtIhXl5qMJ.
>
> 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: 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 static folder, but deleted
> whole static folder and the website still show the image and css.
> only use in localhost, even doesn't deploy to server yet.
> I don't know why that happened
>
> Below is my setting
>
> MEDIA_ROOT = 'C:/Python27/Lib/site-packages/django/bin/mysite/media'
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use
> a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/";, "http://example.com/
> media/"
> MEDIA_URL = '/media/'
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static
> files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT = 'C:/Python27/Lib/site-packages/django/bin/mysite/static'
>
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/";
> STATIC_URL = '/static/'
>
> # URL prefix for admin static files -- CSS, JavaScript and images.
> # Make sure to use a trailing slash.
> # Examples: "http://foo.com/static/admin/";, "/static/admin/".
> ADMIN_MEDIA_PREFIX = '/static/admin/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
>         r'C:\Python27\Lib\site-packages\django\bin\mysite\blog\static',
>         r'C:\Python27\Lib\site-packages\django\bin\mysite\media',
>     # Put strings here, like "/home/html/static" or "C:/www/django/
> static".
>     # Always use forward slashes, even on Windows.
>     # Don't forget to use absolute paths, not relative paths.
> )
>
> 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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 connection to a
> database?

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



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.ForeignKey(Country)
isin = models.CharField(max_length=12, blank=True)
indices = models.ManyToManyField(Index, blank=True)

def the_indices(self):
ind = []
for index in self.indices.all():
ind.append(index.name)
return ', '.join(ind)
the_indices.short_description = u'Indices'

def __unicode__(self):
return self.name

This will work:

n = Company(name=my_name, country=my_country, isin=my_isin)
n.save()

This will not work:

n = Company(name=my_name, country=my_country, isin=my_isin,
indices=my_indices)
n.save()

Although I make sure that my_indices is a list of existing index
objects.

What do I have to do?

Jaroslav




-- 
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: 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,
>
> 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.ForeignKey(Country)
>    isin = models.CharField(max_length=12, blank=True)
>    indices = models.ManyToManyField(Index, blank=True)
>
>    def the_indices(self):
>        ind = []
>        for index in self.indices.all():
>            ind.append(index.name)
>        return ', '.join(ind)
>    the_indices.short_description = u'Indices'
>
>    def __unicode__(self):
>        return self.name
>
> This will work:
>
> n = Company(name=my_name, country=my_country, isin=my_isin)
> n.save()
>
> This will not work:
>
> n = Company(name=my_name, country=my_country, isin=my_isin,
> indices=my_indices)
> n.save()
>
> Although I make sure that my_indices is a list of existing index
> objects.
>
> What do I have to do?
>
> Jaroslav
>
>
>
>
> --
> 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: 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 new tables you created, switching
to InnoDB and migrating everything.

Try and let me know.

Leo

2011/10/27 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 of apps.
>
> I am working on a database that was exported from one system and has been 
> imported into a new one.
>
> Running Django 1.3.1. I'm pretty sure the issue is something to do with my 
> database/setup, rather than anything in the apps involved.
>
> Any suggestions greatly appreciated.
>
> Daniele
>
>
> --
> 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: 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 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 connection to a
> > database?

-- 
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: 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: 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 feedback ;)
>
>
> On Thu, Oct 27, 2011 at 10:38, 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 using a Google IP address (mentioned in the example
>> below) correctly gives the lat/long of Mountain View
>>
>> https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/
>>
>> I'm referencing data donwloaded from MaxMind:
>> http://geolite.maxmind.com/download/geoip/database/
>> As instructed by the link above.
>>
>> I didn't run into any installation problems, so I assume there's a
>> data discrepancy somewhere; does anyone know of any known issues?
>>
>> 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 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.
>

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



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 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: 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 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 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 connection to a
> > > database?
>
> --
> 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: 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 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
>
>


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



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 process_view(self, request, view_func, view_args, view_kwargs):
if 'username' in request.POST:
request.POST['username'] =
clean_username(request.POST['username'])

But, then I saw this note:

https://docs.djangoproject.com/en/dev/topics/http/middleware/#process-view

I've also seen the case insensitive authentication backend approach
here:

http://groups.google.com/group/django-users/browse_thread/thread/2967916ed3c77726/8f1fe50224b4e6ad

But, it seems like I would still be able to create two users one with
username 'admin' and another with username 'Admin'. So, I'll open this
up to the Django pros, any suggestions on how to enforce that all my
users have lowercase alphanumeric usernames?

Thanks,

Andrew

-- 
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: 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 more complex example:
> {% blocktrans with article.price as amount count i.length as years %}


Your "working in 1.3" example isn't correct -- the 'and' is superfluous (in 
fact, I'm surprised it worked).
Your "working in 1.2" example should only be binding a single value with 
count, as shown in the 1.2 documentation.

So it sounds like this is a case of things working which probably shouldn't 
have to begin with...

-- 
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/-/sq_F6ruqfksJ.
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: 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, Kurtis Mullins
wrote:

> 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: 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 feedback ;)
>>
>>
>> On Thu, Oct 27, 2011 at 10:38, 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 using a Google IP address (mentioned in the example
>>> below) correctly gives the lat/long of Mountain View
>>>
>>> https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/
>>>
>>> I'm referencing data donwloaded from MaxMind:
>>> http://geolite.maxmind.com/download/geoip/database/
>>> As instructed by the link above.
>>>
>>> I didn't run into any installation problems, so I assume there's a
>>> data discrepancy somewhere; does anyone know of any known issues?
>>>
>>> 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 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.
>>
>
>  --
> 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.
>



-- 
AsymptopiaSoftware|Software@theLimit
  http://www.asymptopia.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: 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:
>> {% blocktrans with article.price as amount count i.length as years %}
>
> Your "working in 1.3" example isn't correct -- the 'and' is superfluous (in
> fact, I'm surprised it worked).
> Your "working in 1.2" example should only be binding a single value with
> count, as shown in the 1.2 documentation.
> So it sounds like this is a case of things working which probably shouldn't
> have to begin with...
>

Is the and superfluous? Remember we are not talking about the 1.3
format, but 1.3 parsing the 1.2 format, which it is specified to do.

The 1.2 documentation states:

"If you need to bind more than one expression inside a blocktrans tag,
separate the pieces with and:"

and further:

"This tag also provides for pluralization. To use it:

Designate and bind a counter value with the name count. This value
will be the one used to select the right plural form.

Specify both the singular and plural forms separating them with the {%
plural %} tag within the {% blocktrans %} and {% endblocktrans %}
tags."

whilst specifying this as an example for count:

"{% blocktrans count list|length as counter %}
There is only one {{ name }} object.
{% plural %}
There are {{ counter }} {{ name }} objects.
{% endblocktrans %}"

If you look at tmpl3:

It binds a counter value with the name count
It specifies the count parameter in the same way as the docs
It separates the variables to be bound with 'and', as specified by the docs.

I don't doubt that the ambiguity of the documentation and the
complexity of the parsing played a part in why the tag was changed to
specify binding parameters in a completely different manner, but the
critical thing is that the docs specify that formats that worked in
1.2 will continue to work in 1.3, and that is not the case.

Either the code should be changed to parse 1.2 style formats in the
same way as 1.2 did, or the 1.3 documentation/rel notes should be
changed to note that this is a breaking difference in 1.3, that
formats that were accepted are now not.

Cheers

Tom

-- 
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: 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 rollback if you flushed your tables inside an
uncommitted open transaction. That sounds quite unlikely, so you will
need to restore from a backup. Sorry.

Cheers

Tom

-- 
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: 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 your data is gone, it is not from
> sqlflush.
>
> You could only rollback if you flushed your tables inside an
> uncommitted open transaction. That sounds quite unlikely, so you will
> need to restore from a backup. Sorry.
>
> Tom, I was surprised myself, because I read the docs before running  the
command:

django-admin.py sqlflush

It wipped off the whole table records.

Maybe you should do some tests. Backup your db and run the command.

I'm running mysql by the way.

-- 
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 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: 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(RequestTicket):
class Meta:
proxy=True
verbose_name = ‘Request Tickets Completed’
verbose_name_plural = ‘Request Tickets Completed’

def days_old(self):
return self.completion_date – self.issued_date
days_old.short_discription = ‘Days Old’

Edit “admin.py” file:

class RequestTicketCompletedAdmin(RequestTicketAdmin):

def queryset(self, request):
qs = super(RequestTicketAdmin, self).queryset(request)
if request.user.is_superuser:
return qs.filter(completion_date__isnull=False)

def save_model(self, request, obj, form, change):
obj.user = request.user
obj.save()

admin.site.register(RequestTicketCompleted,
RequestTicketCompletedAdmin)

now that shows up on my main admin page under the my application
section, the superuser can see it, click on it and it will only
display the completed tickets, with the amount of days it took to
complete, then they can also click on the plain Request Tickets and
see any open tickets by all users/techs and how long they have been
open for, sweet.
I had also read where it could be setup as a default manager on the
proxy to provide custom queryset instead of in the admin class, so i
will try and look into do that.

The only thing is that it will not show up on the list of Permissions
to be able to assign to users who would like to see closed tickets as
well, but that is not a really big deal.

Thanks for all your help


On Oct 24, 9:12 am, eyscooby  wrote:
> So with the items that are still waiting to be complete i wanted to
> show how many days the ticket has been open by doing something
> like ...
>
>     return date.today() - self.issued_date
>
> and then those that are complete ...
>
>     return self.competion_date - self.issued_date
>
> Can i create 2 managers for this?? one to return completed, and one to
> return not completed??
>
> On Oct 18, 12:04 pm, eyscooby  wrote:
>
>
>
> > Ok, this is helping, believe it or not your are helping, I'm probably
> > confusing myself mostly.
>
> > So the model method explanation was very helpful and you are correct
> > that works great, as long as all dates have a completion_date.  If a
> > new ticket is entered it will fail due to a "NoneType field with
> > DateField".
> > That line in my model is as such  "completed_date =
> > DateField(blank=True, null=True)".
>
> > The Manager is doing nothing more than returning data from the
> > database as a query so that makes sense also.
>
> > Step two .. is it because of the NULL=True?  can't subtract date field
> > from null field (which makes sense), is there a way around that?
> > I think this is why i was trying to calculate on a specific filter.
>
> > On Oct 18, 3:47 am, Daniel Roseman  wrote:
>
> > > On Monday, 17 October 2011 20:28:47 UTC+1, eyscooby wrote:
>
> > > > Ok, sorry I thought I was starting to understand it a little better,
> > > > but now I think I took a step backwards, so if it is ok with you let's
> > > > step back and take it a step at a time.
>
> > > > So, my first step is wondering if I really need a manager or not??
> > > > I was thinking from your first response to me that you might be
> > > > suggesting that I did.  Let's start there.
> > > > If I understand it correctly the Manager is a way of retrieving
> > > > specific information.
>
> > > > thanks
>
> > > Sorry for confusing you. There are two things going on here.
>
> > >  A Manager is for making custom queries to the database, to return new
> > > objects - either one or aquerysetof many. Your original code was using
> > > `Model.filter()` and modifying the result, so I suggested that it belonged
> > > in a manager.
>
> > > A model method is useful when you want to do a separate, non-database,
> > > operation on a single object. That's what you really want to do here - 
> > > given
> > > an instance of RequestTicket, calculate how old it is. There's noiteration
> > > contained in the method - you iterate through your existingqueryset
> > > elsewhere (say in the template) and call days_old on each instance:
>
> > >     {% for ticket in completed_tickets %}
> > >        {{ ticket.name }}: {{ ticket.days_old }}
> > >     {% endif %}
>
> > > Or, in your particular circumstance, you simply give the `days_old` method
> > > as one of the elements of the `list_display` tuple, and Django takes care 
> > > of
> > > the iterating, calling `days_old` on each row in the changelist.
>
> > > So in both of these circumstances, `days_old` simply needs to look like
> > > this:
>
> > >     def days_old(self):
> > >         return self.competion_date - sel

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 this isn't guaranteed or expected.

Django supports both MyISAM and InnoDB table types, but the available
feature set changes depending on the underlying table store.

Yours,
Russ Magee %-)

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



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. Works fine using the standard Form 
class and (URL, 'template.html', myapp.view) in URLconf, like so:

  url(r'^listings/(?P\d+)/submit$', 'myapp.views.lister'),

With FormPreview, however, instead of calling the view in the URLconf, you're 
calling the subclass with the view functionality baked in. 

 url(r'^listings/(?P\d+)/submit$', PickFormPreview(PickForm)),

>From what I can gather from the docs, FormPreview uses parse_params to pass 
>values captured in the URL to state.self, which I believe is a dictionary. 
>Unfortunately given my level of experience, I can't figure out from this 
>barebones understanding how to customize my FormPreview subclass how to pass 
>the listing_id captured in the URL to a template variable in my form.html 
>template called by FormPreview. Do I somehow need to override parse_params? Or 
>somehow pass state.listing_id? Or am I missing it entirely?

Any help much appreciated!
  

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



How to display {{}} 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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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, Kurtis Mullins
> wrote:
> 
>> 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: 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 feedback ;)
>>>
>>>
>>> On Thu, Oct 27, 2011 at 10:38, 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 using a Google IP address (mentioned in the example
 below) correctly gives the lat/long of Mountain View

 https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/

 I'm referencing data donwloaded from MaxMind:
 http://geolite.maxmind.com/download/geoip/database/
 As instructed by the link above.

 I didn't run into any installation problems, so I assume there's a
 data discrepancy somewhere; does anyone know of any known issues?

 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 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.
>>>
>>
>>  --
>> 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: 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 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: 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 {%%}  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 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: 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 anther table  "geoFeeds" and when
> adding data to table gepFeed am error happened
>
> column user_id is not unique
>
> when changing the userId it add one time but the second time it fails
> and give this error I don't know why
>
> this is the code
>
> models.py
>
> from django.db import models
> from django.contrib.auth.models import User
>
> class GeoFeed(models.Model):
>user = models.ForeignKey(User, unique=False)
>link = models.URLField()
>name = models.CharField(max_length=100)
>def __unicode__(self):
>return self.id
>
>
> and this is the function that add feeds in view
>
>
>
> def addFeed(request):
>ok = False
>
>if request.method == 'POST': # if the form has been submitted
>fname = request.POST.get('fname', '') # feed name
>flink = request.POST.get('flink', '') # feed link
>
>if fname is not None and flink is not None:
># save
>u = User.objects.get(pk = 2) # pre-defined user till amr
> finishes user-sys
>f = GeoFeed(user = u, link = flink, name = fname)
>f.save()
>
>return render_to_response('add_feed.html', {'ok': ok},
> RequestContext(request))
>
> --
> 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: 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't be using first field defined.


--

Jani Tiainen

On 26.10.2011 19:03, Shark wrote:

There is problem in this project
I use Auth User and foreign key in anther table  "geoFeeds" and when
adding data to table gepFeed am error happened

column user_id is not unique

when changing the userId it add one time but the second time it fails
and give this error I don't know why

this is the code

models.py

from django.db import models
from django.contrib.auth.models import User

class GeoFeed(models.Model):
 user = models.ForeignKey(User, unique=False)
 link = models.URLField()
 name = models.CharField(max_length=100)
 def __unicode__(self):
 return self.id


and this is the function that add feeds in view



def addFeed(request):
 ok = False

 if request.method == 'POST': # if the form has been submitted
 fname = request.POST.get('fname', '') # feed name
 flink = request.POST.get('flink', '') # feed link

 if fname is not None and flink is not None:
 # save
 u = User.objects.get(pk = 2) # pre-defined user till amr
finishes user-sys
 f = GeoFeed(user = u, link = flink, name = fname)
 f.save()

 return render_to_response('add_feed.html', {'ok': ok},
RequestContext(request))



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