The DjangoCon US 2014 CfP is open.

2014-06-11 Thread Christophe Pettus
The short version: Go here.  Send us papers:

http://www.djangocon.us/call_for_proposals/

Djangocon US is back in its home of Portland, Oregon for 2014, and we would 
like to get your contributions!  We are looking for talk proposals (25 minutes, 
45 minutes, and tutorials) from the entire Django community.  The CfP closes 
June 28th (soon!), so please get us your wonderful ideas.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2246675A-839F-40B6-876F-9FF4AA5ED23D%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django on App engine

2014-06-11 Thread Adam Simon


This is a great question! I would also like to hear some answers ...

Adam

On Thursday, May 1, 2014 4:46:38 AM UTC-7, Venkatraman.S. wrote:
>
> Hi,
>
> Has anyone or is anyone running a reasonably large django webapp on GAE? 
>  Looks like it has become 
> 
>  
> reasonably easier now compare to what it was a few years back. Any 
> experiences?
>
> regards,
> Venkat
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2c7d571-516e-4fd9-9298-fc80784c351e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Massive import in Django database

2014-06-11 Thread moqianc...@gmail.com
Hi, John:
Sorry! The pseudo code write by me is not correct, and It's slow..   I will 
come back tonight. 

With Regards,
Qiancong,Mo

From: moqianc...@gmail.com
Date: 2014-06-11 23:47
To: django-users
Subject: Re: Massive import in Django database
Hi, John:
I think your code is right, except "Doc.object" should be "Doc.objects";

The following pseudo code maybe fater than what you write:

doc_map = {}
for each xml:
extract from the xml data -> mydoc_code, mydoc_text, myRelated_doc_codes
doc = Doc.objects.create(doc_code=mydoc_code, doc_text=mydoc_text)
doc_map[mydoc_code] = (doc, myRelated_doc_codes)
for (doc, rcodes) in doc_map.values():
for rcode in rcodes:
doc.related_doc.add(doc_map[rcode])
doc.save()

I have checked, It's okay;
The object have be cached in doc_map, and no need re-query related_codes for 
related_doc from database,  the speed should speed up.

With Regards.




moqianc...@gmail.com

From: John Carlo
Date: 2014-06-11 21:14
To: django-users
Subject: Massive import in Django database
Hello everybody, 


I've fallen in love with Django two years ago and I've been using it for my job 
projects. In the past I found very useful information in this group, so a big 
thank you guys!


I have a little doubt.
I have to import in Django db (sqlite for local development, mySql on the 
server) about 1.000.000 xml documents.


The model class is the following:


class Doc(models.Model):
doc_code =  models.CharField(max_length=20, unique=True, primary_key=True, 
db_index = True) 

doc_text = models.TextField(null=True, blank=True) 
related_doc= models.ManyToManyField('self', null=True, blank=True, db_index 
= True) 



>From what I know bulk insertion is not possibile because I have a 
>ManyToManyField relation.


So I have this simple loop (in pseudo code)


for each xml:
   extract from the xml  date-> mydoc_code, mydoc_text, myRelated_doc_codes


   myDoc = Doc.object.get_or_create(doc_code = mydoc_code)[0]
   myDoc.doc_text = mydoc_text
   
   for reldoc_code in myRelated_doc_codes:
myRelDoc =  Doc.object.get_or_create(doc_code = reldoc_code )[0]
myDoc.related_doc.add(myRelDoc )


  myDoc.save()




I'm doing it right? Do you have some suggestions, recommendation? I fear that 
since I have 1.000.000 docs to import, it will take a lt of time, 
especially during the get_or_create routines


thank you in advance everybody!


John








 
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b88deaf-d806-4a64-9e8d-528d95599c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2014061208110509465878%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change settings.DEBUG in response to a request's source

2014-06-11 Thread Cal Leeming [Simplicity Media Ltd]
Although I can't comment on your individual use case, it's better to enable
remote error collection using something like Sentry or BugSnag. Both also
support integration with other languages, such as JS, which is very handy
when tracking down front end problems. There are lesser alternatives such
as New Relic error collection (which ties in with their APM) and plain ol'
email, but these are both considered obsolete these days.

To answer your original question, I'd strongly advice against selectively
enabling debug, but if you insist then you'd probably want to do it inside
middleware. Naturally any errors that occur before the middleware is loaded
won't get caught and will display the standard 500, and this could include
quite a few different problems (e.g. Db connection failure). If any
libraries/modules cache the settings.DEBUG property prior to the middleware
being called, then this may cause some weird edge cases. Another
alternative is to do is based on IP, but again this is extremely bad
practice for production.

Hope this helps.

Cal


On Wednesday, June 11, 2014, Silas Snider  wrote:

> I'm writing an app where it'd be super helpful for logged-in users from my
> company to see error pages and the like as though the app was running with
> DEBUG=True, while still preventing ordinary users from seeing that output.
> I see that the docs strongly warn me against changing settings at runtime,
> so I was wondering how I could achieve the same effect?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7c979ac0-e8b9-4ea6-9e49-2205eeaccd90%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagGKUcba3HnXbkbDJn%3DKs_Ff3EiXPgmHFerid1G76zqH3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site doesn't work

2014-06-11 Thread Glen J
urls.py:
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
 url(r'^admin/', include(admin.site.urls)),
)


settings.py:
# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 
'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mysite',  # Or path to database file 
if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'glen',
'PASSWORD': 'P0rchl1ght!',
'HOST': '192.168.122.120',  # Empty for 
localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '5432',  # Set to empty string for 
default.
}
}

# Hosts/domain names that are valid for this site; required if DEBUG is 
False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded 
files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/;, "http://media.example.com/;
MEDIA_URL = ''

# 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: "/var/www/example.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://example.com/static/;, "http://static.example.com/;
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# 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.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'vp4@9d))k610$v1me&*0)2)*06j@aop=u3'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'mysite.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'mysite.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or 
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
# Uncomment the next line to enable 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Understood, got that error cleared now.

Just a last question - should my HoleImages not present their upload 
options in the Hole part of the admin?






On Wednesday, June 11, 2014 9:57:19 PM UTC+1, Ilya Kazakevich wrote:
>
> Instead of 
>  from holes.models import HoleImage 
> write 
>  from holes.models import HoleImage, Hole 
>
> Please read https://docs.python.org/2/tutorial/modules.html 
>
>
>
>
> Ilya Kazakevich, 
> JetBrains PyCharm (Best Python/Django IDE) 
> http://www.jetbrains.com/pycharm/ 
> "Develop with pleasure!" 
>
>
> >-Original Message- 
> >From: django...@googlegroups.com  
> >[mailto:django...@googlegroups.com ] On Behalf Of Patrick C 
> >Sent: Thursday, June 12, 2014 12:52 AM 
> >To: django...@googlegroups.com  
> >Subject: Re: NameError at /admin/ name 'HoleImage' is not defined 
> > 
> >Should it be this: 
> > 
> >from django.contrib import admin 
> >from holes.models import HoleImage 
> > 
> >class HoleImageInline(admin.TabularInline): 
> >model = HoleImage 
> > 
> >class HoleAdmin(admin.ModelAdmin): 
> >fields = ['hole_number', 'hole_name', 'hole_description'] 
> >list_display = ['hole_number', 'hole_name', 'hole_description'] 
> >inlines = [ HoleImageInline, ] 
> > 
> >admin.site.register(Hole) 
> >admin.site.register(HoleImage) 
> > 
> > 
> > 
> >or this: 
> > 
> >from django.contrib import admin 
> >from holes.models import HoleImage 
> > 
> >class HoleImageInline(admin.TabularInline): 
> >model = HoleImage 
> > 
> >class HoleAdmin(admin.ModelAdmin): 
> >fields = ['hole_number', 'hole_name', 'hole_description'] 
> >list_display = ['hole_number', 'hole_name', 'hole_description'] 
> >inlines = [ HoleImageInline, ] 
> > 
> >admin.site.register(Hole, HoleImages) 
> > 
> > 
> >Still have errors trying either, sorry again for noob questions. 
> > 
> >On Wednesday, June 11, 2014 9:45:10 PM UTC+1, Jorge Andrés Vergara Ebratt 
> >wrote: 
> > 
> >When you import HoleImage don't remove Hole :) 
> > 
> >On Jun 11, 2014 3:41 PM, "Patrick C"   > 
> >wrote: 
> > 
> > 
> >Hi Jorge, 
> > 
> >Thanks for helping out - I understand that and have just 
> tried it but still 
> >get the error: 
> > 
> > 
> >NameError at /admin/ 
> > 
> >name 'Hole' is not defined 
> >Request Method:GET 
> >Request URL:http://127.0.0.1:8000/admin/ 
> >Django Version:1.6.5 
> >Exception Type:NameError 
> >Exception Value:name 'Hole' is not defined 
> >Exception 
> Location:/Users/my_laptop/development/golfsmart/holes/admin.py 
> >in , line 12 
> >Python Executable: /usr/bin/python 
> >Python Version:2.7.5 
> > 
> > 
> >So just to clarify my structure incase I'm missing 
> something on 
> >pluralisation: 
> > 
> >holes 
> >- admin.py 
> >- model.py 
> > 
> > 
> >models.py: 
> > 
> >from django.db import models 
> > 
> >class Hole(models.Model): 
> >hole_number = models.IntegerField() 
> >hole_name = models.CharField(max_length=255) 
> >hole_description = models.CharField(max_length=500) 
> > 
> >def __str__(self): 
> >return self.hole_number 
> > 
> >class HoleImage(models.Model): 
> >hole = models.ForeignKey(Hole, related_name='images') 
> >image = models.ImageField(upload_to='hole_photos') 
> >caption = models.CharField(max_length=250) 
> > 
> >admin.py: 
> > 
> >from django.contrib import admin 
> >from holes.models import HoleImage 
> > 
> >class HoleImageInline(admin.TabularInline): 
> >model = HoleImage 
> > 
> >class HoleAdmin(admin.ModelAdmin): 
> >fields = ['hole_number', 'hole_name', 
> 'hole_description'] 
> >list_display = ['hole_number', 'hole_name', 
> 'hole_description'] 
> >inlines = [ HoleImageInline, ] 
> > 
> >admin.site.register(Hole) 
> > 
> > 
> > 
> >On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge 
> Andrés Vergara 
> >Ebratt wrote: 
> > 
> >In admin.py you have 
> > 
> >from hotels.models import Hole 
> > 
> >Add HoleImage to that import 
> > 
> >On Jun 11, 2014 3:19 PM, "Patrick C" <
> patrick@gmail.com> 
> >wrote: 
> > 
> > 
> >

RE: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Ilya Kazakevich
Instead of 
 from holes.models import HoleImage
write 
 from holes.models import HoleImage, Hole

Please read https://docs.python.org/2/tutorial/modules.html




Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"


>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of Patrick C
>Sent: Thursday, June 12, 2014 12:52 AM
>To: django-users@googlegroups.com
>Subject: Re: NameError at /admin/ name 'HoleImage' is not defined
>
>Should it be this:
>
>from django.contrib import admin
>from holes.models import HoleImage
>
>class HoleImageInline(admin.TabularInline):
>model = HoleImage
>
>class HoleAdmin(admin.ModelAdmin):
>fields = ['hole_number', 'hole_name', 'hole_description']
>list_display = ['hole_number', 'hole_name', 'hole_description']
>inlines = [ HoleImageInline, ]
>
>admin.site.register(Hole)
>admin.site.register(HoleImage)
>
>
>
>or this:
>
>from django.contrib import admin
>from holes.models import HoleImage
>
>class HoleImageInline(admin.TabularInline):
>model = HoleImage
>
>class HoleAdmin(admin.ModelAdmin):
>fields = ['hole_number', 'hole_name', 'hole_description']
>list_display = ['hole_number', 'hole_name', 'hole_description']
>inlines = [ HoleImageInline, ]
>
>admin.site.register(Hole, HoleImages)
>
>
>Still have errors trying either, sorry again for noob questions.
>
>On Wednesday, June 11, 2014 9:45:10 PM UTC+1, Jorge Andrés Vergara Ebratt
>wrote:
>
>   When you import HoleImage don't remove Hole :)
>
>   On Jun 11, 2014 3:41 PM, "Patrick C"   >
>wrote:
>
>
>   Hi Jorge,
>
>   Thanks for helping out - I understand that and have just tried 
> it but still
>get the error:
>
>
>   NameError at /admin/
>
>   name 'Hole' is not defined
>Request Method:GET
>Request URL:   http://127.0.0.1:8000/admin/
>Django Version:1.6.5
>Exception Type:NameError
>Exception Value:   name 'Hole' is not defined
>Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
>in , line 12
>Python Executable:  /usr/bin/python
>Python Version:2.7.5
>
>
>   So just to clarify my structure incase I'm missing something on
>pluralisation:
>
>   holes
>   - admin.py
>   - model.py
>
>
>   models.py:
>
>   from django.db import models
>
>   class Hole(models.Model):
>   hole_number = models.IntegerField()
>   hole_name = models.CharField(max_length=255)
>   hole_description = models.CharField(max_length=500)
>
>   def __str__(self):
>   return self.hole_number
>
>   class HoleImage(models.Model):
>   hole = models.ForeignKey(Hole, related_name='images')
>   image = models.ImageField(upload_to='hole_photos')
>   caption = models.CharField(max_length=250)
>
>   admin.py:
>
>   from django.contrib import admin
>   from holes.models import HoleImage
>
>   class HoleImageInline(admin.TabularInline):
>   model = HoleImage
>
>   class HoleAdmin(admin.ModelAdmin):
>   fields = ['hole_number', 'hole_name', 'hole_description']
>   list_display = ['hole_number', 'hole_name', 
> 'hole_description']
>   inlines = [ HoleImageInline, ]
>
>   admin.site.register(Hole)
>
>
>
>   On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge Andrés 
> Vergara
>Ebratt wrote:
>
>   In admin.py you have
>
>   from hotels.models import Hole
>
>   Add HoleImage to that import
>
>   On Jun 11, 2014 3:19 PM, "Patrick C" 
> 
>wrote:
>
>
>   Hi All,
>
>   New to Django / Python (coming from PHP).
>
>   Trying to make a site for a golf course where 
> there is a hole
>by hole guide, each hole has a number, name, description then multiple images
>for the gallery.
>
>   I've spend the last few hours googling how I'm 
> going wrong
>here because I get the error in the subject line.
>
>   My models.py is:
>
>   from django.db import models
>
>
>   class Hole(models.Model):
>   hole_number = models.IntegerField()
>   hole_name = models.CharField(max_length=255)
>   hole_description = 
> models.CharField(max_length=500)
>
>
>   def __str__(self):
>   return 

Change settings.DEBUG in response to a request's source

2014-06-11 Thread Silas Snider
I'm writing an app where it'd be super helpful for logged-in users from my 
company to see error pages and the like as though the app was running with 
DEBUG=True, while still preventing ordinary users from seeing that output. 
I see that the docs strongly warn me against changing settings at runtime, 
so I was wondering how I could achieve the same effect?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7c979ac0-e8b9-4ea6-9e49-2205eeaccd90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Thanks Ilya,

I will go through that this evening - I tend to learn through hardship, 
banging my head off the wall, walking away and finding a moment of clarity, 
I'm quick to understand the logic and approach but I leant the language / 
syntax through repetition. 

On Wednesday, June 11, 2014 9:44:18 PM UTC+1, Ilya Kazakevich wrote:
>
> Hello, 
>
> I believe you should start with Python tutorial: 
> https://docs.python.org/2/tutorial/ 
> After you complete it, you may go to Django tutorial. 
>
> It is generally a good idea to study basic language concepts, syntax and 
> standard library before studying any framework (you've learned PHP _before_ 
> zend/phpcacke/joomla or wordpress, right?:) ) 
>
>
>
> Ilya Kazakevich, 
> JetBrains PyCharm (Best Python/Django IDE) 
> http://www.jetbrains.com/pycharm/ 
> "Develop with pleasure!" 
>
>
> >-Original Message- 
> >From: django...@googlegroups.com  
> >[mailto:django...@googlegroups.com ] On Behalf Of Patrick C 
> >Sent: Thursday, June 12, 2014 12:32 AM 
> >To: django...@googlegroups.com  
> >Cc: ilya.ka...@jetbrains.com  
> >Subject: Re: NameError at /admin/ name 'HoleImage' is not defined 
> > 
> >Hi Ilya, 
> > 
> >Thanks for the swift reply, sorry for the noob question but can you 
> elaborate on 
> >"but you forgot to import HoleImage" - I'm not quite following, I'm sure 
> I will 
> >understand it once explained. 
> > 
> >I'm only about 4 hours into my first workings with Python / Django, 
> perhaps I'm 
> >jumping in a little too quick but so far I have read through a fair bit 
> and live the 
> >prose. 
> > 
> >On Wednesday, June 11, 2014 9:26:30 PM UTC+1, Ilya Kazakevich wrote: 
> > 
> >To use any symbol (including " HoleImage" class) you need to 
> import it first. 
> >You've imported Hole (from holes.models import Hole), but you 
> forgot to 
> >import HoleImage. 
> >So, you got " name 'HoleImage' is not defined " error. 
> > 
> >It is better to use IDE, because it helps you in such cases :) 
> > 
> > 
> > 
> > 
> >Ilya Kazakevich, 
> >JetBrains PyCharm (Best Python/Django IDE) 
> >http://www.jetbrains.com/pycharm/ 
> > 
> >"Develop with pleasure!" 
> > 
> > 
> >>-Original Message- 
> >>From: django...@googlegroups.com  
> >>[mailto:django...@googlegroups.com  ] On Behalf Of 
> Patrick C 
> >>Sent: Thursday, June 12, 2014 12:19 AM 
> >>To: django...@googlegroups.com  
> >>Subject: NameError at /admin/ name 'HoleImage' is not defined 
> >> 
> >>Hi All, 
> >> 
> >>New to Django / Python (coming from PHP). 
> >> 
> >>Trying to make a site for a golf course where there is a hole by 
> hole guide, 
> >each 
> >>hole has a number, name, description then multiple images for 
> the 
> >gallery. 
> >> 
> >>I've spend the last few hours googling how I'm going wrong here 
> because I 
> >get 
> >>the error in the subject line. 
> >> 
> >>My models.py is: 
> >> 
> >>from django.db import models 
> >> 
> >> 
> >>class Hole(models.Model): 
> >>hole_number = models.IntegerField() 
> >>hole_name = models.CharField(max_length=255) 
> >>hole_description = models.CharField(max_length=500) 
> >> 
> >> 
> >>def __str__(self): 
> >>return self.hole_number 
> >> 
> >> 
> >>class HoleImage(models.Model): 
> >>hole = models.ForeignKey(Hole, related_name='images') 
> >>image = models.ImageField(upload_to='hole_photos') 
> >>caption = models.CharField(max_length=250) 
> >> 
> >> 
> >>and my admin.py is: 
> >> 
> >>from django.contrib import admin 
> >>from holes.models import Hole 
> >> 
> >> 
> >>class HoleImageInline(admin.TabularInline): 
> >>model = HoleImage 
> >> 
> >> 
> >>class HoleAdmin(admin.ModelAdmin): 
> >>fields = ['hole_number', 'hole_name', 'hole_description'] 
> >>list_display = ['hole_number', 'hole_name', 
> 'hole_description'] 
> >>inlines = [ HoleImageInline, ] 
> >> 
> >> 
> >>admin.site.register(Hole) 
> >> 
> >> 
> >> 
> >> 
> >>Full admin panel error is: 
> >> 
> >> 
> >> 
> >>NameError at /admin/ 
> >> 
> >>name 'HoleImage' is not defined 
> >>Request Method:GET 
> >>Request URL:http://127.0.0.1:8000/admin/ 
> > 
> >>Django Version:1.6.5 
> >>Exception Type:NameError 
> >>Exception Value:name 'HoleImage' is not defined 
> >>Exception Location: 
> 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Should it be this:

from django.contrib import admin
from holes.models import HoleImage

class HoleImageInline(admin.TabularInline):
model = HoleImage

class HoleAdmin(admin.ModelAdmin):
fields = ['hole_number', 'hole_name', 'hole_description']
list_display = ['hole_number', 'hole_name', 'hole_description']
inlines = [ HoleImageInline, ]

admin.site.register(Hole)
admin.site.register(HoleImage)



or this:

from django.contrib import admin
from holes.models import HoleImage

class HoleImageInline(admin.TabularInline):
model = HoleImage

class HoleAdmin(admin.ModelAdmin):
fields = ['hole_number', 'hole_name', 'hole_description']
list_display = ['hole_number', 'hole_name', 'hole_description']
inlines = [ HoleImageInline, ]

admin.site.register(Hole, HoleImages)


Still have errors trying either, sorry again for noob questions. 

On Wednesday, June 11, 2014 9:45:10 PM UTC+1, Jorge Andrés Vergara Ebratt 
wrote:
>
> When you import HoleImage don't remove Hole :)
> On Jun 11, 2014 3:41 PM, "Patrick C"  
> wrote:
>
>> Hi Jorge,
>>
>> Thanks for helping out - I understand that and have just tried it but 
>> still get the error:
>>
>> NameError at /admin/
>>
>> name 'Hole' is not defined
>>
>> Request Method:GET Request URL:http://127.0.0.1:8000/admin/ Django 
>> Version:1.6.5Exception Type: NameErrorException Value:
>>
>> name 'Hole' is not defined
>>
>> Exception Location: 
>> /Users/my_laptop/development/golfsmart/holes/admin.py in , line 
>> 12Python 
>> Executable: /usr/bin/pythonPython Version: 2.7.5
>>
>> So just to clarify my structure incase I'm missing something on 
>> pluralisation:
>>
>> holes
>> - admin.py
>> - model.py
>>
>>
>> *models.py:*
>>
>> from django.db import models
>>
>> class Hole(models.Model):
>> hole_number = models.IntegerField()
>> hole_name = models.CharField(max_length=255)
>> hole_description = models.CharField(max_length=500)
>>
>> def __str__(self):
>> return self.hole_number
>>
>> class HoleImage(models.Model):
>> hole = models.ForeignKey(Hole, related_name='images')
>> image = models.ImageField(upload_to='hole_photos')
>> caption = models.CharField(max_length=250)
>>
>> *admin.py:*
>>
>> from django.contrib import admin
>> from holes.models import HoleImage
>>
>> class HoleImageInline(admin.TabularInline):
>> model = HoleImage
>>
>> class HoleAdmin(admin.ModelAdmin):
>> fields = ['hole_number', 'hole_name', 'hole_description']
>> list_display = ['hole_number', 'hole_name', 'hole_description']
>> inlines = [ HoleImageInline, ]
>>
>> admin.site.register(Hole)
>>
>>
>>
>> On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge Andrés Vergara Ebratt 
>> wrote:
>>>
>>> In admin.py you have
>>>
>>> from hotels.models import Hole
>>>
>>> Add HoleImage to that import
>>> On Jun 11, 2014 3:19 PM, "Patrick C"  wrote:
>>>
 Hi All,

 New to Django / Python (coming from PHP).

 Trying to make a site for a golf course where there is a hole by hole 
 guide, each hole has a number, name, description then multiple images for 
 the gallery.

 I've spend the last few hours googling how I'm going wrong here because 
 I get the error in the subject line.

 My models.py is:

 from django.db import models

 *class Hole(models.Model):*
 *hole_number = models.IntegerField()*
 *hole_name = models.CharField(max_length=255)*
 *hole_description = models.CharField(max_length=500)*

 *def __str__(self):*
 *return self.hole_number*

 *class HoleImage(models.Model):*
  *hole = models.ForeignKey(Hole, related_name='images')*
 *image = models.ImageField(upload_to='hole_photos')*
 *caption = models.CharField(max_length=250)*


 and my admin.py is:

 *from django.contrib import admin*
 *from holes.models import Hole*

 *class HoleImageInline(admin.TabularInline):*
 *model = HoleImage*

 *class HoleAdmin(admin.ModelAdmin):*
 *fields = ['hole_number', 'hole_name', 'hole_description']*
 *list_display = ['hole_number', 'hole_name', 'hole_description']*
 *inlines = [ HoleImageInline, ]*

 *admin.site.register(Hole)*


 Full admin panel error is:

 NameError at /admin/

 name 'HoleImage' is not defined

 Request Method:GETRequest URL: http://127.0.0.1:8000/admin/Django 
 Version: 1.6.5Exception Type: NameErrorException Value:

 name 'HoleImage' is not defined

 Exception Location: /Users/my_laptop/development/golfsmart/holes/admin.py 
 in HoleImageInline, line 5Python Executable: /usr/bin/pythonPython 
 Version: 2.7.5


 As I say, I'm new to this and have had a good trial and error stab, I'm 
 sure it's something simple I am overlooking and once I have it resolved I 
 will have a lesson learned as I 

RE: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Ilya Kazakevich
Hello,

I believe you should start with Python tutorial: 
https://docs.python.org/2/tutorial/ 
After you complete it, you may go to Django tutorial.

It is generally a good idea to study basic language concepts, syntax and 
standard library before studying any framework (you've learned PHP _before_ 
zend/phpcacke/joomla or wordpress, right?:) )



Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"


>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of Patrick C
>Sent: Thursday, June 12, 2014 12:32 AM
>To: django-users@googlegroups.com
>Cc: ilya.kazakev...@jetbrains.com
>Subject: Re: NameError at /admin/ name 'HoleImage' is not defined
>
>Hi Ilya,
>
>Thanks for the swift reply, sorry for the noob question but can you elaborate 
>on
>"but you forgot to import HoleImage" - I'm not quite following, I'm sure I will
>understand it once explained.
>
>I'm only about 4 hours into my first workings with Python / Django, perhaps I'm
>jumping in a little too quick but so far I have read through a fair bit and 
>live the
>prose.
>
>On Wednesday, June 11, 2014 9:26:30 PM UTC+1, Ilya Kazakevich wrote:
>
>   To use any symbol (including " HoleImage" class) you need to import it 
> first.
>   You've imported Hole (from holes.models import Hole), but you forgot to
>import HoleImage.
>   So, you got " name 'HoleImage' is not defined " error.
>
>   It is better to use IDE, because it helps you in such cases :)
>
>
>
>
>   Ilya Kazakevich,
>   JetBrains PyCharm (Best Python/Django IDE)
>   http://www.jetbrains.com/pycharm/
>
>   "Develop with pleasure!"
>
>
>   >-Original Message-
>   >From: django...@googlegroups.com 
>   >[mailto:django...@googlegroups.com  ] On Behalf Of 
> Patrick C
>   >Sent: Thursday, June 12, 2014 12:19 AM
>   >To: django...@googlegroups.com 
>   >Subject: NameError at /admin/ name 'HoleImage' is not defined
>   >
>   >Hi All,
>   >
>   >New to Django / Python (coming from PHP).
>   >
>   >Trying to make a site for a golf course where there is a hole by hole 
> guide,
>each
>   >hole has a number, name, description then multiple images for the
>gallery.
>   >
>   >I've spend the last few hours googling how I'm going wrong here 
> because I
>get
>   >the error in the subject line.
>   >
>   >My models.py is:
>   >
>   >from django.db import models
>   >
>   >
>   >class Hole(models.Model):
>   >hole_number = models.IntegerField()
>   >hole_name = models.CharField(max_length=255)
>   >hole_description = models.CharField(max_length=500)
>   >
>   >
>   >def __str__(self):
>   >return self.hole_number
>   >
>   >
>   >class HoleImage(models.Model):
>   >hole = models.ForeignKey(Hole, related_name='images')
>   >image = models.ImageField(upload_to='hole_photos')
>   >caption = models.CharField(max_length=250)
>   >
>   >
>   >and my admin.py is:
>   >
>   >from django.contrib import admin
>   >from holes.models import Hole
>   >
>   >
>   >class HoleImageInline(admin.TabularInline):
>   >model = HoleImage
>   >
>   >
>   >class HoleAdmin(admin.ModelAdmin):
>   >fields = ['hole_number', 'hole_name', 'hole_description']
>   >list_display = ['hole_number', 'hole_name', 'hole_description']
>   >inlines = [ HoleImageInline, ]
>   >
>   >
>   >admin.site.register(Hole)
>   >
>   >
>   >
>   >
>   >Full admin panel error is:
>   >
>   >
>   >
>   >NameError at /admin/
>   >
>   >name 'HoleImage' is not defined
>   >Request Method:GET
>   >Request URL:http://127.0.0.1:8000/admin/
>
>   >Django Version:1.6.5
>   >Exception Type:NameError
>   >Exception Value:name 'HoleImage' is not defined
>   >Exception Location:
>/Users/my_laptop/development/golfsmart/holes/admin.py
>   >in HoleImageInline, line 5
>   >Python Executable:/usr/bin/python
>   >Python Version:2.7.5
>   >
>   >
>   >
>   >
>   >As I say, I'm new to this and have had a good trial and error stab, 
> I'm sure
>it's
>   >something simple I am overlooking and once I have it resolved I will 
> have
>a
>   >lesson learned as I have a few other apps to setup that will use this 
> many
>type
>   >for images.
>   >
>   >Thanks in advance.
>   >
>   >
>   >
>   >
>   >
>   >--
>   >You received this message because you are subscribed to the Google
>Groups
>   >"Django users" group.
>   >To unsubscribe from this group and stop receiving emails from it, send 
> 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Jorge Andrés Vergara Ebratt
Oh and in the last line, admin.site.register, use the model you want to
register in the Admin
On Jun 11, 2014 3:41 PM, "Patrick C"  wrote:

> Hi Jorge,
>
> Thanks for helping out - I understand that and have just tried it but
> still get the error:
>
> NameError at /admin/
>
> name 'Hole' is not defined
>
> Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
> 1.6.5Exception Type:NameErrorException Value:
>
> name 'Hole' is not defined
>
> Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
> in , line 12Python Executable:/usr/bin/pythonPython Version:2.7.5
>
> So just to clarify my structure incase I'm missing something on
> pluralisation:
>
> holes
> - admin.py
> - model.py
>
>
> *models.py:*
>
> from django.db import models
>
> class Hole(models.Model):
> hole_number = models.IntegerField()
> hole_name = models.CharField(max_length=255)
> hole_description = models.CharField(max_length=500)
>
> def __str__(self):
> return self.hole_number
>
> class HoleImage(models.Model):
> hole = models.ForeignKey(Hole, related_name='images')
> image = models.ImageField(upload_to='hole_photos')
> caption = models.CharField(max_length=250)
>
> *admin.py:*
>
> from django.contrib import admin
> from holes.models import HoleImage
>
> class HoleImageInline(admin.TabularInline):
> model = HoleImage
>
> class HoleAdmin(admin.ModelAdmin):
> fields = ['hole_number', 'hole_name', 'hole_description']
> list_display = ['hole_number', 'hole_name', 'hole_description']
> inlines = [ HoleImageInline, ]
>
> admin.site.register(Hole)
>
>
>
> On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge Andrés Vergara Ebratt
> wrote:
>>
>> In admin.py you have
>>
>> from hotels.models import Hole
>>
>> Add HoleImage to that import
>> On Jun 11, 2014 3:19 PM, "Patrick C"  wrote:
>>
>>> Hi All,
>>>
>>> New to Django / Python (coming from PHP).
>>>
>>> Trying to make a site for a golf course where there is a hole by hole
>>> guide, each hole has a number, name, description then multiple images for
>>> the gallery.
>>>
>>> I've spend the last few hours googling how I'm going wrong here because
>>> I get the error in the subject line.
>>>
>>> My models.py is:
>>>
>>> from django.db import models
>>>
>>> *class Hole(models.Model):*
>>> *hole_number = models.IntegerField()*
>>> *hole_name = models.CharField(max_length=255)*
>>> *hole_description = models.CharField(max_length=500)*
>>>
>>> *def __str__(self):*
>>> *return self.hole_number*
>>>
>>> *class HoleImage(models.Model):*
>>> *hole = models.ForeignKey(Hole, related_name='images')*
>>> *image = models.ImageField(upload_to='hole_photos')*
>>> *caption = models.CharField(max_length=250)*
>>>
>>>
>>> and my admin.py is:
>>>
>>> *from django.contrib import admin*
>>> *from holes.models import Hole*
>>>
>>> *class HoleImageInline(admin.TabularInline):*
>>> *model = HoleImage*
>>>
>>> *class HoleAdmin(admin.ModelAdmin):*
>>> *fields = ['hole_number', 'hole_name', 'hole_description']*
>>> *list_display = ['hole_number', 'hole_name', 'hole_description']*
>>> *inlines = [ HoleImageInline, ]*
>>>
>>> *admin.site.register(Hole)*
>>>
>>>
>>> Full admin panel error is:
>>>
>>> NameError at /admin/
>>>
>>> name 'HoleImage' is not defined
>>>
>>> Request Method:GETRequest URL: http://127.0.0.1:8000/admin/Django
>>> Version: 1.6.5Exception Type: NameErrorException Value:
>>>
>>> name 'HoleImage' is not defined
>>>
>>> Exception Location: /Users/my_laptop/development/golfsmart/holes/admin.py
>>> in HoleImageInline, line 5Python Executable: /usr/bin/pythonPython
>>> Version: 2.7.5
>>>
>>>
>>> As I say, I'm new to this and have had a good trial and error stab, I'm
>>> sure it's something simple I am overlooking and once I have it resolved I
>>> will have a lesson learned as I have a few other apps to setup that will
>>> use this many type for images.
>>>
>>> Thanks in advance.
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Jorge Andrés Vergara Ebratt
When you import HoleImage don't remove Hole :)
On Jun 11, 2014 3:41 PM, "Patrick C"  wrote:

> Hi Jorge,
>
> Thanks for helping out - I understand that and have just tried it but
> still get the error:
>
> NameError at /admin/
>
> name 'Hole' is not defined
>
> Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
> 1.6.5Exception Type:NameErrorException Value:
>
> name 'Hole' is not defined
>
> Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
> in , line 12Python Executable:/usr/bin/pythonPython Version:2.7.5
>
> So just to clarify my structure incase I'm missing something on
> pluralisation:
>
> holes
> - admin.py
> - model.py
>
>
> *models.py:*
>
> from django.db import models
>
> class Hole(models.Model):
> hole_number = models.IntegerField()
> hole_name = models.CharField(max_length=255)
> hole_description = models.CharField(max_length=500)
>
> def __str__(self):
> return self.hole_number
>
> class HoleImage(models.Model):
> hole = models.ForeignKey(Hole, related_name='images')
> image = models.ImageField(upload_to='hole_photos')
> caption = models.CharField(max_length=250)
>
> *admin.py:*
>
> from django.contrib import admin
> from holes.models import HoleImage
>
> class HoleImageInline(admin.TabularInline):
> model = HoleImage
>
> class HoleAdmin(admin.ModelAdmin):
> fields = ['hole_number', 'hole_name', 'hole_description']
> list_display = ['hole_number', 'hole_name', 'hole_description']
> inlines = [ HoleImageInline, ]
>
> admin.site.register(Hole)
>
>
>
> On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge Andrés Vergara Ebratt
> wrote:
>>
>> In admin.py you have
>>
>> from hotels.models import Hole
>>
>> Add HoleImage to that import
>> On Jun 11, 2014 3:19 PM, "Patrick C"  wrote:
>>
>>> Hi All,
>>>
>>> New to Django / Python (coming from PHP).
>>>
>>> Trying to make a site for a golf course where there is a hole by hole
>>> guide, each hole has a number, name, description then multiple images for
>>> the gallery.
>>>
>>> I've spend the last few hours googling how I'm going wrong here because
>>> I get the error in the subject line.
>>>
>>> My models.py is:
>>>
>>> from django.db import models
>>>
>>> *class Hole(models.Model):*
>>> *hole_number = models.IntegerField()*
>>> *hole_name = models.CharField(max_length=255)*
>>> *hole_description = models.CharField(max_length=500)*
>>>
>>> *def __str__(self):*
>>> *return self.hole_number*
>>>
>>> *class HoleImage(models.Model):*
>>> *hole = models.ForeignKey(Hole, related_name='images')*
>>> *image = models.ImageField(upload_to='hole_photos')*
>>> *caption = models.CharField(max_length=250)*
>>>
>>>
>>> and my admin.py is:
>>>
>>> *from django.contrib import admin*
>>> *from holes.models import Hole*
>>>
>>> *class HoleImageInline(admin.TabularInline):*
>>> *model = HoleImage*
>>>
>>> *class HoleAdmin(admin.ModelAdmin):*
>>> *fields = ['hole_number', 'hole_name', 'hole_description']*
>>> *list_display = ['hole_number', 'hole_name', 'hole_description']*
>>> *inlines = [ HoleImageInline, ]*
>>>
>>> *admin.site.register(Hole)*
>>>
>>>
>>> Full admin panel error is:
>>>
>>> NameError at /admin/
>>>
>>> name 'HoleImage' is not defined
>>>
>>> Request Method:GETRequest URL: http://127.0.0.1:8000/admin/Django
>>> Version: 1.6.5Exception Type: NameErrorException Value:
>>>
>>> name 'HoleImage' is not defined
>>>
>>> Exception Location: /Users/my_laptop/development/golfsmart/holes/admin.py
>>> in HoleImageInline, line 5Python Executable: /usr/bin/pythonPython
>>> Version: 2.7.5
>>>
>>>
>>> As I say, I'm new to this and have had a good trial and error stab, I'm
>>> sure it's something simple I am overlooking and once I have it resolved I
>>> will have a lesson learned as I have a few other apps to setup that will
>>> use this many type for images.
>>>
>>> Thanks in advance.
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Hi Jorge,

Thanks for helping out - I understand that and have just tried it but still 
get the error:

NameError at /admin/

name 'Hole' is not defined

Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.6.5Exception Type:NameErrorException Value:

name 'Hole' is not defined

Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py in 
, line 12Python Executable:/usr/bin/pythonPython Version:2.7.5

So just to clarify my structure incase I'm missing something on 
pluralisation:

holes
- admin.py
- model.py


*models.py:*

from django.db import models

class Hole(models.Model):
hole_number = models.IntegerField()
hole_name = models.CharField(max_length=255)
hole_description = models.CharField(max_length=500)

def __str__(self):
return self.hole_number

class HoleImage(models.Model):
hole = models.ForeignKey(Hole, related_name='images')
image = models.ImageField(upload_to='hole_photos')
caption = models.CharField(max_length=250)

*admin.py:*

from django.contrib import admin
from holes.models import HoleImage

class HoleImageInline(admin.TabularInline):
model = HoleImage

class HoleAdmin(admin.ModelAdmin):
fields = ['hole_number', 'hole_name', 'hole_description']
list_display = ['hole_number', 'hole_name', 'hole_description']
inlines = [ HoleImageInline, ]

admin.site.register(Hole)



On Wednesday, June 11, 2014 9:36:11 PM UTC+1, Jorge Andrés Vergara Ebratt 
wrote:
>
> In admin.py you have
>
> from hotels.models import Hole
>
> Add HoleImage to that import
> On Jun 11, 2014 3:19 PM, "Patrick C"  
> wrote:
>
>> Hi All,
>>
>> New to Django / Python (coming from PHP).
>>
>> Trying to make a site for a golf course where there is a hole by hole 
>> guide, each hole has a number, name, description then multiple images for 
>> the gallery.
>>
>> I've spend the last few hours googling how I'm going wrong here because I 
>> get the error in the subject line.
>>
>> My models.py is:
>>
>> from django.db import models
>>
>> *class Hole(models.Model):*
>> *hole_number = models.IntegerField()*
>> *hole_name = models.CharField(max_length=255)*
>> *hole_description = models.CharField(max_length=500)*
>>
>> *def __str__(self):*
>> *return self.hole_number*
>>
>> *class HoleImage(models.Model):*
>> *hole = models.ForeignKey(Hole, related_name='images')*
>> *image = models.ImageField(upload_to='hole_photos')*
>> *caption = models.CharField(max_length=250)*
>>
>>
>> and my admin.py is:
>>
>> *from django.contrib import admin*
>> *from holes.models import Hole*
>>
>> *class HoleImageInline(admin.TabularInline):*
>> *model = HoleImage*
>>
>> *class HoleAdmin(admin.ModelAdmin):*
>> *fields = ['hole_number', 'hole_name', 'hole_description']*
>> *list_display = ['hole_number', 'hole_name', 'hole_description']*
>> *inlines = [ HoleImageInline, ]*
>>
>> *admin.site.register(Hole)*
>>
>>
>> Full admin panel error is:
>>
>> NameError at /admin/
>>
>> name 'HoleImage' is not defined
>>
>> Request Method:GETRequest URL: http://127.0.0.1:8000/admin/Django 
>> Version: 1.6.5Exception Type: NameErrorException Value:
>>
>> name 'HoleImage' is not defined
>>
>> Exception Location: 
>> /Users/my_laptop/development/golfsmart/holes/admin.py in HoleImageInline, 
>> line 5Python Executable: /usr/bin/pythonPython Version: 2.7.5
>>
>>
>> As I say, I'm new to this and have had a good trial and error stab, I'm 
>> sure it's something simple I am overlooking and once I have it resolved I 
>> will have a lesson learned as I have a few other apps to setup that will 
>> use this many type for images.
>>
>> Thanks in advance.
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fca37d2a-b54f-4cec-af32-df5a6d1bfbdf%40googlegroups.com.
For more options, visit 

Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Jorge Andrés Vergara Ebratt
In admin.py you have

from hotels.models import Hole

Add HoleImage to that import
On Jun 11, 2014 3:19 PM, "Patrick C"  wrote:

> Hi All,
>
> New to Django / Python (coming from PHP).
>
> Trying to make a site for a golf course where there is a hole by hole
> guide, each hole has a number, name, description then multiple images for
> the gallery.
>
> I've spend the last few hours googling how I'm going wrong here because I
> get the error in the subject line.
>
> My models.py is:
>
> from django.db import models
>
> *class Hole(models.Model):*
> *hole_number = models.IntegerField()*
> *hole_name = models.CharField(max_length=255)*
> *hole_description = models.CharField(max_length=500)*
>
> *def __str__(self):*
> *return self.hole_number*
>
> *class HoleImage(models.Model):*
> *hole = models.ForeignKey(Hole, related_name='images')*
> *image = models.ImageField(upload_to='hole_photos')*
> *caption = models.CharField(max_length=250)*
>
>
> and my admin.py is:
>
> *from django.contrib import admin*
> *from holes.models import Hole*
>
> *class HoleImageInline(admin.TabularInline):*
> *model = HoleImage*
>
> *class HoleAdmin(admin.ModelAdmin):*
> *fields = ['hole_number', 'hole_name', 'hole_description']*
> *list_display = ['hole_number', 'hole_name', 'hole_description']*
> *inlines = [ HoleImageInline, ]*
>
> *admin.site.register(Hole)*
>
>
> Full admin panel error is:
>
> NameError at /admin/
>
> name 'HoleImage' is not defined
>
> Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
> 1.6.5Exception Type:NameErrorException Value:
>
> name 'HoleImage' is not defined
>
> Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
> in HoleImageInline, line 5Python Executable:/usr/bin/pythonPython Version:
> 2.7.5
>
>
> As I say, I'm new to this and have had a good trial and error stab, I'm
> sure it's something simple I am overlooking and once I have it resolved I
> will have a lesson learned as I have a few other apps to setup that will
> use this many type for images.
>
> Thanks in advance.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAeX05H1F0sX5_2LtaRjMb39gX8gT7YDNdFetGUCrK_xdNpkWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Hi Ilya,

Thanks for the swift reply, sorry for the noob question but can you 
elaborate on "but you forgot to import HoleImage" - I'm not quite 
following, I'm sure I will understand it once explained.

I'm only about 4 hours into my first workings with Python / Django, perhaps 
I'm jumping in a little too quick but so far I have read through a fair bit 
and live the prose. 

On Wednesday, June 11, 2014 9:26:30 PM UTC+1, Ilya Kazakevich wrote:
>
> To use any symbol (including " HoleImage" class) you need to import it 
> first. 
> You've imported Hole (from holes.models import Hole), but you forgot to 
> import HoleImage. 
> So, you got " name 'HoleImage' is not defined " error. 
>
> It is better to use IDE, because it helps you in such cases :) 
>
>
>
>
> Ilya Kazakevich, 
> JetBrains PyCharm (Best Python/Django IDE) 
> http://www.jetbrains.com/pycharm/ 
> "Develop with pleasure!" 
>
>
> >-Original Message- 
> >From: django...@googlegroups.com  
> >[mailto:django...@googlegroups.com ] On Behalf Of Patrick C 
> >Sent: Thursday, June 12, 2014 12:19 AM 
> >To: django...@googlegroups.com  
> >Subject: NameError at /admin/ name 'HoleImage' is not defined 
> > 
> >Hi All, 
> > 
> >New to Django / Python (coming from PHP). 
> > 
> >Trying to make a site for a golf course where there is a hole by hole 
> guide, each 
> >hole has a number, name, description then multiple images for the 
> gallery. 
> > 
> >I've spend the last few hours googling how I'm going wrong here because I 
> get 
> >the error in the subject line. 
> > 
> >My models.py is: 
> > 
> >from django.db import models 
> > 
> > 
> >class Hole(models.Model): 
> >hole_number = models.IntegerField() 
> >hole_name = models.CharField(max_length=255) 
> >hole_description = models.CharField(max_length=500) 
> > 
> > 
> >def __str__(self): 
> >return self.hole_number 
> > 
> > 
> >class HoleImage(models.Model): 
> >hole = models.ForeignKey(Hole, related_name='images') 
> >image = models.ImageField(upload_to='hole_photos') 
> >caption = models.CharField(max_length=250) 
> > 
> > 
> >and my admin.py is: 
> > 
> >from django.contrib import admin 
> >from holes.models import Hole 
> > 
> > 
> >class HoleImageInline(admin.TabularInline): 
> >model = HoleImage 
> > 
> > 
> >class HoleAdmin(admin.ModelAdmin): 
> >fields = ['hole_number', 'hole_name', 'hole_description'] 
> >list_display = ['hole_number', 'hole_name', 'hole_description'] 
> >inlines = [ HoleImageInline, ] 
> > 
> > 
> >admin.site.register(Hole) 
> > 
> > 
> > 
> > 
> >Full admin panel error is: 
> > 
> > 
> > 
> >NameError at /admin/ 
> > 
> >name 'HoleImage' is not defined 
> >Request Method:GET 
> >Request URL:http://127.0.0.1:8000/admin/ 
> >Django Version:1.6.5 
> >Exception Type:NameError 
> >Exception Value:name 'HoleImage' is not defined 
> >Exception 
> Location:/Users/my_laptop/development/golfsmart/holes/admin.py 
> >in HoleImageInline, line 5 
> >Python Executable:/usr/bin/python 
> >Python Version:2.7.5 
> > 
> > 
> > 
> > 
> >As I say, I'm new to this and have had a good trial and error stab, I'm 
> sure it's 
> >something simple I am overlooking and once I have it resolved I will have 
> a 
> >lesson learned as I have a few other apps to setup that will use this 
> many type 
> >for images. 
> > 
> >Thanks in advance. 
> > 
> > 
> > 
> > 
> > 
> >-- 
> >You received this message because you are subscribed to the Google Groups 
> >"Django users" group. 
> >To unsubscribe from this group and stop receiving emails from it, send an 
> email 
> >to django-users...@googlegroups.com . 
> >To post to this group, send email to django...@googlegroups.com 
> . 
> >Visit this group at http://groups.google.com/group/django-users. 
> >To view this discussion on the web visit 
> >
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f9 
> >53ad105f8%40googlegroups.com 
> ><
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f 
> >953ad105f8%40googlegroups.com?utm_medium=email_source=footer> . 
> >For more options, visit https://groups.google.com/d/optout. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7b136ef-2763-4b8c-929a-f3d17751cd0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Jorge Andrés Vergara Ebratt
You need to import HoleImage in admin.py
On Jun 11, 2014 3:19 PM, "Patrick C"  wrote:

> Hi All,
>
> New to Django / Python (coming from PHP).
>
> Trying to make a site for a golf course where there is a hole by hole
> guide, each hole has a number, name, description then multiple images for
> the gallery.
>
> I've spend the last few hours googling how I'm going wrong here because I
> get the error in the subject line.
>
> My models.py is:
>
> from django.db import models
>
> *class Hole(models.Model):*
> *hole_number = models.IntegerField()*
> *hole_name = models.CharField(max_length=255)*
> *hole_description = models.CharField(max_length=500)*
>
> *def __str__(self):*
> *return self.hole_number*
>
> *class HoleImage(models.Model):*
> *hole = models.ForeignKey(Hole, related_name='images')*
> *image = models.ImageField(upload_to='hole_photos')*
> *caption = models.CharField(max_length=250)*
>
>
> and my admin.py is:
>
> *from django.contrib import admin*
> *from holes.models import Hole*
>
> *class HoleImageInline(admin.TabularInline):*
> *model = HoleImage*
>
> *class HoleAdmin(admin.ModelAdmin):*
> *fields = ['hole_number', 'hole_name', 'hole_description']*
> *list_display = ['hole_number', 'hole_name', 'hole_description']*
> *inlines = [ HoleImageInline, ]*
>
> *admin.site.register(Hole)*
>
>
> Full admin panel error is:
>
> NameError at /admin/
>
> name 'HoleImage' is not defined
>
> Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
> 1.6.5Exception Type:NameErrorException Value:
>
> name 'HoleImage' is not defined
>
> Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
> in HoleImageInline, line 5Python Executable:/usr/bin/pythonPython Version:
> 2.7.5
>
>
> As I say, I'm new to this and have had a good trial and error stab, I'm
> sure it's something simple I am overlooking and once I have it resolved I
> will have a lesson learned as I have a few other apps to setup that will
> use this many type for images.
>
> Thanks in advance.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAeX05HKSUjsYNzRevcM%2BEvbBomdEhZpd_%3Dytr5SmPquRF8QGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Ilya Kazakevich
To use any symbol (including " HoleImage" class) you need to import it first. 
You've imported Hole (from holes.models import Hole), but you forgot to import 
HoleImage.
So, you got " name 'HoleImage' is not defined " error.

It is better to use IDE, because it helps you in such cases :)




Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"


>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of Patrick C
>Sent: Thursday, June 12, 2014 12:19 AM
>To: django-users@googlegroups.com
>Subject: NameError at /admin/ name 'HoleImage' is not defined
>
>Hi All,
>
>New to Django / Python (coming from PHP).
>
>Trying to make a site for a golf course where there is a hole by hole guide, 
>each
>hole has a number, name, description then multiple images for the gallery.
>
>I've spend the last few hours googling how I'm going wrong here because I get
>the error in the subject line.
>
>My models.py is:
>
>from django.db import models
>
>
>class Hole(models.Model):
>hole_number = models.IntegerField()
>hole_name = models.CharField(max_length=255)
>hole_description = models.CharField(max_length=500)
>
>
>def __str__(self):
>return self.hole_number
>
>
>class HoleImage(models.Model):
>hole = models.ForeignKey(Hole, related_name='images')
>image = models.ImageField(upload_to='hole_photos')
>caption = models.CharField(max_length=250)
>
>
>and my admin.py is:
>
>from django.contrib import admin
>from holes.models import Hole
>
>
>class HoleImageInline(admin.TabularInline):
>model = HoleImage
>
>
>class HoleAdmin(admin.ModelAdmin):
>fields = ['hole_number', 'hole_name', 'hole_description']
>list_display = ['hole_number', 'hole_name', 'hole_description']
>inlines = [ HoleImageInline, ]
>
>
>admin.site.register(Hole)
>
>
>
>
>Full admin panel error is:
>
>
>
>NameError at /admin/
>
>name 'HoleImage' is not defined
>Request Method:GET
>Request URL:   http://127.0.0.1:8000/admin/
>Django Version:1.6.5
>Exception Type:NameError
>Exception Value:   name 'HoleImage' is not defined
>Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py
>in HoleImageInline, line 5
>Python Executable: /usr/bin/python
>Python Version:2.7.5
>
>
>
>
>As I say, I'm new to this and have had a good trial and error stab, I'm sure 
>it's
>something simple I am overlooking and once I have it resolved I will have a
>lesson learned as I have a few other apps to setup that will use this many type
>for images.
>
>Thanks in advance.
>
>
>
>
>
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email
>to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f9
>53ad105f8%40googlegroups.com
>953ad105f8%40googlegroups.com?utm_medium=email_source=footer> .
>For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00c601cf85b3%24568dd690%2403a983b0%24%40JetBrains.com.
For more options, visit https://groups.google.com/d/optout.


NameError at /admin/ name 'HoleImage' is not defined

2014-06-11 Thread Patrick C
Hi All,

New to Django / Python (coming from PHP).

Trying to make a site for a golf course where there is a hole by hole 
guide, each hole has a number, name, description then multiple images for 
the gallery.

I've spend the last few hours googling how I'm going wrong here because I 
get the error in the subject line.

My models.py is:

from django.db import models

*class Hole(models.Model):*
*hole_number = models.IntegerField()*
*hole_name = models.CharField(max_length=255)*
*hole_description = models.CharField(max_length=500)*

*def __str__(self):*
*return self.hole_number*

*class HoleImage(models.Model):*
*hole = models.ForeignKey(Hole, related_name='images')*
*image = models.ImageField(upload_to='hole_photos')*
*caption = models.CharField(max_length=250)*


and my admin.py is:

*from django.contrib import admin*
*from holes.models import Hole*

*class HoleImageInline(admin.TabularInline):*
*model = HoleImage*

*class HoleAdmin(admin.ModelAdmin):*
*fields = ['hole_number', 'hole_name', 'hole_description']*
*list_display = ['hole_number', 'hole_name', 'hole_description']*
*inlines = [ HoleImageInline, ]*

*admin.site.register(Hole)*


Full admin panel error is:

NameError at /admin/

name 'HoleImage' is not defined

Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.6.5Exception Type:NameErrorException Value:

name 'HoleImage' is not defined

Exception Location:/Users/my_laptop/development/golfsmart/holes/admin.py in 
HoleImageInline, line 5Python Executable:/usr/bin/pythonPython Version:2.7.5


As I say, I'm new to this and have had a good trial and error stab, I'm 
sure it's something simple I am overlooking and once I have it resolved I 
will have a lesson learned as I have a few other apps to setup that will 
use this many type for images.

Thanks in advance.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f953ad105f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: execute a code at a particular date and time (aperidic task) in django

2014-06-11 Thread Rini Michael
Thank you Javier


On Tue, Jun 10, 2014 at 6:47 PM, Javier Guerra Giraldez 
wrote:

> On Tue, Jun 10, 2014 at 6:43 AM, Rini Michael 
> wrote:
> > Thanks for your reply,i have been looking into celery as well,but i found
> > that celery is used for periodic task and i am looking to execute
> aperiodic
> > task.please correct me if i am wrong
>
>
> check the T.apply_async(eta=) option [1]
>
>
> [1]: http://docs.celeryproject.org/en/latest/userguide/calling.html#id3
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFkDaoTVAe9HPXaotJUNL%3DNgFVH5_yEqaLJNbbWhgfhMCTDjhw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFoY06sO76BSZuwY3avKcsYmJ5VnqSfVB9zNv8QZ-Kc12%3DwkKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: implementing a ticket submission system

2014-06-11 Thread Ilya Kazakevich
Hello,

Use Primary Key: 
https://docs.djangoproject.com/en/dev/topics/db/models/#automatic-primary-key-fields


Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"


>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of Anurag Baidyanath
>Sent: Wednesday, June 11, 2014 10:06 PM
>To: django-users@googlegroups.com
>Subject: implementing a ticket submission system
>
>i am implementing a ticket submission system whose model.py file looks loke
>this:
>class Ticket(models.Model):
>user_id=models.ForeignKey(User)
>category_id=models.ForeignKey(Category)
>subject=models.CharField(max_length=100)
>message=models.TextField(help_text="enter message")
>ticket_id=models.IntegerField(help_text="enter tid",unique=True)
>created_date_time=models.DateTimeField(auto_now_add=True)
>overdue_date_time=models.DateTimeField(auto_now_add=True)
>closed_date_time=models.DateTimeField(auto_now_add=True)
>status=models.IntegerField(help_text="enter status",default=0)
>reopened_date_time=models.DateTimeField(auto_now_add=True)
>topic_priority=models.IntegerField(help_text="enter priority",default=1)
>duration_for_reply=models.IntegerField(help_text="enter duration for
>reply",default=24)
>
>i need to take the data submitted by the user(message and subject); and
>generate the ticket_id dynamically for each ticket. Then the data has to be 
>saved
>into the database. please suggest an approach for this.
>
>
>
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email
>to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/557b5a43-536b-4051-b80c-13f
>006a688dd%40googlegroups.com
>3f006a688dd%40googlegroups.com?utm_medium=email_source=footer> .
>For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00bf01cf85a0%246db7d720%2449278560%24%40JetBrains.com.
For more options, visit https://groups.google.com/d/optout.


implementing a ticket submission system

2014-06-11 Thread Anurag Baidyanath
i am implementing a ticket submission system whose model.py file looks loke 
this:
class Ticket(models.Model):
user_id=models.ForeignKey(User)
category_id=models.ForeignKey(Category)
subject=models.CharField(max_length=100)
message=models.TextField(help_text="enter message")
ticket_id=models.IntegerField(help_text="enter tid",unique=True)
created_date_time=models.DateTimeField(auto_now_add=True)
overdue_date_time=models.DateTimeField(auto_now_add=True)
closed_date_time=models.DateTimeField(auto_now_add=True)
status=models.IntegerField(help_text="enter status",default=0)
reopened_date_time=models.DateTimeField(auto_now_add=True)
topic_priority=models.IntegerField(help_text="enter priority",default=1)
duration_for_reply=models.IntegerField(help_text="enter duration for 
reply",default=24)

i need to take the data submitted by the user(message and subject); and 
generate the ticket_id dynamically for each ticket. Then the data has to be 
saved into the database. please suggest an approach for this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/557b5a43-536b-4051-b80c-13f006a688dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Javascript

2014-06-11 Thread Cal Leeming [Simplicity Media Ltd]
This is quite an open ended question, and touches on the subject of asset
pipelines.

This also touches on the whole debate around how JS applications should be
developed, libraries such as Ansible and Backbone may impact your
style/preference.

The closest library I've seen so far is django-pipeline, but it doesn't
have support for requirejs, there was also another discussion relating to
this topic [1].

For example, the rules of decoupling still apply, if the JS is not linked
to the site HTML in anyway (e.g. REST API) then you would ideally keep this
in a separate repo and use whatever asset pipeline suited you best. However
if your JS is closely coupled to your site HTML, then this would probably
stay inside your Django static.

It really depends on how complex your JS application is, for simple
requirements django-pipeline will do just fine. The best advice I can give
would be to research all the different options, and decide which is best
for your specific use case and tastes.

Hope this helps

Cal

[1] https://groups.google.com/forum/#!topic/requirejs/gDczhOVuYdc


On Wed, Jun 11, 2014 at 4:59 PM, César García Tapia 
wrote:

> Not really. I'm not looking for an answer to a specific question. I'm just
> looking for a "good practices manual" on writing and deploying javascript
> in a django environment.
>
>
>
> El miércoles, 11 de junio de 2014 17:41:45 UTC+2, Cal Leeming [Simplicity
> Media Ltd] escribió:
>>
>> Have a look at how Stripe do it [1].
>>
>> https://js.stripe.com/v2/";>
>> Stripe.setPublishableKey('YOUR_PUBLISHABLE_KEY');
>>
>> I think this is what you're asking for (if I've understood your question
>> correctly).
>>
>> Cal
>>
>> [1] https://stripe.com/docs/stripe.js
>>
>>
>>
>> On Wed, Jun 11, 2014 at 4:22 PM, César García Tapia 
>> wrote:
>>
>>> Hi.
>>>
>>> Probably this is an old subject, and it's been argued lots of times, but
>>> I guess I need some help to find the right resources.
>>>
>>> When building a real-world django application, you need javascript. Lots
>>> of it. Making JS talk to django is more or less easy: $.ajax(),
>>> django-rest-framework, and you're done. The problem comes when you need
>>> Django talking to JS. You need this variable initialized with some View
>>> context value, or init the i18n of that plugin with the {{ LANGUAGE_CODE
>>> }}, or whatever. There are a thousand cases that are on everybody's mind.
>>>
>>> The obvious way is to add a 

Re: Django and Javascript

2014-06-11 Thread César García Tapia
Not really. I'm not looking for an answer to a specific question. I'm just 
looking for a "good practices manual" on writing and deploying javascript 
in a django environment.



El miércoles, 11 de junio de 2014 17:41:45 UTC+2, Cal Leeming [Simplicity 
Media Ltd] escribió:
>
> Have a look at how Stripe do it [1].
>
> https://js.stripe.com/v2/";>
> Stripe.setPublishableKey('YOUR_PUBLISHABLE_KEY');
>
> I think this is what you're asking for (if I've understood your question 
> correctly).
>
> Cal
>
> [1] https://stripe.com/docs/stripe.js
>
>
>
> On Wed, Jun 11, 2014 at 4:22 PM, César García Tapia  > wrote:
>
>> Hi.
>>
>> Probably this is an old subject, and it's been argued lots of times, but 
>> I guess I need some help to find the right resources.
>>
>> When building a real-world django application, you need javascript. Lots 
>> of it. Making JS talk to django is more or less easy: $.ajax(), 
>> django-rest-framework, and you're done. The problem comes when you need 
>> Django talking to JS. You need this variable initialized with some View 
>> context value, or init the i18n of that plugin with the {{ LANGUAGE_CODE 
>> }}, or whatever. There are a thousand cases that are on everybody's mind.
>>
>> The obvious way is to add a 

Re: Massive import in Django database

2014-06-11 Thread moqianc...@gmail.com
Hi, John:
I think your code is right, except "Doc.object" should be "Doc.objects";

The following pseudo code maybe fater than what you write:

doc_map = {}
for each xml:
extract from the xml data -> mydoc_code, mydoc_text, myRelated_doc_codes
doc = Doc.objects.create(doc_code=mydoc_code, doc_text=mydoc_text)
doc_map[mydoc_code] = (doc, myRelated_doc_codes)
for (doc, rcodes) in doc_map.values():
for rcode in rcodes:
doc.related_doc.add(doc_map[rcode])
doc.save()

I have checked, It's okay;
The object have be cached in doc_map, and no need re-query related_codes for 
related_doc from database,  the speed should speed up.

With Regards.




moqianc...@gmail.com

From: John Carlo
Date: 2014-06-11 21:14
To: django-users
Subject: Massive import in Django database
Hello everybody,


I've fallen in love with Django two years ago and I've been using it for my job 
projects. In the past I found very useful information in this group, so a big 
thank you guys!


I have a little doubt.
I have to import in Django db (sqlite for local development, mySql on the 
server) about 1.000.000 xml documents.


The model class is the following:


class Doc(models.Model):
doc_code =  models.CharField(max_length=20, unique=True, primary_key=True, 
db_index = True) 

doc_text = models.TextField(null=True, blank=True) 
related_doc= models.ManyToManyField('self', null=True, blank=True, db_index 
= True) 



>From what I know bulk insertion is not possibile because I have a 
>ManyToManyField relation.


So I have this simple loop (in pseudo code)


for each xml:
   extract from the xml  date-> mydoc_code, mydoc_text, myRelated_doc_codes


   myDoc = Doc.object.get_or_create(doc_code = mydoc_code)[0]
   myDoc.doc_text = mydoc_text
   
   for reldoc_code in myRelated_doc_codes:
myRelDoc =  Doc.object.get_or_create(doc_code = reldoc_code )[0]
myDoc.related_doc.add(myRelDoc )


  myDoc.save()




I'm doing it right? Do you have some suggestions, recommendation? I fear that 
since I have 1.000.000 docs to import, it will take a lt of time, 
especially during the get_or_create routines


thank you in advance everybody!


John








 
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b88deaf-d806-4a64-9e8d-528d95599c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2014061123474049956470%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Javascript

2014-06-11 Thread Cal Leeming [Simplicity Media Ltd]
Have a look at how Stripe do it [1].

https://js.stripe.com/v2/";>
Stripe.setPublishableKey('YOUR_PUBLISHABLE_KEY');

I think this is what you're asking for (if I've understood your question
correctly).

Cal

[1] https://stripe.com/docs/stripe.js



On Wed, Jun 11, 2014 at 4:22 PM, César García Tapia 
wrote:

> Hi.
>
> Probably this is an old subject, and it's been argued lots of times, but I
> guess I need some help to find the right resources.
>
> When building a real-world django application, you need javascript. Lots
> of it. Making JS talk to django is more or less easy: $.ajax(),
> django-rest-framework, and you're done. The problem comes when you need
> Django talking to JS. You need this variable initialized with some View
> context value, or init the i18n of that plugin with the {{ LANGUAGE_CODE
> }}, or whatever. There are a thousand cases that are on everybody's mind.
>
> The obvious way is to add a 

Django and Javascript

2014-06-11 Thread César García Tapia
Hi.

Probably this is an old subject, and it's been argued lots of times, but I 
guess I need some help to find the right resources.

When building a real-world django application, you need javascript. Lots of 
it. Making JS talk to django is more or less easy: $.ajax(), 
django-rest-framework, and you're done. The problem comes when you need 
Django talking to JS. You need this variable initialized with some View 
context value, or init the i18n of that plugin with the {{ LANGUAGE_CODE 
}}, or whatever. There are a thousand cases that are on everybody's mind.

The obvious way is to add a 

Re: django installation

2014-06-11 Thread Bill Freeman
Still, the OP's command should have worked.  The most likely problem is
that Django was installed to a different python than the one  he gets when
he types "python" at the shell.  He does not say how he installed Django,
so it is hard to advise.


On Wed, Jun 11, 2014 at 6:23 AM, Daniel Roseman 
wrote:

> On Wednesday, 11 June 2014 11:00:38 UTC+1, Srinivas Reddy T wrote:
>>
>> There is no need to install virtualenv to install Django.
>>
> While this is technically correct, it is not good advice to give to a
> newbie. Experienced developers should be encouraging best practice among
> newcomers, and to be honest there really isn't a good reason *not* to use
> virtualenv.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/da3adcf3-de91-4727-8b3e-7c8613112574%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0tNCa9xB0A7Dv31jOFXi_U0MA0-St93pn3TQpYKD%2BMzFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Empty Javascript translation array

2014-06-11 Thread Alexandr Berdnikov
It's been quite a while since 2009 but I'm really curious if you solved 
this problem :)
I'm currently experiencing same issue and didn't find any answers\tips so 
far.

On Tuesday, January 20, 2009 10:57:47 PM UTC+2, Scott wrote:
>
> Hi there, 
>
> I've just got the JS catalogs working on my AppEngine/Django project, 
> and can access the JS library just fine, but the 'catalog' array is 
> empty. 
>
> I have created the djangojs.po files and populated them with the ID/ 
> MSG pairs that I need, but nothing appears in the JS. 
>
> I'm wondering if it's a project structure (package) issue, has anyone 
> worked on an AppEngine/Django project that could shed some light on 
> this for me? 
>
> Currently I have my models/urls/views in a folder under the project 
> root, with the locale folder also directly under project root. 
>
> Does the locale folder need to be in the same folder as the models/ 
> urls/views? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6266809-7518-436f-adcb-302baad8e9cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


LiveServerTestCase modifies production database when ran in python script

2014-06-11 Thread yakkadesign
When I run my tests in a python script it modifies my production database.  
If I run from the command line it doesn't.  When I say modify, it wipes out 
my existing users and replaces them with the users I create for testing.  

I followed this for the setup: 
https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.LiveServerTestCase
I created a  to setup users.  

When I run this the production database isn't modified:
  python2.7 manage.py test yPayment

In my python script I have:
  from django.utils import unittest
  class yPaymentTest(LiveServerTestCase)
  ...
  suite_payment = unittest.TestLoader().loadTestsFromTestCase(yPaymentTest)
  unittest.TextTestRunner(verbosity=2).run(suite_payment)

Here is the full output from the command line
[brian@centos-dv7 yPaymentProj]$ 
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/bin/python2.7
 
manage.py test yPayment
Creating test database for alias 'default'...
Traceback (most recent call last):
  File "/usr/local/python2.7/lib/python2.7/wsgiref/handlers.py", line 85, 
in run
self.result = application(self.environ, self.start_response)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
 
line 67, in __call__
return self.application(environ, start_response)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
 
line 67, in __call__
return self.application(environ, start_response)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
 
line 241, in __call__
response = self.get_response(request)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/core/handlers/base.py",
 
line 151, in get_response
response = self.handle_uncaught_exception(request, resolver, 
sys.exc_info())
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/core/handlers/base.py",
 
line 226, in handle_uncaught_exception
return callback(request, **param_dict)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/utils/decorators.py",
 
line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/views/defaults.py",
 
line 32, in server_error
t = loader.get_template(template_name) # You need to create a 500.html 
template.
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/template/loader.py",
 
line 145, in get_template
template, origin = find_template(template_name)
  File 
"/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/template/loader.py",
 
line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: 500.html
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2014-06-08 
22:54:32.927908) while time zone support is active.
  RuntimeWarning)
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2014-06-08 
22:54:32.927916) while time zone support is active.
  RuntimeWarning)
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2014-06-08 
22:54:34.690671) while time zone support is active.
  RuntimeWarning)
.sss
--
Ran 4 tests in 12.259s

OK (skipped=3)
Destroying test database for alias 'default'...



Here is the output from the python script.   
test_custom_admin_add_card (__main__.yPaymentTest) ... 
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2014-06-08 
22:57:54.016573) while time zone support is active.
  RuntimeWarning)
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2014-06-08 
22:57:54.016584) while time zone support is active.
  RuntimeWarning)
/usr/local/python2.7/lib/python2.7/site-packages/virt_env/django1p4/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive 

Re: distinct().filter() applies filter before distinct

2014-06-11 Thread Derek
It might be worth comparing the SQL that Django generates versus what you 
would write (or want to write) by hand:

MyModel.objects.all().query.sql_with_params()

On Tuesday, 10 June 2014 23:17:30 UTC+2, John Rambo wrote:
>
> This better illustrates what I mean:
>
>
> Example.objects.order_by('a','foreignkey__b').distinct('a').filter(foreignkey__b='something')
>
> On Tuesday, June 10, 2014 4:06:50 PM UTC-5, John Rambo wrote:
>>
>> If we chain a call to filter() after a call to distinct(), the filter is 
>> applied to the query before the distinct. How do I filter the results of a 
>> query *after* applying distinct?
>>
>> Example.objects.order_by('a','b').distinct('a').filter(b='something)
>>
>> The where clause in the SQL resulting from filter() means the filter is 
>> applied to the query before the distinct. I want to filter the queryset 
>> resulting from the distinct.
>>
>> This is probably pretty easy, but I just can't quite figure it out and I 
>> can't find anything on it.
>>
>> Another way to ask the question is how do I return a distinct QuerySet 
>> and then filter it?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/475bed36-5b8e-4892-8e3b-7023913749cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


simple comparison?

2014-06-11 Thread MikeKJ
if userform.is_valid():
name = userform.cleaned_data['name']
email = userform.cleaned_data['email']
username = userform.cleaned_data['username']
password = userform.cleaned_data['password']
orgs = Organisation.objects.all()

#return render_to_response("userprofile/join_form.html", 
{'orgs': orgs, 'name': name, 'controls': controls, 'userform': userform, 
},context_instance=RequestContext(request))

for x in orgs:
if x.title == name:   
return render_to_response("userprofile/join_form.html", 
{'name': name, 'controls': controls, 'userform': userform, 
},context_instance=RequestContext(request))
else:
raise NameError("Missed")

This bit ... if x.title == name:   simple huh?

if I run the same in a shell,
 
>>> from directory.models import Organisation
>>> name = "ANORG"
>>>orgs = Organisation.objects.all()
>>>for x in orgs:
>>>if x.title == name:
>>>name

that works

if I uncomment the render to response and do it in the template,
   
{% for x in orgs %}
{% ifequal x.title name %}
 {{ x.title }}
{% endifequal %}
{% endfor %}

that works

but for the life of me I cant see why in the actual view it decides that 
there is no match and goes to the else, it shouldn't, it should find a 
match!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/245e8702-6483-4cd8-b526-68c8fbac0a4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Django Python roop

2014-06-11 Thread Javier Guerra Giraldez
On Wed, Jun 11, 2014 at 8:12 AM, moqianc...@gmail.com
 wrote:
> write right code, write clean code,  It's a basic rule for our develope
> work.


for that you have to learn what the code means.  "while x !=[]:" will
always be an endless loop.  the "[]" doesn't do what you think.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoR%2B4Ho8EBOJXs1eyn0NrrJGhfBa%2Bke7RSMT4Q4dut_LOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread hito koto
Ok, thank you!

2014年6月11日水曜日 21時52分54秒 UTC+9 Qiancong:
>
>  
> Hi, hito koto:
> I think  the problems you asked should be post in python-lang mail-list. 
> For python program,  I prefer "for", not "while";  It's more simpler.
> But  if you like while, I think the following code maybe helpful:
>  
> *def fff(x):*
> *y = []*
> *i = 0*
> *xlen = len(x)*
> *while i< xlen:*
> *y.append(x[i])*
> *i += 1*
> *return y*
>  
> but I more like the follow writing:
> *def fff(x):*
> *return x[:]*
>  
> or you just do as following:
> *y  = x[:]*
>  
> python is a power & beautiful language,   
> please read the  https://docs.python.org/2/tutorial/ at first like 
>  François said.
>  
> With Regards.
>  
> --
>  moqia...@gmail.com 
>  
>  *From:* hito koto 
> *Date:* 2014-06-11 19:21
> *To:* django-users 
> *Subject:* Django Python roop
>  Hello, all
>
> I want to change to while statement from for statement, so how can i do 
> to?
>
> this is my correct for statement codes:
>
> def fff(x):
> y = []
> for i in range(len(x)):
> y.append(x[i])
> return y
>
> and i want change to while statement 
>
> So, this code have erroes:
> TypeError: list indices must be integers, not list
> def fff(x):
> y = []
> while x !=[]:
>for i in x:
>y.append(x[i])
> return y
>
> -- 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce0d9d2a-4b22-4126-8802-b085daa3bcec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread Erik Cederstrand
Den 11/06/2014 kl. 14.49 skrev hito koto :

> MemoryError , Why? idon't know.
> I try this have Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 5, in foo
> MemoryError errors:  
> 
> I'm change to this code: have the Memory Error,
> 
> def foo(x):
> y = []
> while x != []:
> for i in range(len(x)):
> y.append(x[i])
> return y

Your function doesn't modify "x", so "x != []" is always true. You created an 
endless loop which appends "y" until memory is exhausted. Hence the MemoryError.

These aren't Django-specific questions anymore, so you should head over to a 
Python mailing list to get further help with basic Python programming.

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CC989AD0-05AB-4DF5-972E-8B0347009F8B%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Massive import in Django database

2014-06-11 Thread John Carlo
Hello everybody,

I've fallen in love with Django two years ago and I've been using it for my 
job projects. In the past I found very useful information in this group, so 
a big thank you guys!

I have a little doubt.
I have to import in Django db (sqlite for local development, mySql on the 
server) about 1.000.000 xml documents.

The model class is the following:

class Doc(models.Model):
doc_code =  models.CharField(max_length=20, unique=True, 
primary_key=True, db_index = True) 
doc_text = models.TextField(null=True, blank=True) 
related_doc= models.ManyToManyField('self', null=True, blank=True, 
db_index = True) 

>From what I know bulk insertion is not possibile because I have a 
ManyToManyField relation.

So I have this simple loop (in pseudo code)

for each xml:
   extract from the xml  date-> mydoc_code, mydoc_text, myRelated_doc_codes

   myDoc = Doc.object.get_or_create(doc_code = mydoc_code)[0]
   myDoc.doc_text = mydoc_text
   
   for reldoc_code in myRelated_doc_codes:
myRelDoc =  Doc.object.get_or_create(doc_code = reldoc_code )[0]
myDoc.related_doc.add(myRelDoc )

  myDoc.save()


I'm doing it right? Do you have some suggestions, recommendation? I fear 
that since I have 1.000.000 docs to import, it will take a lt of time, 
especially during the get_or_create routines

thank you in advance everybody!

John




 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b88deaf-d806-4a64-9e8d-528d95599c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Django Python roop

2014-06-11 Thread moqianc...@gmail.com
Sometimes, I have to use while statement too. But any time, I think 
write right code, write clean code,  It's a basic rule for our develope work.




moqianc...@gmail.com

From: hito koto
Date: 2014-06-11 21:05
To: django-users
Subject: Re: Django Python roop

Hi, qiancong:
Thank you,
Do you not use the while statement to Django?


2014年6月11日水曜日 21時52分54秒 UTC+9 Qiancong:
 
Hi, hito koto:
I think  the problems you asked should be post in python-lang mail-list. 
For python program,  I prefer "for", not "while";  It's more simpler.
But  if you like while, I think the following code maybe helpful:

def fff(x):
y = []
i = 0
xlen = len(x)
while i< xlen:
y.append(x[i])
i += 1
return y

but I more like the follow writing:
def fff(x):
return x[:]

or you just do as following:
y  = x[:]

python is a power & beautiful language,   
please read the  https://docs.python.org/2/tutorial/ at first like  François 
said.

With Regards.




moqia...@gmail.com

From: hito koto
Date: 2014-06-11 19:21
To: django-users
Subject: Django Python roop
Hello, all

I want to change to while statement from for statement, so how can i do to?

this is my correct for statement codes:

def fff(x):
y = []
for i in range(len(x)):
y.append(x[i])
return y

and i want change to while statement 

So, this code have erroes:
TypeError: list indices must be integers, not list
def fff(x):
y = []
while x !=[]:
   for i in x:
   y.append(x[i])
return y

-- 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8afde78f-9910-4d26-b1e6-e5f1eaaca63b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2014061121121170324647%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Django Python roop

2014-06-11 Thread moqianc...@gmail.com
In your function, if x is not a empty list,  then while will be a infinite 
loop, x always not be  [];
then the inner for-loop  will append many many items into y list, Then your 
computer will say "have the Memory Error",  to tell you the memory not enought.





moqianc...@gmail.com

From: hito koto
Date: 2014-06-11 20:49
To: django-users
Subject: Re: Django Python roop
MemoryError , Why? idon't know.
I try this have Traceback (most recent call last):
  File "", line 1, in 
  File "", line 5, in foo
MemoryError errors:  

I'm change to this code: have the Memory Error,

def foo(x):
y = []
while x != []:
for i in range(len(x)):
y.append(x[i])
return y



2014年6月11日水曜日 20時21分42秒 UTC+9 hito koto:
Hello, all

I want to change to while statement from for statement, so how can i do to?

this is my correct for statement codes:

def fff(x):
y = []
for i in range(len(x)):
y.append(x[i])
return y

and i want change to while statement 

So, this code have erroes:
TypeError: list indices must be integers, not list
def fff(x):
y = []
while x !=[]:
   for i in x:
   y.append(x[i])
return y

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cae941c1-3af8-4ba7-9a1c-2d1232dbed9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2014061121074166965044%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread hito koto

Hi, qiancong:
Thank you,
Do you not use the while statement to Django?


2014年6月11日水曜日 21時52分54秒 UTC+9 Qiancong:
>
>  
> Hi, hito koto:
> I think  the problems you asked should be post in python-lang mail-list. 
> For python program,  I prefer "for", not "while";  It's more simpler.
> But  if you like while, I think the following code maybe helpful:
>  
> *def fff(x):*
> *y = []*
> *i = 0*
> *xlen = len(x)*
> *while i< xlen:*
> *y.append(x[i])*
> *i += 1*
> *return y*
>  
> but I more like the follow writing:
> *def fff(x):*
> *return x[:]*
>  
> or you just do as following:
> *y  = x[:]*
>  
> python is a power & beautiful language,   
> please read the  https://docs.python.org/2/tutorial/ at first like 
>  François said.
>  
> With Regards.
>  
> --
>  moqia...@gmail.com 
>  
>  *From:* hito koto 
> *Date:* 2014-06-11 19:21
> *To:* django-users 
> *Subject:* Django Python roop
>  Hello, all
>
> I want to change to while statement from for statement, so how can i do 
> to?
>
> this is my correct for statement codes:
>
> def fff(x):
> y = []
> for i in range(len(x)):
> y.append(x[i])
> return y
>
> and i want change to while statement 
>
> So, this code have erroes:
> TypeError: list indices must be integers, not list
> def fff(x):
> y = []
> while x !=[]:
>for i in x:
>y.append(x[i])
> return y
>
> -- 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8afde78f-9910-4d26-b1e6-e5f1eaaca63b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread hito koto
hi, Ilya Kazakevich:

I would like to change the while statement from the for statement

2014年6月11日水曜日 21時49分32秒 UTC+9 hito koto:
>
> MemoryError , Why? idon't know.
> I try this have Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 5, in foo
> MemoryError errors:  
>
> I'm change to this code: have the Memory Error,
>
> def foo(x):
> y = []
> while x != []:
> for i in range(len(x)):
> y.append(x[i])
> return y
>
>
>
> 2014年6月11日水曜日 20時21分42秒 UTC+9 hito koto:
>>
>> Hello, all
>>
>> I want to change to while statement from for statement, so how can i do 
>> to?
>>
>> this is my correct for statement codes:
>>
>> def fff(x):
>> y = []
>> for i in range(len(x)):
>> y.append(x[i])
>> return y
>>
>> and i want change to while statement 
>>
>> So, this code have erroes:
>> TypeError: list indices must be integers, not list
>> def fff(x):
>> y = []
>> while x !=[]:
>>for i in x:
>>y.append(x[i])
>> return y
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c80b24ff-aae8-4554-bcc9-056c36b2cf4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread moqianc...@gmail.com
Hi, hito koto:
I think  the problems you asked should be post in python-lang mail-list. 
For python program,  I prefer "for", not "while";  It's more simpler.
But  if you like while, I think the following code maybe helpful:

def fff(x):
y = []
i = 0
xlen = len(x)
while i< xlen:
y.append(x[i])
i += 1
return y

but I more like the follow writing:
def fff(x):
return x[:]

or you just do as following:
y  = x[:]

python is a power & beautiful language,   
please read the  https://docs.python.org/2/tutorial/ at first like  François 
said.

With Regards.




moqianc...@gmail.com

From: hito koto
Date: 2014-06-11 19:21
To: django-users
Subject: Django Python roop
Hello, all

I want to change to while statement from for statement, so how can i do to?

this is my correct for statement codes:

def fff(x):
y = []
for i in range(len(x)):
y.append(x[i])
return y

and i want change to while statement 

So, this code have erroes:
TypeError: list indices must be integers, not list
def fff(x):
y = []
while x !=[]:
   for i in x:
   y.append(x[i])
return y

-- 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2014061120521739307138%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Python roop

2014-06-11 Thread hito koto
MemoryError , Why? idon't know.
I try this have Traceback (most recent call last):
  File "", line 1, in 
  File "", line 5, in foo
MemoryError errors:  

I'm change to this code: have the Memory Error,

def foo(x):
y = []
while x != []:
for i in range(len(x)):
y.append(x[i])
return y



2014年6月11日水曜日 20時21分42秒 UTC+9 hito koto:
>
> Hello, all
>
> I want to change to while statement from for statement, so how can i do 
> to?
>
> this is my correct for statement codes:
>
> def fff(x):
> y = []
> for i in range(len(x)):
> y.append(x[i])
> return y
>
> and i want change to while statement 
>
> So, this code have erroes:
> TypeError: list indices must be integers, not list
> def fff(x):
> y = []
> while x !=[]:
>for i in x:
>y.append(x[i])
> return y
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cae941c1-3af8-4ba7-9a1c-2d1232dbed9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site doesn't work

2014-06-11 Thread Sanjay Bhangar
On 11 Jun 2014 18:04, "Glen J"  wrote:

> Sanjay,
> Thanks for the reply.  I've tried accessing it various ways using both
> nginx and the included devserver on :8000.  I've done both 127.0.0.1/admin
> and 127.0.0.1/admin/ with the same results.  I can post the contents of
> my urls.py later today when I have access to my machine at home.  FWIW, I
> didn't think the example.com entry was the issue, but at this point I'm
> kinda grasping at straws as I've checked my urls.py and settings.py about a
> hundred times and synced with the database many times as well and don't get
> a hard error, only the django welcome page.
>
>
Hah, it's almost definitely something silly -- have you added
django.contrib.admin to your INSTALLED_APPS in settings.py?

No worries - post your urls.py and other things that maybe relevant when
you have access and we'll try and figure it out.

Cheers,
Sanjay

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG3W7ZH1gKxQ-EegDGGMENFe-vLFF8%2Bd7_Wa81vLPKoK7DQkTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Django Python roop

2014-06-11 Thread Ilya Kazakevich
Hello,

What are you trying to do? Split string? Copy array? You probably need to use 
builtin functions for that.


Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"


>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of hito koto
>Sent: Wednesday, June 11, 2014 3:22 PM
>To: django-users@googlegroups.com
>Subject: Django Python roop
>
>Hello, all
>
>I want to change to while statement from for statement, so how can i do to?
>
>this is my correct for statement codes:
>
>def fff(x):
>y = []
>for i in range(len(x)):
>y.append(x[i])
>return y
>
>and i want change to while statement
>
>So, this code have erroes:
>TypeError: list indices must be integers, not list def fff(x):
>y = []
>while x !=[]:
>   for i in x:
>   y.append(x[i])
>return y
>
>
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email
>to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/1f5ae7ed-6fa2-4cf0-8ba7-d59
>088ba1cf5%40googlegroups.com
>9088ba1cf5%40googlegroups.com?utm_medium=email_source=footer> .
>For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/007601cf8573%244aa27dd0%24dfe77970%24%40JetBrains.com.
For more options, visit https://groups.google.com/d/optout.


RE: error

2014-06-11 Thread Ilya Kazakevich
Hello,

Try to use debugger. https://docs.python.org/2/library/pdb.html or 
http://www.jetbrains.com/pycharm/features/#debugger


Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"

>-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of kim jinhoo
>Sent: Tuesday, June 10, 2014 8:12 PM
>To: django-users@googlegroups.com
>Subject: error
>
>I installed both python and django.
>After I create a project, I try to run a server error occurred.
>Re-install django hayeotneunde still see the same error occurs.
>Let them know what is causing me.
>
>  File "C:\Python27\lib\functools.py", line 56, in 
>'__lt__': [('__gt__', lambda self, other: other < self),
>RuntimeError: maximum recursion depth exceeded while calling a Python object
>
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email
>to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/444fc5da-d076-4dfb-87db-a2
>dc1222d46e%40googlegroups.com
>dc1222d46e%40googlegroups.com?utm_medium=email_source=footer> .
>For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/007501cf8572%24920e2440%24b62a6cc0%24%40JetBrains.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site doesn't work

2014-06-11 Thread Glen J
Sanjay,
Thanks for the reply.  I've tried accessing it various ways using both 
nginx and the included devserver on :8000.  I've done both 127.0.0.1/admin 
and 127.0.0.1/admin/ with the same results.  I can post the contents of my 
urls.py later today when I have access to my machine at home.  FWIW, I 
didn't think the example.com entry was the issue, but at this point I'm 
kinda grasping at straws as I've checked my urls.py and settings.py about a 
hundred times and synced with the database many times as well and don't get 
a hard error, only the django welcome page.

On Wednesday, June 11, 2014 7:27:12 AM UTC-4, Sanjay Bhangar wrote:
>
> hey Glen, 
>
> Sorry if this is a silly question - but are you sure you are visiting 
> /admin on your site? 
> If you are and still getting this error, can you please paste the 
> contents of your urls.py 
>
> On Wed, Jun 11, 2014 at 4:24 PM, Glen J  
> wrote: 
> > I've tried it both on the development server you indicate below as well 
> as 
> > on a my own web server (nginx using uwsgi) and get the same results.  No 
> > errors are displayed, simply the welcome page for Django.  Syncdb works 
> fine 
> > (using Postgresql) and shows output when I do it.  One thing I did spot 
> in 
> > the database that I wasn't sure of is in my django_site table it has 
> > example.com.  Not sure why it is there as I never did that. 
> > 
>
> Django creates a default site called example.com. You are expected to 
> change this to your correct site URL when you deploy. This should not 
> be the cause of your troubles though - AFAIK, this is only used when 
> generating full url permalinks, like in RSS feeds, etc. 
>
> HTH, 
> Sanjay 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/792938fd-3bbc-4ea6-bc46-91bd9e3d2052%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django python fuction

2014-06-11 Thread hito koto
hi, François :
Thanks

2014年6月11日水曜日 1時22分04秒 UTC+9 François Schiettecatte:
>
> Wouldn't the deep copy module handle this for you: 
>
> https://docs.python.org/2/library/copy.html 
>
> François 
>
> On Jun 10, 2014, at 12:17 PM, hito koto  
> wrote: 
>
> > Hi,  Qiancong : 
> > 
> > I was looking for exactly this、 
> > Thank you ver much! 
> > 
> > 
> > 2014年6月10日火曜日 23時35分52秒 UTC+9 Qiancong: 
> >  
> > Hi, hito koto: 
> > I think you want to deep copy the list. The following code maybe 
>  helpful: 
> > def dcopy(obj): 
> > if not isinstance(obj, list): 
> > return obj 
> > return [dcopy(x) for x in obj] 
> >   
> > But this function only deep copy for list.  You can change code as what 
> I did for dic, set, tuple , etc .. 
> > moqia...@gmail.com 
> >   
> > From: François Schiettecatte 
> > Date: 2014-06-10 22:07 
> > To: django-users 
> > Subject: Re: Django python fuction 
> > You need to use .append() to add elements to a list, I suggest you take 
> a look at the python tutorial: 
> >   
> > https://docs.python.org/2/tutorial/ 
> >   
> > Not quite sure what you are doing with i or elem either. 
> >   
> > François 
> >   
> > On Jun 10, 2014, at 10:01 AM, hito koto  wrote: 
> >   
> > > So, I also have errors: 
> > > 
> > > 
> > > >>> def foo(x): 
> > > ... myList = [] 
> > > ... if isinstance(x, list): 
> > > ... for i in x: 
> > > ... elem = i 
> > > ... return myList + foo(elem) 
> > > ... else: 
> > > ... return 1 
> > > ... 
> > > >>> 
> > > >>> foo(a) 
> > > Traceback (most recent call last): 
> > >   File "", line 1, in  
> > >   File "", line 6, in foo 
> > >   File "", line 6, in foo 
> > > TypeError: can only concatenate list (not "int") to list 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 2014年6月10日火曜日 22時53分28秒 UTC+9 François Schiettecatte: 
> > > You are redefining 'list' on  line 2, rename list to myList as 
> follows: 
> > > 
> > > def foo(x): 
> > > myList = [] 
> > > if isinstance(x, list): 
> > > for i in x: 
> > > elem = i 
> > > return myList + foo(i) 
> > > else: 
> > > return 1 
> > > 
> > > And take this to a python list, this is for django. 
> > > 
> > > Cheers 
> > > 
> > > François 
> > > 
> > > 
> > > On Jun 10, 2014, at 9:43 AM, hito koto  wrote: 
> > > 
> > > > hi, 
> > > > 
> > > > I have this erroes: 
> > > > 
> > > > >>> def foo(x): 
> > > > ... list = [] 
> > > > ... if isinstance(x, list): 
> > > > ... for i in x: 
> > > > ... elem = i 
> > > > ... return list + foo(i) 
> > > > ... else: 
> > > > ... return 1 
> > > > ... 
> > > > >>> foo(a) 
> > > > Traceback (most recent call last): 
> > > >   File "", line 1, in  
> > > >   File "", line 3, in foo 
> > > > TypeError: isinstance() arg 2 must be a class, type, or tuple of 
> classes and types 
> > > > 
> > > > 
> > > > 
> > > > 2014年6月10日火曜日 22時27分42秒 UTC+9 Andrew Farrell: 
> > > > In general, I recommend adding the line "import pdb;pdb.set_trace()" 
> > > > to the top of your function and walking through it to see why it 
> doesn't work. 
> > > > 
> > > > def foo(x): 
> > > > import pdb;pdb.set_trace() 
> > > > 
> > > > list = [] 
> > > > if isinstance(x, list): 
> > > > for i in x: 
> > > > elem = i 
> > > > return list + foo(i) 
> > > > else: 
> > > > return 1 
> > > > 
> > > > See https://docs.python.org/2/library/pdb.html on how pdb works. 
> > > > There are faster ways to debug, but when starting out, pdb lets you 
> see what is happening as you run the function. 
> > > > 
> > > > 
> > > > Some questions I have about this function: 
> > > > - What is the purpose of the "elem" function? It is never accessed. 
> > > > - What is the purpose of returning 1 if the argument is not a list? 
> > > > - Why is it named "foo" rather than something that tells me what the 
> purpose of the function is? 
> > > > 
> > > > 
> > > > On Tue, Jun 10, 2014 at 8:16 AM, hito koto  
> wrote: 
> > > > Hello, 
> > > > 
> > > > I don't know how can i do to change to write python function 
> > > > I want to following code change to write python function or change 
> to write  recursive definition 
> > > > >>> y = [10, 12, [13, [14, 9], 16], 7] 
> > > > >>> z = copy.deepcopy(y) 
> > > > >>> y 
> > > > [10, 12, [13, [14, 9], 16], 7] 
> > > > >>> z 
> > > > [10, 12, [13, [14, 9], 16], 7] 
> > > > >>> z[2][1][1] 
> > > > 9 
> > > > >>> z[2][1][1] = 88 
> > > > >>> z 
> > > > [10, 12, [13, [14, 88], 16], 7] 
> > > > [10, 12, [13, [14, 9], 16], 7] 
> > > > >>> 
> > > > 
> > > > this is my use function but not work: 
> > > > 
> > > > def foo(x): 
> > > > list = [] 
> > > > if isinstance(x, list): 
> > > > for i in x: 
> > > >   

Re: Admin site doesn't work

2014-06-11 Thread Sanjay Bhangar
hey Glen,

Sorry if this is a silly question - but are you sure you are visiting
/admin on your site?
If you are and still getting this error, can you please paste the
contents of your urls.py

On Wed, Jun 11, 2014 at 4:24 PM, Glen J  wrote:
> I've tried it both on the development server you indicate below as well as
> on a my own web server (nginx using uwsgi) and get the same results.  No
> errors are displayed, simply the welcome page for Django.  Syncdb works fine
> (using Postgresql) and shows output when I do it.  One thing I did spot in
> the database that I wasn't sure of is in my django_site table it has
> example.com.  Not sure why it is there as I never did that.
>

Django creates a default site called example.com. You are expected to
change this to your correct site URL when you deploy. This should not
be the cause of your troubles though - AFAIK, this is only used when
generating full url permalinks, like in RSS feeds, etc.

HTH,
Sanjay

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG3W7ZH9hhaS70V0wdRLKzpj4humi_gaSwnyNBhr6jDeT5UPOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Python roop

2014-06-11 Thread hito koto
Hello, all

I want to change to while statement from for statement, so how can i do to?

this is my correct for statement codes:

def fff(x):
y = []
for i in range(len(x)):
y.append(x[i])
return y

and i want change to while statement 

So, this code have erroes:
TypeError: list indices must be integers, not list
def fff(x):
y = []
while x !=[]:
   for i in x:
   y.append(x[i])
return y

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1f5ae7ed-6fa2-4cf0-8ba7-d59088ba1cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Django python fuction

2014-06-11 Thread hito koto
Thanks

2014年6月11日水曜日 10時37分43秒 UTC+9 Qiancong:
>
>  
> Yeah, I think hito koto need a function like copy.deepcopy.. I think he 
> known copy.deepcopy before(as his example said),  just not known how to 
> write a funtion work as copy.deecopy does for list.
>  
> --
>  moqia...@gmail.com 
>  
>  *From:* François Schiettecatte 
> *Date:* 2014-06-11 00:21
> *To:* django-users 
> *Subject:* Re: Django python fuction
>  Wouldn't the deep copy module handle this for you:
>  
> https://docs.python.org/2/library/copy.html
>  
> François
>  
> On Jun 10, 2014, at 12:17 PM, hito koto  
> wrote:
>  
> > Hi,  Qiancong :
> > 
> > I was looking for exactly this、
> > Thank you ver much!
> > 
> > 
> > 2014年6月10日火曜日 23時35分52秒 UTC+9 Qiancong:
> > 
> > Hi, hito koto:
> > I think you want to deep copy the list. The following code maybe  
> helpful:
> > def dcopy(obj):
> > if not isinstance(obj, list):
> > return obj
> > return [dcopy(x) for x in obj]
> >  
> > But this function only deep copy for list.  You can change code as what 
> I did for dic, set, tuple , etc ..
> > moqia...@gmail.com
> >  
> > From: François Schiettecatte
> > Date: 2014-06-10 22:07
> > To: django-users
> > Subject: Re: Django python fuction
> > You need to use .append() to add elements to a list, I suggest you take 
> a look at the python tutorial:
> >  
> > https://docs.python.org/2/tutorial/
> >  
> > Not quite sure what you are doing with i or elem either.
> >  
> > François
> >  
> > On Jun 10, 2014, at 10:01 AM, hito koto  wrote:
> >  
> > > So, I also have errors:
> > >
> > >
> > > >>> def foo(x):
> > > ... myList = []
> > > ... if isinstance(x, list):
> > > ... for i in x:
> > > ... elem = i
> > > ... return myList + foo(elem)
> > > ... else:
> > > ... return 1
> > > ...
> > > >>>
> > > >>> foo(a)
> > > Traceback (most recent call last):
> > >   File "", line 1, in 
> > >   File "", line 6, in foo
> > >   File "", line 6, in foo
> > > TypeError: can only concatenate list (not "int") to list
> > >
> > >
> > >
> > >
> > >
> > > 2014年6月10日火曜日 22時53分28秒 UTC+9 François Schiettecatte:
> > > You are redefining 'list' on  line 2, rename list to myList as follows:
> > >
> > > def foo(x):
> > > myList = []
> > > if isinstance(x, list):
> > > for i in x:
> > > elem = i
> > > return myList + foo(i)
> > > else:
> > > return 1
> > >
> > > And take this to a python list, this is for django.
> > >
> > > Cheers
> > >
> > > François
> > >
> > >
> > > On Jun 10, 2014, at 9:43 AM, hito koto  wrote:
> > >
> > > > hi,
> > > >
> > > > I have this erroes:
> > > >
> > > > >>> def foo(x):
> > > > ... list = []
> > > > ... if isinstance(x, list):
> > > > ... for i in x:
> > > > ... elem = i
> > > > ... return list + foo(i)
> > > > ... else:
> > > > ... return 1
> > > > ...
> > > > >>> foo(a)
> > > > Traceback (most recent call last):
> > > >   File "", line 1, in 
> > > >   File "", line 3, in foo
> > > > TypeError: isinstance() arg 2 must be a class, type, or tuple of 
> classes and types
> > > >
> > > >
> > > >
> > > > 2014年6月10日火曜日 22時27分42秒 UTC+9 Andrew Farrell:
> > > > In general, I recommend adding the line "import pdb;pdb.set_trace()"
> > > > to the top of your function and walking through it to see why it 
> doesn't work.
> > > >
> > > > def foo(x):
> > > > import pdb;pdb.set_trace()
> > > >
> > > > list = []
> > > > if isinstance(x, list):
> > > > for i in x:
> > > > elem = i
> > > > return list + foo(i)
> > > > else:
> > > > return 1
> > > >
> > > > See https://docs.python.org/2/library/pdb.html on how pdb works.
> > > > There are faster ways to debug, but when starting out, pdb lets you 
> see what is happening as you run the function.
> > > >
> > > >
> > > > Some questions I have about this function:
> > > > - What is the purpose of the "elem" function? It is never accessed.
> > > > - What is the purpose of returning 1 if the argument is not a list?
> > > > - Why is it named "foo" rather than something that tells me what the 
> purpose of the function is?
> > > >
> > > >
> > > > On Tue, Jun 10, 2014 at 8:16 AM, hito koto  
> wrote:
> > > > Hello,
> > > >
> > > > I don't know how can i do to change to write python function
> > > > I want to following code change to write python function or change 
> to write  recursive definition
> > > > >>> y = [10, 12, [13, [14, 9], 16], 7]
> > > > >>> z = copy.deepcopy(y)
> > > > >>> y
> > > > [10, 12, [13, [14, 9], 16], 7]
> > > > >>> z
> > > > [10, 12, [13, [14, 9], 16], 7]
> > > > >>> z[2][1][1]
> > > > 9
> > > > >>> z[2][1][1] = 88
> > > > >>> z
> > > > [10, 12, [13, [14, 88], 16], 7]
> > > > 

Re: Admin site doesn't work

2014-06-11 Thread Glen J
I've tried it both on the development server you indicate below as well as 
on a my own web server (nginx using uwsgi) and get the same results.  No 
errors are displayed, simply the welcome page for Django.  Syncdb works 
fine (using Postgresql) and shows output when I do it.  One thing I did 
spot in the database that I wasn't sure of is in my django_site table it 
has example.com.  Not sure why it is there as I never did that.

On Tuesday, June 10, 2014 10:10:47 PM UTC-4, Glen J wrote:
>
> I read another post on here about how their Django site admin site would 
> not come up.  In their case, they had failed to edit the urls.py and 
> settings.py to enable the site.  I have done that and also done a syncdb 
> after making those changes and the admin sited does not come up.  All that 
> displays is the welcome site indicating that Django is working.  Like the 
> other person posting, I am simply following along (or trying) with the 
> Django tutorial.  What else can I look at to get to the bottom of this?  
> Any help would be much appreciated!
>
> Glen
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/07e72ea8-2bf9-4654-bb3a-d913d3d1b10f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Poll App part 3

2014-06-11 Thread Daniel Roseman
On Wednesday, 11 June 2014 11:18:55 UTC+1, divyanshi kathuria wrote:
>
> In Django poll application part 3, url passed in index.html is 'detail'. I 
> doubt it should be 'index'. 
>

If you think there's a bug in the tutorial, you should log a ticket in the 
ticket tracker and/or make a pull request. But you're going to need to be a 
bit more specific in explaining what exactly you think is wrong and why.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8926ebdb-8dd4-4e89-a86b-b6982fa06a57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django installation

2014-06-11 Thread Daniel Roseman
On Wednesday, 11 June 2014 11:00:38 UTC+1, Srinivas Reddy T wrote:
>
> There is no need to install virtualenv to install Django.
>
While this is technically correct, it is not good advice to give to a 
newbie. Experienced developers should be encouraging best practice among 
newcomers, and to be honest there really isn't a good reason *not* to use 
virtualenv.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da3adcf3-de91-4727-8b3e-7c8613112574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Poll App part 3

2014-06-11 Thread divyanshi kathuria
In Django poll application part 3, url passed in index.html is 'detail'. I 
doubt it should be 'index'. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e74deb58-0106-4804-8667-ed8c5c089543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django installation

2014-06-11 Thread Sreenivas Reddy T
There is no need to install virtualenv to install Django.
On 11/06/2014 1:56 pm, "Pavithra M H"  wrote:

> hi, first of all you should create an virtual environment and then u have
> to install django, the detailed procedure is given here "
>
> http://www.openbookproject.net/courses/webappdev/units/webappdev2/resources/django_virtualenv.html
> "
>
>
> On Wednesday, June 11, 2014 11:10:01 AM UTC+5:30, David Moya wrote:
>>
>> So i supposedly installed Django because on the terminal, after going
>> through the whole process of installation, it says "Successfully installed
>> Django". However, when i try to run the command: python -c "import
>> django; print(django.get_version())" I get: ImportError: No module named
>> django. What should I do?
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ad350c6d-b887-4efb-b9e6-d461e5b87cf2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEaN0UYs6%3Dqe1nDb06HTYcf7H38AYyZEn-CgPrMVTQ%3DpQRF0zA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django installation

2014-06-11 Thread Pavithra M H
hi, first of all you should create an virtual environment and then u have 
to install django, the detailed procedure is given here "
http://www.openbookproject.net/courses/webappdev/units/webappdev2/resources/django_virtualenv.html;


On Wednesday, June 11, 2014 11:10:01 AM UTC+5:30, David Moya wrote:
>
> So i supposedly installed Django because on the terminal, after going 
> through the whole process of installation, it says "Successfully installed 
> Django". However, when i try to run the command: python -c "import 
> django; print(django.get_version())" I get: ImportError: No module named 
> django. What should I do?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad350c6d-b887-4efb-b9e6-d461e5b87cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django installation

2014-06-11 Thread Mike Dewhirst

On 11/06/2014 3:40 PM, David Moya wrote:

So i supposedly installed Django because on the terminal, after going
through the whole process of installation, it says "Successfully
installed Django". However, when i try to run the command: python -c
"import django; print(django.get_version())"I get:ImportError: No module
named django. What should I do?


Start python

>>> import django
>>> django.get_version()
'1.5.8'
>>>

... in my case

Mike




--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b32fee81-8061-49bd-b66e-433f5480eb13%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53980347.5080709%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


"ResourceWarning: unclosed" error using mysql-connector-python

2014-06-11 Thread Zemian Deng
Hi there,

I am using mysql-connector-python (1.1.6) with Django (1.6.5) and myapp is 
working fine. But each SQL call to DB will result the following warning 
messages:

Exception ignored in: 

ResourceWarning: unclosed 


Has anyone seen this and know a way to resolve it?
Also, FYI, I am using the following in my settings file.
DATABASES = {
'default': {
   'ENGINE': 'mysql.connector.django',
   'NAME': 'mydb',
   'USER': 'test',
   'PASSWORD': 'test',
},
}

Thanks,
Zemian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f03292b-16a4-4224-b89e-a4f57b2dfcc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django installation

2014-06-11 Thread David Moya
So i supposedly installed Django because on the terminal, after going 
through the whole process of installation, it says "Successfully installed 
Django". However, when i try to run the command: python -c "import django; 
print(django.get_version())" I get: ImportError: No module named django. 
What should I do?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b32fee81-8061-49bd-b66e-433f5480eb13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone interested in reviewing code for a hobby project - BookMarker

2014-06-11 Thread trojactory
Hi Aseem,

> Is there some other layout?

Yes. The current version of Django uses the layout mentioned in the 
tutorial itself: https://docs.djangoproject.com/en/1.6/intro/tutorial01/

> The second part about relative imports. I have never understood how 
relative imports work. I mean the syntax. I have went through the PEP to 
understand it and did a lot of google searches but that is something that I 
never got the hang of. Is there any specific reason that I should be using 
them?

Relative imports would continue to work even if your app or project name 
changes. They are also unambiguous as mentioned in the docs 
.

> Would you like to use an app that won't autocomplete?

I think the confusion was caused by your flat-style project layout. There 
is a distinction between a Django project and an app. I was referring to 
adding too much functionality into a bookmarking *app*. It is perfectly 
fine in a project though.

Cheers,
Arun

On Wednesday, 11 June 2014 00:03:30 UTC+5:30, Aseem Bansal wrote:
>
> I did not understand what you said regarding having a standard layout. I 
> mean I am already using the layout that was explained in the Django 
> tutorials. Keeping all my HTML in the template directory and all static 
> files in the static directory with namespacing with the app name which is 
> BookMarker. Is there some other layout?
>
>
>  I used CharField instead of URLField because there is a problem with 
> URLField. It is not allowing me to add local files as bookmarks which is 
> actually valid URL. I mean currently I have bookmarks in my browser like 
> file:///D:/Study/Docs/Python/python-3.4.0-docs-html/index.html 
> It is perfectly valid URL but URLField is marking it as invalid. So I used 
> CharField.
>
> The second part about relative imports. I have never understood how 
> relative imports work. I mean the syntax. I have went through the PEP to 
> understand it and did a lot of google searches but that is something that I 
> never got the hang of. Is there any specific reason that I should be using 
> them?
>
> The app's goal is for me to be able to us this app for storing and using 
> my bookmarks through the app instead of my webbrowser. The problem is that 
> I have lot of bookmarks. Both offline and online bookmarks which I am 
> currently maintaining in a multiple hierarchy of bookmark folders. It is 
> going messy. I need this app to be an application that I can use to add, 
> update, delete, view bookmarks by categories. Adding, deleting categories 
> and searching by categories is also necessary for me to switch to this app. 
> Otherwise there is no benefit. 
>
> The reason I am using autocomplete is that I want searching for categories 
> easier. Same goes for already added bookmarks.  Would you like to use an 
> app that won't autocomplete? Nobody will including myself. The reason for 
> opening a webbrowser is that I need to be able to use my bookmarks through 
> this app. I can serve the bookmarks as hyperlinks on which a simple click 
> can do the job of opening the webpage. But browser security does not allow 
> me to open locally stored bookmarks like the one I gave above to be opened 
> this way. When I came to know about this thing I had two choices - switch 
> to a GUI framework or find an acceptable workaround. As my server and 
> client or on the same machine and the security of browser do not apply to 
> my Python installation I chose to send the request of opening the bookmark 
> to server which will be able to open both offline and online bookmarks.
>
> I understand the need for documentation but I think as there is an 
> assumption of server and client on same machine for opening the bookmarks 
> no one will want to use it anyway. Bad jokes aside, I am learning Django, 
> Javscript/jQuery through this project I don't feel comfortable adding 
> another topic to learn side-by-side alongwith my job. My goal is to make an 
> app for personal use. If I add too much things to learn at the same time I 
> will lose the interest that keeps me going. I will consider making one the 
> proper way when I am more comfortable with these things and I have an idea 
> which is reusable.
>
> If there is anything else please let me know. I will try my best to 
> explain. 
>
>
> On Tuesday, June 10, 2014 6:48:59 PM UTC+5:30, trojactory wrote:
>>
>> Aseem,
>>
>> I had a quick look at your Django app and here are some of my 
>> observations:
>>
>>
>>1. Most Django apps have a standard layout with the app in a 
>>directory named after itself. See django-taggit 
>>
>> 
>>  
>>for instance.
>>2. You have made some unconventional choices which needs to be 
>>explained like using CharField instead of URLField, not using 
>>relative paths in imports etc.
>>3. An app must do one thing really well in