Re: Urls.py Question

2014-05-06 Thread James Schneider
You need to quote the argument being passed to include():

include('vmware.urls')

There might be other things going on, but I'm on my phone and it's hard to
follow.

-James

On Tuesday, May 6, 2014, G Z  wrote:

> I'm running 1.6.4
>
> yes vmware is in my installed apps i used from . import vmware
> if I dont try to link my appurls to project urls and just use admin site
> all my stuff works correctly its just when i try to add vmare
>
> project.urls
>
>
> from django.conf.urls import patterns, include, url
>
> from django.contrib import admin
> admin.autodiscover()
> from . import vmware
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'provisioning.views.home', name='home$
> # url(r'^blog/', include('blog.urls')),
>
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)),
> )
>
>
> app.urls
>
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_$
> queryset=Customer.obje$
> template_name="VMS.htm$
> )
>
>
> settings.py
>
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'vmware',
> )
>
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'vmware',
> )
>
>
> directory structure provisioning is the project vmware is the app.
> drwxr-xr-x 4 root root 4096 May  5 20:12 .
> drwxr-xr-x 3 root root 4096 May  5 19:09 ..
> -rw-r--r-- 1 root root  255 May  5 19:09 manage.py
> drwxr-xr-x 2 root root 4096 May  6 11:15 provisioning
> drwxr-xr-x 3 root root 4096 May  6 11:15 vmware
>
>
>
> models.py
>
> from django.db import models
>
> # Create your models here.
>
> class Customer(models.Model):
> NAME = models.CharField(max_length=200)
> WEBSITE = models.CharField(max_length=200)
> PHONE = models.CharField(max_length=200)
> EMAIL = models.CharField(max_length=200)
> ADDRESS = models.CharField(max_length=200)
> VMIDS = models.CharField(max_length=200)
>
> def __unicode__(self):
> return self.NAME
> #   return self.NAME
>
> class Vms(models.Model):
> VMID  = models.CharField(max_length=200)
> VMNAME = models.CharField(max_length=200)
> VMSTATUS = models.CharField(max_length=200)
> CUSTOMERID = models.ForeignKey(Customer)
>
> class Vmspecs(models.Model):
> CPUS =  models.CharField(max_length=200)
> CORES =  models.CharField(max_length=200)
> MEMORY =  models.CharField(max_length=200)
> HDSPACE =  models.CharField(max_length=200)
> OS =  models.CharField(max_length=200)
> UPTIME = models.CharField(max_length=200)
> VMID = models.ForeignKey(Vms)
>
>   #  choice_text = models.CharField(max_length=200)
>
>
>
>  --
> 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/a1c5481d-6eb8-418c-bb6d-b09aa7024c60%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/CA%2Be%2BciUXX_9DZPTXdY8Yqn506LyuFNCxddqNnGdU5eAotOk6QA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Detail View Question

2014-05-06 Thread G Z


repost easier to read

So I'm using DetailView to associate a Customer ID with customer 
information but due to my lack of knowledge im not entirely sure what the 
issue is. It will go to the page but it won't load the unique customer 
data. The data exist at domain/customers/ however when you click the link 
which takes you to domain/customers/id it wont show the data its just a 
blank page with a title.

Here is my urls.py

from django.conf.urls import patterns, include, url
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from vmware.models import Customer

urlpatterns = patterns('',
url(r'^$', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),

url(r'^(?P\d+)$', DetailView.as_view(
model = Customer,
template_name="customer.html")),

)

Here is the html output for it

{% extends "base.html" %}
{% block content %}
 {{ post.NAME }}  

 {{ post.id }}


 {{ post.NAME }}


 {{ post.WEBSITE }}


 {{ post.PHONE }}


 {{ post.EMAIL }}


 {{ post.ADDRESS }}


 {{ post.VMIDS }}

{% endblock %}

-- 
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/e24c4a4f-efdb-49ef-94bd-aaeab85cb973%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Detail View Question

2014-05-06 Thread G Z
So I'm using DetailView to associate a Customer ID with customer 
information but due to my lack of knowledge im not entirely sure what the 
issue is. It will go to the page but it won't load the unique customer 
data. The data exist at domain/customers/ however when you click the link 
which takes you to domain/customers/id it wont show the data its just a 
blank page with a title.

Here is my urls.py

from django.conf.urls import patterns, include, url
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from vmware.models import Customer

urlpatterns = patterns('',
url(r'^$', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),

url(r'^(?P\d+)$', DetailView.as_view(
model = Customer,
template_name="customer.html")),

)


Here is the html output for it 



{% extends "base.html" %}
{% block content %}
 {{ post.NAME }}  

 {{ post.id }}


 {{ post.NAME }}


 {{ post.WEBSITE }}


 {{ post.PHONE }}


 {{ post.EMAIL }}


 {{ post.ADDRESS }}


 {{ post.VMIDS }}

{% endblock %}


-- 
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/e5529412-a28b-461c-8eb7-d2ff858b16af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: regex error?

2014-05-06 Thread G Z
ive also tried 

  url(r'^customers/([0-9])/$', DetailView.as_view(
model = Customer,
template_name="customer.html")),

-- 
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/623792ae-7ecd-4177-b2e1-ec502781c157%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


regex error?

2014-05-06 Thread G Z
Im using detailview to display customer individualy when the link is 
clicked on but its not recognizing the number i think my regex is wrong..


this is what i have 

from django.conf.urls import patterns, include, url
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from vmware.models import Customer

urlpatterns = patterns('',
url(r'^$', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),

url(r'^(?P\d+)$', DetailView.as_view(
model = Customer,
template_name="customer.html")),

)



This is what im getting


Page not found (404)
Request Method: GET
Request URL:http://pythondev.enki.co:8001/customers/2
Using the URLconf defined in provisioning.urls, Django tried these URL 
patterns, in this order:
^admin/
^customers ^$
^customers ^(?P\d+)$
^test/
The current URL, customers/2, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.


>From what I understand that means the regex isnt matching..

-- 
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/ff13064e-6600-416f-8c3a-b8b7a6d117d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-06 Thread Timothy W. Cook
On Tue, May 6, 2014 at 7:01 PM, Guillem Liarte <
guillem.lia...@googlemail.com> wrote:

>
>
> But I still get the locale encoding problem.  Do you guys have any
> suggestions?
>
> I do not recall the exact error I had with this config (once you corrected
those you mentioned) but eventually I had to set:

$setenforce 0

to disable SELinux security.  I am sure that there is a way around this but
I haven't had a need to fix it yet.

HTH,
Tim




Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VfdFqrpFO3nKmz5cFc1PDjPj5Rw6crhJ4PY%3DEevhJ1mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Linking Multiple Mysql tables with unique identifiers

2014-05-06 Thread G Z
Easier to be red

Ok so I have three tables in my database Customer Vms and Vmspecs

Vms is tied through customer by customer id through database id field and 
vmspecs is tied to vms through the id field for Vms. However when I go into 
admin panel and try to add vmspecs to vms after connecting the vm to a 
customer i get the and error here is my model contorller.

class Customer(models.Model):
NAME = models.CharField(max_length=200)
WEBSITE = models.CharField(max_length=200)
PHONE = models.CharField(max_length=200)
EMAIL = models.CharField(max_length=200)
ADDRESS = models.CharField(max_length=200)
VMIDS = models.CharField(max_length=200)

def __unicode__(self):
return self.NAME
#   return self.NAME

class Vms(models.Model):
VMID  = models.CharField(max_length=200)
VMNAME = models.CharField(max_length=200)
VMSTATUS = models.CharField(max_length=200)
CUSTOMERID = models.ForeignKey(Customer)

def __unicode__(self):
return self.VMNAME
class Vmspecs(models.Model):
CPUS =  models.CharField(max_length=200)
CORES =  models.CharField(max_length=200)
MEMORY =  models.CharField(max_length=200)
HDSPACE =  models.CharField(max_length=200)
OS =  models.CharField(max_length=200)
UPTIME = models.CharField(max_length=200)
VMID = models.ForeignKey(Vms)

def __unicode__(self):
return self.VMID

Here is there error

Environment:

Request Method: POST
Request URL: http://pythondev.enki.co:8001/admin/vmware/vmspecs/add/

Django Version: 1.6.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'vmware')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
get_response
  114. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
in wrapper
  432. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapped_view
  99. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" 
in _wrapped_view_func
  52. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in 
inner
  198. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapper
  29. return bound_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapped_view
  99. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
bound_func
  25. return func(self, *args2, **kwargs2)
File "/usr/local/lib/python2.7/dist-packages/django/db/transaction.py" in inner
  371. return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
in add_view
  1133. self.log_addition(request, new_object)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
in log_addition
  600. action_flag=ADDITION
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/models.py" in 
log_action
  19. e = self.model(None, None, user_id, content_type_id, 
smart_text(object_id), object_repr[:200], action_flag, change_message)

Exception Type: TypeError at /admin/vmware/vmspecs/add/
Exception Value: 'Vms' object has no attribute '__getitem__'

-- 
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/49db1073-852f-4040-8ba6-d35d8cc51071%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-06 Thread Guillem Liarte
Hello again.

The solution for the incorrect version came as a combination of both Tom's 
and  Brad's answer.

I could compile a mod_wsgi 3.4 with my python and I used the recommended 
configuration. Now I get:

[Tue May 06 23:51:30 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.4 
Python/3.3.2 configured -- resuming normal operations
Fatal Python error: Py_Initialize: Unable to get the locale encoding
Fatal Python error: Py_Initialize: Unable to get the locale encoding


I am forcing the following locale:

LANG="en_GB.UTF-8"
LC_ALL="en_GB.utf8"
LC_CTYPE="C"
LC_NUMERIC=en_GB.utf8
LC_TIME=en_GB.utf8
LC_COLLATE="en_GB.utf8"
LC_MONETARY=en_GB.utf8
LC_MESSAGES="en_GB.utf8"
LC_PAPER=en_GB.utf8
LC_NAME=en_GB.utf8
LC_ADDRESS=en_GB.utf8
LC_TELEPHONE=en_GB.utf8
LC_MEASUREMENT=en_GB.utf8
LC_IDENTIFICATION=en_GB.utf8

So I do not understand why it is not working. I have also 
/etc/sysconfig/httpd:

export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
export LC_CTYPE=C
export LC_NUMERIC=en_GB.UTF-8
export LC_TIME=en_GB.UTF-8
export LC_COLLATE=en_GB.UTF-8
export LC_MONETARY=en_GB.UTF-8
export LC_MESSAGES=en_GB.UTF-8
export LC_PAPER=en_GB.UTF-8
export LC_NAME=en_GB.UTF-8
export LC_ADDRESS=en_GB.UTF-8
export LC_TELEPHONE=en_GB.UTF-8
export LC_MEASUREMENT=en_GB.UTF-8
export LC_IDENTIFICATION=en_GB.UTF-8


But I still get the locale encoding problem.  Do you guys have any 
suggestions?

Thanks!

On Friday, 2 May 2014 13:11:05 UTC+2, Guillem Liarte wrote:
>
> Hello,
>
> I have looked through the web in several different especialised forums but 
> I cannot find the way to do this properly.
>
> My aim is to have an environment to host Django applications running 
> Centos 6. So far I have managed to:
>
> - Get Centos 6.5 + Ptython 3.3.2 + Django 1.6 (virtual env), running a 
> test application using python's webserver. Time to move into Apache.
> - I manage to get it working from Apache but instead of Python 3.3.2, it 
> uses the Python 2.6 installed in the system. No matter if I launch apache 
> from the virtual environment, even once I have enabled python3. 
>
> I know Djanog 1.6 can use python 2.6. But that is not what i want to 
> achieve, as 1.7 will not.
>
> Just to give some idea of what I have installed:
>
>
>
> In the system:
> python --version
> Python 2.6.6 
>
> From RedHat SCL:
>
> source /opt/rh/python33/enable
>
> python --version 
> Python 3.3.2 
>
> Inside the virtual environment I have:
>
> Django (1.6.3) 
> pip (1.4.1) 
> setuptools (0.9.8) 
>
> That starts successfully:
>
> python manage.py runserver 192.168.0.16:8000
>
>
>
> Starting development server at http://192.168.0.16:8000/  
>   
>   
> Quit the server with CONTROL-C.  
>
> When getting to admin or any error page:
>
> Django Version:
>   1.6.3
> Python Version:
>   3.3.2
>
> Python Path:
>   
>
> ['/data/app/guillem-py3-dj17-test/guillem_test',
>  '/data/app/guillem-py3-dj17-test/lib64/python33.zip',
>  '/data/app/guillem-py3-dj17-test/lib64/python3.3',
>  '/data/app/guillem-py3-dj17-test/lib64/python3.3/plat-linux',
>  '/data/app/guillem-py3-dj17-test/lib64/python3.3/lib-dynload',
>  '/opt/rh/python33/root/usr/lib64/python3.3',
>  '/opt/rh/python33/root/usr/lib/python3.3',
>  '/data/app/guillem-py3-dj17-test/lib/python3.3/site-packages']
> ___
>
>  
> When starting this from Apache 2.2 instead of the python embedded server:
>
>
> httpd -k restart -e debug
> ...
> [Fri May 02 11:53:29 2014] [debug] mod_so.c(246): loaded module wsgi_module
> ...
>
> The Apache service starts in my port of choice:
>
> tcp0  0 192.168.0.16:8082   0.0.0.0:*   
> LISTEN  1676/httpdWhat I get now is:
>
> So now I get:
>
> Django Version:   1.6
> Python Executable:/data/app/guillem-py3-dj17-test/bin/python
> Python Version:   2.6.6
> Python Path:  
>
> ['/data/app/django-test/dev/test-1/HELLO_WORLD/lib/python2.6/site-packages',
>  '/data/app/django-test/dev/test-1/HELLO_WORLD/HELLO_WORLD/..',
>  '/usr/lib64/python26.zip',
>  '/usr/lib64/python2.6',
>  '/usr/lib64/python2.6/plat-linux2',
>  '/usr/lib64/python2.6/lib-tk',
>  '/usr/lib64/python2.6/lib-old',
>  '/usr/lib64/python2.6/lib-dynload',
>  '/usr/lib64/python2.6/site-packages',
>  '/usr/lib64/python2.6/site-packages/gst-0.10',
>  '/usr/lib64/python2.6/site-packages/gtk-2.0',
>  '/usr/lib/python2.6/site-packages',
>  '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
>  '/data/app/django-test/dev/test-1/virtual/lib/python3.3/site-packages',
>  '/data/app/django-test/dev/test-1/HELLO_WORLD/']
>
>
> Just to make it clear, that python inside the virtual env is python 3.3.2:
>
> (guillem-py3-dj17-test)ndoluxel002:/data/app/guillem-py3-dj17-test/bin# pwd
> /data/app/guillem-py3-dj17-test/bin
> (guillem-py3-dj17-test)ndoluxel002:/data/app/guillem-py3-dj17-test/bin# which 
> python
> /data/app/guillem-py

Re: Django URLS help app not defined

2014-05-06 Thread Rafael E. Ferrero
Check this out: http://linkode.org/j5tuDIjRiGrzufkXDrCMh7

if you visit http://www.fsorgosuardi.com.ar/eventos you go to activos views
if you visit http://www.fsorgosuardi.com.ar/eventos/ampliar/something-hereyou
go to activos views with parameters
if you visit http://www.fsorgosuardi.com.ar/eventos/archivados/ you go to
archivados views (its inactive for now)

what i see is that you construct something like
www.domain.com/customers/customers

--
Rafael E. Ferrero


2014-05-06 18:33 GMT-03:00 G Z :

> The admin page works fine only the other two don't
>
> Project Structure Project Root Directory: provisioning/ this is where
> manage.py lives
>
> Project Settings Directory provisioning/provisioning/settings.py
>
> App Directory provisioning/vmware
>
> template directory /provisioning/vmware/templates/ this is wehre vms.html
> lives
>
> from my project urls.py file
>
> GNU nano 2.2.6  File: provisioning/urls.py
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> # url(r'^$', 'provisioning.views.home', name='home'),
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers', include('vmware.urls')),
> url(r'^test/', include('vmware.urls')),
> )
>
> from my app urls.py file:
>
> from django.conf.urls import patterns, include, url
> from django.views.generic.list import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns('',
> url(r'^customers', ListView.as_view(
> queryset=Customer.objects.all().order_by("-id")[:100],
> template_name="vms.html")),
> )
>
> urlpatterns = patterns('',
> url(r'^test/', ListView.as_view(
> queryset=Customer.objects.all().order_by("-id")[:100],
> template_name="vms.html")),
> )
>
> and then this is the error im getting
>
> Page not found (404)
> Request Method: GET
> Request URL:http://pythondev.enki.co:8001/test
> Using the URLconf defined in provisioning.urls, Django tried these URL 
> patterns, in this order:
> ^admin/
> ^customers
> ^test/
> The current URL, test, didn't match any of these.
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 404 
> page.
>
>
>
>>  --
> 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/fcba60dc-4bc2-4ca4-9e44-e4bc9fd7a5d4%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/CAJJc_8X8jcggBe5Cn_-w5AvZ-7LGUk%3DFrO-zF2xrBQ6MDQU%2BRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z
yea the admin works perfectly fine no issues.

On Monday, May 5, 2014 11:09:51 PM UTC-6, G Z wrote:
>
> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url 
> link customers to myapp.urls because im watching a youtube video and thats 
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design. 
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
> 
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve 
> the page I get the following. It says vmware is not defined but it is 
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>

-- 
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/e6cb919b-2414-4cf4-b3c6-d064839f1517%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z
ok I figured it out all i had to do was change my app urls.py and take out 
customers so now its like this 

from django.conf.urls import patterns, include, url
from django.views.generic.list import ListView
from vmware.models import Customer

urlpatterns = patterns('',
url(r'^', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),
)





On Monday, May 5, 2014 11:09:51 PM UTC-6, G Z wrote:
>
> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url 
> link customers to myapp.urls because im watching a youtube video and thats 
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design. 
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
> 
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve 
> the page I get the following. It says vmware is not defined but it is 
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>

-- 
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/37c3f512-f106-4d9f-b3a4-b0a1bca55afd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z


The admin page works fine only the other two don't

Project Structure Project Root Directory: provisioning/ this is where 
manage.py lives 

Project Settings Directory provisioning/provisioning/settings.py 

App Directory provisioning/vmware 

template directory /provisioning/vmware/templates/ this is wehre vms.html 
lives

from my project urls.py file

GNU nano 2.2.6  File: provisioning/urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# url(r'^$', 'provisioning.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^customers', include('vmware.urls')),
url(r'^test/', include('vmware.urls')),
)

from my app urls.py file:

from django.conf.urls import patterns, include, url
from django.views.generic.list import ListView
from vmware.models import Customer

urlpatterns = patterns('',
url(r'^customers', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),
)

urlpatterns = patterns('',
url(r'^test/', ListView.as_view(
queryset=Customer.objects.all().order_by("-id")[:100],
template_name="vms.html")),
)

and then this is the error im getting

Page not found (404)
Request Method: GET
Request URL:http://pythondev.enki.co:8001/test
Using the URLconf defined in provisioning.urls, Django tried these URL 
patterns, in this order:
^admin/
^customers
^test/
The current URL, test, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.



>

-- 
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/fcba60dc-4bc2-4ca4-9e44-e4bc9fd7a5d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread Rafael E. Ferrero
if you try http://pythondev.enki.co:8001/admin works just fine ?



--
Rafael E. Ferrero


2014-05-06 17:40 GMT-03:00 G Z :

> Thanks so much one last thing
>>
>
> Page not found (404)Request Method:GETRequest URL:
> http://pythondev.enki.co:8001/customers
>
> Using the URLconf defined in provisioning.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>2. ^customers/
>
> The current URL, customers, didn't match any of these.
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> I got it to work but its still not seeing the customers url is my regex
> wrong?
>
> --
> 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/46bc38b8-a024-407f-8f6a-db3c62255afa%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/CAJJc_8VUgrEsYHdAf8NR414OqeHaS-d%2B7%3DDzBkw2AKMJ4UUE4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> Thanks so much one last thing
>

Page not found (404)Request Method:GETRequest URL:
http://pythondev.enki.co:8001/customers

Using the URLconf defined in provisioning.urls, Django tried these URL 
patterns, in this order:

   1. ^admin/
   2. ^customers/

The current URL, customers, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.

I got it to work but its still not seeing the customers url is my regex 
wrong? 

-- 
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/46bc38b8-a024-407f-8f6a-db3c62255afa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> Whats wrong with this 
>


from django.conf.urls import patterns, include, url
from django.view.generic import ListView
from vmware.models import Customer

urlpatterns = patterns(' ',
  url(r'^customers/', ListView.as_view(

queryset=Customer.objects.all().order_by"-id")[:100],
template_name="VMS.html")),
)
 

This should take the model Customer and take the fields -id in the database 
and order them by that correct.

-- 
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/f1207503-ce22-4e05-bed7-ab1bed245560%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread C. Kirby
At first glance you are missing a paren:
   queryset=Customer.objects.all().order_by"-id")[:100]
should be:
   queryset=Customer.objects.all().order_by("-id")[:100]

Are you using an IDE? It should have picked that up

kirby

On Tuesday, May 6, 2014 1:38:34 PM UTC-5, G Z wrote:
>
> Whats wrong with this 
>>
>
> 
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns(' ',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>  
>
> This should take the model Customer and take the fields -id in the 
> database and order them by that correct.
>

-- 
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/9100b8fe-fc4b-4dda-abca-cf1f50bfc9fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread C. Kirby
I strongly recommend the tutorial provided by django, and I would do the 
tutorial as it is to start, not with your own models. Really understand the 
concepts as they are written, then apply those concepts to your project.

Kirby

On Tuesday, May 6, 2014 1:16:46 PM UTC-5, G Z wrote:
>
> in fact here is the tutorial series I was following
>>
>
>
> https://www.youtube.com/watch?v=KqN4u28T-JQ&list=PLQVvvaa0QuDcTDEowl-b5nQlaDaD82r_s
>  
>

-- 
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/26fde6f5-2bcf-4a6c-83a4-8aa6b74d8171%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread C. Kirby
Sorry, it's been a while since I looked at the tutorial, to make the 
tutorial more straightforward it uses a simplified project layout.
I looked at your urls again, and the error is that you forgot quotes. 
url(r'^customers/', include(vmware.urls)),
should be
url(r'^customers/', include('vmware.urls')),

and you should remove the from . import vmware

Kirby

On Tuesday, May 6, 2014 1:05:30 PM UTC-5, G Z wrote:
>
> I'm following the django tutorial
>
> the project is provisioning
> I created the folder provisioning folder, then ran startproject 
> provisioning which has manage.py then it creates the subfolder provisioning 
> which has the init.py file and settings etc.
> then from the root directory of my project folder the first level or 
> provisioning where manage.py is i used startapp command and it created 
> vmware so from the root directory of the project provisioning it created 
> provisioning for the project and it created vmware. That is following the 
> tutorial on djangoproject.com
>
> so how did I do it wrong?
>
> On Monday, May 5, 2014 11:09:51 PM UTC-6, G Z wrote:
>>
>> project name = provisioning
>> app name = vmware
>>
>> In my projects urls.py I have the following. I assume I set the new url 
>> link customers to myapp.urls because im watching a youtube video and thats 
>> what he did.
>>
>> from django.conf.urls import patterns, include, url
>> from django.contrib import admin
>> admin.autodiscover()
>> urlpatterns = patterns('',
>> url(r'^admin/', include(admin.site.urls)),
>> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
>> appsname.urls
>> )
>>
>> In my vmware directory I have the urls.py file as the video had me 
>> design. To which I have the following code:
>>
>> from django.conf.urls import patterns, include, url
>> from django.view.generic import ListView
>> from vmware.models import Customer
>> 
>> urlpatterns = patterns('',
>>   url(r'^customers/', ListView.as_view(
>> 
>> queryset=Customer.objects.all().order_by"-id")[:100],
>> template_name="VMS.html")),
>> )
>>
>> Now when I syncdb and runserver I get no erros. But when I try to resolve 
>> the page I get the following. It says vmware is not defined but it is 
>> defined in my installed apps.
>>
>> Environment:
>>
>>
>> Request Method: GET
>> Request URL: http://23.239.206.142:8001/admin/
>>
>> Django Version: 1.6.4
>> Python Version: 2.7.3
>> Installed Applications:
>> ('django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'vmware')
>> Installed Middleware:
>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>
>>
>> Traceback:
>> File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
>> get_response
>>   101. resolver_match = 
>> resolver.resolve(request.path_info)
>> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
>> in resolve
>>   337. for pattern in self.url_patterns:
>> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
>> in url_patterns
>>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
>> self.urlconf_module)
>> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
>> in urlconf_module
>>   360. self._urlconf_module = import_module(self.urlconf_name)
>> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" 
>> in import_module
>>   40. __import__(name)
>> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>>   12. url(r'^customers/', include(vmware.urls)),
>>
>> Exception Type: NameError at /admin/
>> Exception Value: name 'vmware' is not defined
>>
>>

-- 
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/e0a012f6-d55f-45bf-8ab6-82c4583550ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> in fact here is the tutorial series I was following
>

https://www.youtube.com/watch?v=KqN4u28T-JQ&list=PLQVvvaa0QuDcTDEowl-b5nQlaDaD82r_s
 

-- 
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/744a5acf-36e3-4fbc-8d57-1464411ef6da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z
I'm following the django tutorial

the project is provisioning
I created the folder provisioning folder, then ran startproject 
provisioning which has manage.py then it creates the subfolder provisioning 
which has the init.py file and settings etc.
then from the root directory of my project folder the first level or 
provisioning where manage.py is i used startapp command and it created 
vmware so from the root directory of the project provisioning it created 
provisioning for the project and it created vmware. That is following the 
tutorial on djangoproject.com

so how did I do it wrong?

On Monday, May 5, 2014 11:09:51 PM UTC-6, G Z wrote:
>
> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url 
> link customers to myapp.urls because im watching a youtube video and thats 
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design. 
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
> 
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve 
> the page I get the following. It says vmware is not defined but it is 
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>

-- 
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/af2af0fc-0239-4046-91ff-e789d5acd498%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread C. Kirby
G Z,
That is a somewhat odd project structure. Also, the ls you posted:

directory structure provisioning is the project vmware is the app.
drwxr-xr-x 4 root root 4096 May  5 20:12 .
drwxr-xr-x 3 root root 4096 May  5 19:09 ..
-rw-r--r-- 1 root root  255 May  5 19:09 manage.py
drwxr-xr-x 2 root root 4096 May  6 11:15 provisioning
drwxr-xr-x 3 root root 4096 May  6 11:15 vmware

Does not match the path you posted:
/djangoprojects/provisioning/vmware/modesl.py

In particular there is not __init__.py in that root folder, so imports 
cannot traverse through it. Take a look at 
https://github.com/twoscoops/django-twoscoops-project for a project layout. 
If you use that the project_name would be provisioning and you would put 
the vmware app in 

 

django-twoscoops-project/
 
project_name/
 
*project_name* /
Have you done the tutorial on django yet? I think you will find the answer 
to most of the questions you have posted if you walk through and do the 
tutorial: https://docs.djangoproject.com/en/1.6/intro/tutorial01/

Kirby 

On Tuesday, May 6, 2014 12:38:22 PM UTC-5, G Z wrote:
>
> I'm running 1.6.4
>>
>> Project Structure
> Project name: provisioning
> App Name: vmware
>
>  
>
>> /djangoprojects/provisioning/provisioning/urls.py
>> 
>>
>> from django.conf.urls import patterns, include, url
>>
>> from django.contrib import admin
>> admin.autodiscover()
>> from . import vmware
>>
>> urlpatterns = patterns('',
>> # Examples:
>> # url(r'^$', 'provisioning.views.home', name='home$
>> # url(r'^blog/', include('blog.urls')),
>>
>> url(r'^admin/', include(admin.site.urls)),
>> url(r'^customers/', include(vmware.urls)),
>> )
>> 
>>
>> /djangoprojects/provisioning/vmware/urls.py
>>
>> 
>> from django.conf.urls import patterns, include, url
>> from django.view.generic import ListView
>> from vmware.models import Customer
>>
>> urlpatterns = patterns('',
>>   url(r'^customers/', ListView.as_$
>> queryset=Customer.obje$
>> template_name="VMS.htm$
>> )
>> 
>>
>
> /djangoprojects/provisioning/provisioning/settings.py 
> 
>
>>
>> INSTALLED_APPS = (
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'vmware',
>> )
>>
>> 
>>
>> Directory Structure
>>
>> directory structure provisioning is the project vmware is the app.
>> drwxr-xr-x 4 root root 4096 May  5 20:12 .
>> drwxr-xr-x 3 root root 4096 May  5 19:09 ..
>> -rw-r--r-- 1 root root  255 May  5 19:09 manage.py
>> drwxr-xr-x 2 root root 4096 May  6 11:15 provisioning
>> drwxr-xr-x 3 root root 4096 May  6 11:15 vmware
>>
>>
>> /djangoprojects/provisioning/vmware/modesl.py
>>
>>  
>
>> from django.db import models
>>
>> # Create your models here.
>>
>> class Customer(models.Model):
>> NAME = models.CharField(max_length=200)
>> WEBSITE = models.CharField(max_length=200)
>> PHONE = models.CharField(max_length=200)
>> EMAIL = models.CharField(max_length=200)
>> ADDRESS = models.CharField(max_length=200)
>> VMIDS = models.CharField(max_length=200)
>>
>> def __unicode__(self):
>> return self.NAME
>> #   return self.NAME
>>
>> class Vms(models.Model):
>> VMID  = models.CharField(max_length=200)
>> VMNAME = models.CharField(max_length=200)
>> VMSTATUS = models.CharField(max_length=200)
>> CUSTOMERID = models.ForeignKey(Customer)
>>
>> class Vmspecs(models.Model):
>> CPUS =  models.CharField(max_length=200)
>> CORES =  models.CharField(max_length=200)
>> MEMORY =  models.CharField(max_length=200)
>> HDSPACE =  models.CharField(max_length=200)
>> OS =  models.CharField(max_length=200)
>> UPTIME = models.CharField(max_length=200)
>> VMID = models.ForeignKey(Vms)
>>
>>   #  choice_text = models.CharField(max_length=200)
>> 
>>
>
> need anything else. 
>

-- 
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/80b09896-2598-485c-805e-efa40b35dd81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> I'm running 1.6.4
>
> Project Structure
Project name: provisioning
App Name: vmware

 

> /djangoprojects/provisioning/provisioning/urls.py
> 
>
> from django.conf.urls import patterns, include, url
>
> from django.contrib import admin
> admin.autodiscover()
> from . import vmware
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'provisioning.views.home', name='home$
> # url(r'^blog/', include('blog.urls')),
>
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)),
> )
> 
>
> /djangoprojects/provisioning/vmware/urls.py
>
> 
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_$
> queryset=Customer.obje$
> template_name="VMS.htm$
> )
> 
>

/djangoprojects/provisioning/provisioning/settings.py 


>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'vmware',
> )
>
> 
>
> Directory Structure
>
> directory structure provisioning is the project vmware is the app.
> drwxr-xr-x 4 root root 4096 May  5 20:12 .
> drwxr-xr-x 3 root root 4096 May  5 19:09 ..
> -rw-r--r-- 1 root root  255 May  5 19:09 manage.py
> drwxr-xr-x 2 root root 4096 May  6 11:15 provisioning
> drwxr-xr-x 3 root root 4096 May  6 11:15 vmware
>
>
> /djangoprojects/provisioning/vmware/modesl.py
>
>  

> from django.db import models
>
> # Create your models here.
>
> class Customer(models.Model):
> NAME = models.CharField(max_length=200)
> WEBSITE = models.CharField(max_length=200)
> PHONE = models.CharField(max_length=200)
> EMAIL = models.CharField(max_length=200)
> ADDRESS = models.CharField(max_length=200)
> VMIDS = models.CharField(max_length=200)
>
> def __unicode__(self):
> return self.NAME
> #   return self.NAME
>
> class Vms(models.Model):
> VMID  = models.CharField(max_length=200)
> VMNAME = models.CharField(max_length=200)
> VMSTATUS = models.CharField(max_length=200)
> CUSTOMERID = models.ForeignKey(Customer)
>
> class Vmspecs(models.Model):
> CPUS =  models.CharField(max_length=200)
> CORES =  models.CharField(max_length=200)
> MEMORY =  models.CharField(max_length=200)
> HDSPACE =  models.CharField(max_length=200)
> OS =  models.CharField(max_length=200)
> UPTIME = models.CharField(max_length=200)
> VMID = models.ForeignKey(Vms)
>
>   #  choice_text = models.CharField(max_length=200)
> 
>

need anything else. 

-- 
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/d50d39a3-89c8-40ea-8472-3fd3f06813c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Linking Multiple Mysql tables with unique identifiers

2014-05-06 Thread G Z
So I'm trying to set up my django app and I want to link multiple tables 
each with a unique key identifier. To test this i have the following 
models. py

from django.db import models

# Create your models here.
class Customer(models.Model):
NAME = models.CharField(max_length=200)
WEBSITE = models.CharField(max_length=200)
PHONE = models.CharField(max_length=200)
EMAIL = models.CharField(max_length=200)
ADDRESS = models.CharField(max_length=200)
VMIDS = models.CharField(max_length=200)

def __unicode__(self):
return self.NAME
#   return self.NAME

class Vms(models.Model):
VMID  = models.CharField(max_length=200)
VMNAME = models.CharField(max_length=200)
VMSTATUS = models.CharField(max_length=200)
CUSTOMERID = models.ForeignKey(Customer)

def __unicode__(self):
return self.VMNAME
class Vmspecs(models.Model):
CPUS =  models.CharField(max_length=200)
CORES =  models.CharField(max_length=200)
MEMORY =  models.CharField(max_length=200)
HDSPACE =  models.CharField(max_length=200)
OS =  models.CharField(max_length=200)
UPTIME = models.CharField(max_length=200)
VMID = models.ForeignKey(Vms)

def __unicode__(self):
return self.VMID


If works fantastic until I try to add a vmspecs in the admin panel and link 
it to a VM it gives the following error







Environment:


Request Method: POST
Request URL: http://pythondev.enki.co:8001/admin/vmware/vmspecs/add/

Django Version: 1.6.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'vmware')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
  114. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)
File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in 
wrapper
  432. return self.admin_site.admin_view(view)(*args, 
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapped_view
  99. response = view_func(request, *args, **kwargs)
File 
"/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" 
in _wrapped_view_func
  52. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" 
in inner
  198. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapper
  29. return bound_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapped_view
  99. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
bound_func
  25. return func(self, *args2, **kwargs2)
File "/usr/local/lib/python2.7/dist-packages/django/db/transaction.py" in 
inner
  371. return func(*args, **kwargs)
File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in 
add_view
  1133. self.log_addition(request, new_object)
File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in 
log_addition
  600. action_flag=ADDITION
File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/models.py" in 
log_action
  19. e = self.model(None, None, user_id, content_type_id, 
smart_text(object_id), object_repr[:200], action_flag, change_message)

Exception Type: TypeError at /admin/vmware/vmspecs/add/
Exception Value: 'Vms' object has no attribute '__getitem__'


-- 
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/9bf12028-78cb-4d59-ba9f-94857aee0d3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Urls.py Question

2014-05-06 Thread G Z
I'm running 1.6.4

yes vmware is in my installed apps i used from . import vmware
if I dont try to link my appurls to project urls and just use admin site 
all my stuff works correctly its just when i try to add vmare

project.urls


from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()
from . import vmware

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

url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include(vmware.urls)),
)


app.urls


from django.conf.urls import patterns, include, url
from django.view.generic import ListView
from vmware.models import Customer

urlpatterns = patterns('',
  url(r'^customers/', ListView.as_$
queryset=Customer.obje$
template_name="VMS.htm$
)


settings.py


INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'vmware',
)


INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'vmware',
)


directory structure provisioning is the project vmware is the app.
drwxr-xr-x 4 root root 4096 May  5 20:12 .
drwxr-xr-x 3 root root 4096 May  5 19:09 ..
-rw-r--r-- 1 root root  255 May  5 19:09 manage.py
drwxr-xr-x 2 root root 4096 May  6 11:15 provisioning
drwxr-xr-x 3 root root 4096 May  6 11:15 vmware



models.py

from django.db import models

# Create your models here.

class Customer(models.Model):
NAME = models.CharField(max_length=200)
WEBSITE = models.CharField(max_length=200)
PHONE = models.CharField(max_length=200)
EMAIL = models.CharField(max_length=200)
ADDRESS = models.CharField(max_length=200)
VMIDS = models.CharField(max_length=200)

def __unicode__(self):
return self.NAME
#   return self.NAME

class Vms(models.Model):
VMID  = models.CharField(max_length=200)
VMNAME = models.CharField(max_length=200)
VMSTATUS = models.CharField(max_length=200)
CUSTOMERID = models.ForeignKey(Customer)

class Vmspecs(models.Model):
CPUS =  models.CharField(max_length=200)
CORES =  models.CharField(max_length=200)
MEMORY =  models.CharField(max_length=200)
HDSPACE =  models.CharField(max_length=200)
OS =  models.CharField(max_length=200)
UPTIME = models.CharField(max_length=200)
VMID = models.ForeignKey(Vms)

  #  choice_text = models.CharField(max_length=200)



-- 
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/a1c5481d-6eb8-418c-bb6d-b09aa7024c60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread C. Kirby
Please post your project structure - that will help to clear up the import

On Tuesday, May 6, 2014 11:28:28 AM UTC-5, G Z wrote:
>
> so in my project.urls file i put
>>
>
>  from . import vmware
>
> do i have to add anything to my apps.urls because i got the following 
> error after adding the folllowing
>
> from django.contrib import admin
> admin.autodiscover()
> from . import vmware
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'provisioning.views.home', name='home'),
> # url(r'^blog/', include('blog.urls')),
>
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)),
> )
>
>
> Error
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   5. from . import vmware
>
> Exception Type: ImportError at /
> Exception Value: cannot import name vmware
>

-- 
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/7e8918c2-e5b6-49d5-b5ce-b4f59b8945ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Models and Admin Site Question

2014-05-06 Thread G Z
Thank you so much I dont know why i didnt catch that. Can you help me with 
my other post abotu urls?

-- 
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/837e12c9-75bb-49d6-9a9e-3eacecdf9357%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Models and Admin Site Question

2014-05-06 Thread C. Kirby
It looks like you have an indentation error. your __unicode__ method is 
should be a method in the Customer class, so it should be indented inside 
it. Right now it is outside the class namespace

On Tuesday, May 6, 2014 11:44:46 AM UTC-5, G Z wrote:
>
> so in my models .py file I have 
>
>
> from django.db import models
>
> # Create your models here.
>
> class Customer(models.Model):
> NAME = models.CharField(max_length=200)
> WEBSITE = models.CharField(max_length=200)
> PHONE = models.CharField(max_length=200)
> EMAIL = models.CharField(max_length=200)
> ADDRESS = models.CharField(max_length=200)
> VMIDS = models.CharField(max_length=200)
>
> def __unicode__(self):
> return self.NAME
> #   return self.NAME
>
> class Vms(models.Model):
> VMID  = models.CharField(max_length=200)
> VMNAME = models.CharField(max_length=200)
> VMSTATUS = models.CharField(max_length=200)
> CUSTOMERID = models.ForeignKey(Customer)
>
> class Vmspecs(models.Model):
> CPUS =  models.CharField(max_length=200)
> CORES =  models.CharField(max_length=200)
> MEMORY =  models.CharField(max_length=200)
> HDSPACE =  models.CharField(max_length=200)
> OS =  models.CharField(max_length=200)
> UPTIME = models.CharField(max_length=200)
> VMID = models.ForeignKey(Vms)
>
> On my admin stite it doesnt return self.NAME as the customer name it just 
> returns the word customer object for entries and im not sure why.
>

-- 
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/0965db5a-e0ea-480b-af19-740452bdd4c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Models and Admin Site Question

2014-05-06 Thread G Z
so in my models .py file I have 


from django.db import models

# Create your models here.

class Customer(models.Model):
NAME = models.CharField(max_length=200)
WEBSITE = models.CharField(max_length=200)
PHONE = models.CharField(max_length=200)
EMAIL = models.CharField(max_length=200)
ADDRESS = models.CharField(max_length=200)
VMIDS = models.CharField(max_length=200)

def __unicode__(self):
return self.NAME
#   return self.NAME

class Vms(models.Model):
VMID  = models.CharField(max_length=200)
VMNAME = models.CharField(max_length=200)
VMSTATUS = models.CharField(max_length=200)
CUSTOMERID = models.ForeignKey(Customer)

class Vmspecs(models.Model):
CPUS =  models.CharField(max_length=200)
CORES =  models.CharField(max_length=200)
MEMORY =  models.CharField(max_length=200)
HDSPACE =  models.CharField(max_length=200)
OS =  models.CharField(max_length=200)
UPTIME = models.CharField(max_length=200)
VMID = models.ForeignKey(Vms)

On my admin stite it doesnt return self.NAME as the customer name it just 
returns the word customer object for entries and im not sure why.

-- 
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/67338a4c-991a-41a7-acb2-00b66e519f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> so in my project.urls file i put
>

 from . import vmware

do i have to add anything to my apps.urls because i got the following error 
after adding the folllowing

from django.contrib import admin
admin.autodiscover()
from . import vmware

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

url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include(vmware.urls)),
)


Error
Environment:


Request Method: GET
Request URL: http://23.239.206.142:8001/

Django Version: 1.6.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'vmware')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
  101. resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in resolve
  337. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in url_patterns
  365. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in urlconf_module
  360. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
import_module
  40. __import__(name)
File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
  5. from . import vmware

Exception Type: ImportError at /
Exception Value: cannot import name vmware

-- 
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/16c584f7-a3e5-479b-89f2-64d427830413%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Loading data in migrations

2014-05-06 Thread J Y
I would like to know this also.  Can anyone provide an example of how to do 
this in 1.7?  The doc leaves a lot to the imagination.  I'd be willing to 
help update the docs if there's guidance on what the official "sanctioned" 
approach is to replicate the same functionality, that behaves like the 
initial_data files.

On Saturday, April 26, 2014 1:51:41 PM UTC-7, Tim Chase wrote:
>
> According to [1] 
>
> """ 
> [automatically loading initial data via fixtures is d]eprecated since 
> version 1.7: If an application uses migrations, there is no automatic 
> loading of fixtures. Since migrations will be required for 
> applications in Django 1.9, this behavior is considered deprecated. 
> If you want to load initial data for an app, consider doing it in a 
> migration. 
> """ 
>
> However, the docs don't link to how that data should be furnished to 
> the migration.  As best I can tell from reading[2], it sounds like 
> one needs to create a Python function that creates & saves the data, 
> and then provide that function to migrations.RunPython to be 
> executed.  Is this correct, or is there some easier way to provide 
> that initial data to an app? 
>
> Thanks, 
>
> -tkc 
>
> [1] 
>
> https://docs.djangoproject.com/en/dev/howto/initial-data/#automatically-loading-initial-data-fixtures
>  
>
> [2] 
> https://docs.djangoproject.com/en/dev/topics/migrations/ 
>

-- 
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/5a94f5dd-7865-408e-ac7a-247384f1eaf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread Davide Scatto
it seems in yr project urls.py you don't import vmware.
 
  from django.conf.urls import patterns, include, url
  from django.contrib import admin
  from . import vmware

  urlpatterns = patterns
 

Il giorno martedì 6 maggio 2014 07:09:51 UTC+2, G Z ha scritto:
>
> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url 
> link customers to myapp.urls because im watching a youtube video and thats 
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design. 
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
> 
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve 
> the page I get the following. It says vmware is not defined but it is 
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>

-- 
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/a1232c90-22fe-45d5-abf3-53b51827c483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z

>
> and yes vmware is defined in installed apps.
>

-- 
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/72180aaf-7920-48e3-8f33-2e90db8be0ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread G Z
I'm not trying to set up the admin stie. I have already done that the admin 
site works im trying to set up the /customers site. Which I have defined 
below. I have it set in the projects urls.py to link to vmware.urls then i 
have the urls.py in the app vmware pointing to my templates to display data 
but its telling me vmware is undefined.

On Monday, May 5, 2014 11:09:51 PM UTC-6, G Z wrote:
>
> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url 
> link customers to myapp.urls because im watching a youtube video and thats 
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design. 
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
> 
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve 
> the page I get the following. It says vmware is not defined but it is 
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>

-- 
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/5ef29ee9-9741-4866-a942-462cabf275e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7 not working with mysql-connector-python 1.1.6 & Python 3.3 ?

2014-05-06 Thread Richard Esplin
In order to move forward with this project, I switched to PyMySQL:

https://github.com/PyMySQL

It appears to work great. In order to use the default Django backend for 
MySQL, I put this in my settings.py:

import pymysql
pymysql.install_as_MySQLdb()

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
. . . .

I have a few months of testing before I'll know if it is reliable, but at 
least I can move forward with development.

Richard

On Monday, May 5, 2014 6:45:19 PM UTC-6, Richard Esplin wrote:
>
> I can't find any evidence on the interwebs of someone successfully using 
> the Mysql-Connector-Python with Django 1.7. So I reported it as an issue in 
> the MySQL bug database:
>
> http://bugs.mysql.com/bug.php?id=72542
>
> If anyone has a suggestion for using MySQL with Python 3 and Django 1.7, I 
> would appreciate hearing them.
>
> Thanks,
>
> Richard
>
> On Monday, May 5, 2014 6:17:57 PM UTC-6, Richard Esplin wrote:
>>
>> I am also trying to use Django 1.7 with the Mysql-Python-Connector 1.1.6. 
>> I am seeing the same behavior for both the migrate NotImplementedError and 
>> the syncdb RemovedInDjango19Warrning.
>>
>> Were you able to solve these problems?
>>
>> Richard
>>
>> On Thursday, April 3, 2014 9:09:31 AM UTC-6, Giovanni wrote:
>>>
>>> Documentation states:
>>>
>>>- 
>>>
>>>syncdb has been deprecated and replaced by migrate. Don’t worry - 
>>>calls to syncdb will still work as before.
>>>
>>>
>>> But when I run $ python manage.py syncdb,
>>> it stops with a django.utils.deprecation.RemovedInDjango19Warning.
>>>
>>> So I can't seem to use syncdb either.
>>>
>>>
>>> On Wednesday, April 2, 2014 6:42:55 PM UTC-4, Giovanni wrote:

 I upgraded from django 1.6 to 1.7b1 and now it seems like as soon as I 
 want to do anything that interacts with mysql, I keep getting this error:

 NotImplementedError: subclasses of BaseDatabaseWrapper may require a 
 schema_editor() method

 In Python I can import mysql.connector just fine.
 I've reinstalled mysql 5.6.17 community server.

 Any ideas?

>>>

-- 
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/fb7f6911-e755-46ff-9cb3-cb7150e712e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is different of handling character code between pure Python and Django?

2014-05-06 Thread Sithembewena Lloyd Dube
That should be ".encode('utf-8') - it is separated by a dash.


On Tue, May 6, 2014 at 4:31 PM, 杉田臣輔  wrote:

> Hello
>
> Thank you for replying.
> I tried to use the ".encode('utf8')" method before.
>
> I also tried your suggestion. But error happened like below.
>
> 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in
> range(128)
>
>
>
>
> 2014-05-06 17:10 GMT+09:00 Hannu Krosing :
>
>>  On 05/06/2014 08:28 AM, Sugita Shinsuke wrote:
>>
>> ...
>>
>>
>>> If it is the cause. Can I change encode type of locale.
>>> getpreferredencoding?
>>>
>>  ...
>>
>>>
 > So, I run the stand-alone Python program like below could run fine.
 > —
 > java_file = ‘javaprogram’
 > file_name = ‘filename’
 > text = ‘あいうえお’ #Japanese character
 > java_file_path = ‘/path/to/‘
 > class_path = ‘-cp ' + java_file_path
 >
 > cmd = “java {0} {1} {2} {3}".format(class_path, java_file, text,
 file_name)

>>>You can check if encoding the arguments manually works:
>>
>> cmd = "java {0} {1} {2} {3}".format(*[s.encode('utf8') for s in
>> (class_path, java_file, text, file_name)])
>>
>>
>> Cheers
>>
>> --
>> Hannu Krosing
>> PostgreSQL Consultant
>> Performance, Scalability and High Availability
>> 2ndQuadrant Nordic OÜ
>>
>>
>  --
> 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/CAJ5zBj6H-HE60KJpB4-KbQkE9sY5Hri_vnQApeSPGSbkzLMV9g%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCDv5mdABctR1V4Gw0w%2B9MzLK%2BY-CMv8zzp8hRm8tyzL8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is different of handling character code between pure Python and Django?

2014-05-06 Thread 杉田臣輔
Hello

Thank you for replying.
I tried to use the ".encode('utf8')" method before.

I also tried your suggestion. But error happened like below.

'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in
range(128)




2014-05-06 17:10 GMT+09:00 Hannu Krosing :

>  On 05/06/2014 08:28 AM, Sugita Shinsuke wrote:
>
> ...
>
>
>> If it is the cause. Can I change encode type of locale.
>> getpreferredencoding?
>>
>  ...
>
>   >
>>> > So, I run the stand-alone Python program like below could run fine.
>>> > —
>>> > java_file = ‘javaprogram’
>>> > file_name = ‘filename’
>>> > text = ‘あいうえお’ #Japanese character
>>> > java_file_path = ‘/path/to/‘
>>> > class_path = ‘-cp ' + java_file_path
>>> >
>>> > cmd = “java {0} {1} {2} {3}".format(class_path, java_file, text,
>>> file_name)
>>>
>>You can check if encoding the arguments manually works:
>
> cmd = "java {0} {1} {2} {3}".format(*[s.encode('utf8') for s in
> (class_path, java_file, text, file_name)])
>
>
> Cheers
>
> --
> Hannu Krosing
> PostgreSQL Consultant
> Performance, Scalability and High Availability
> 2ndQuadrant Nordic OÜ
>
>

-- 
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/CAJ5zBj6H-HE60KJpB4-KbQkE9sY5Hri_vnQApeSPGSbkzLMV9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django URLS help app not defined

2014-05-06 Thread Rafael E. Ferrero
I think that you fail on trying to setup the admin site for your proyect.
check this out https://docs.djangoproject.com/en/1.6/ref/contrib/admin/

--
*RAFAEL FERRERO*

*Chief Officer Technology*
San Francisco Cba. | Argentina
+54 9 356251 4856
www.perseux.com


2014-05-06 2:09 GMT-03:00 G Z :

> project name = provisioning
> app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url
> link customers to myapp.urls because im watching a youtube video and thats
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)), #i'm assuming its my
> appsname.urls
> )
>
> In my vmware directory I have the urls.py file as the video had me design.
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
>
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve
> the page I get the following. It says vmware is not defined but it is
> defined in my installed apps.
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8001/admin/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   12. url(r'^customers/', include(vmware.urls)),
>
> Exception Type: NameError at /admin/
> Exception Value: name 'vmware' is not defined
>
>  --
> 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/031cb075-cdd8-47bf-9a6f-6135209deeb7%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/CAJJc_8WoH4reNeer%2BvbZqXDrC65w7KdyBi5r30Q%2BTT9C9Xmf8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Urls.py Question

2014-05-06 Thread Rafael E. Ferrero
What version of django do you have runing?, do you define an admin for
vmware?

--
Rafael E. Ferrero


2014-05-06 2:50 GMT-03:00 G Z :

> project name = provisioning app name = vmware
>
> In my projects urls.py I have the following. I assume I set the new url
> link customers to myapp.urls because im watching a youtube video and thats
> what he did.
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> url(r'^customers/', include(vmware.urls)),
> )
>
> In my vmware directory I have the urls.py file as the video had me design.
> To which I have the following code:
>
> from django.conf.urls import patterns, include, url
> from django.view.generic import ListView
> from vmware.models import Customer
>
> urlpatterns = patterns('',
>   url(r'^customers/', ListView.as_view(
> 
> queryset=Customer.objects.all().order_by"-id")[:100],
> template_name="VMS.html")),
> )
>
> Now when I syncdb and runserver I get no erros. But when I try to resolve
> the page I get the following. It says vmware is not defined but it is
> defined in my installed apps.
>
> Environment:
> Request Method: GET Request URL: http://23.239.206.142:8001/admin/
> Django Version: 1.6.4 Python Version: 2.7.3 Installed Applications:
> ('django.contrib.admin', 'django.contrib.auth',
> 'django.contrib.contenttypes', 'django.contrib.sessions',
> 'django.contrib.messages', 'django.contrib.staticfiles', 'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
> Traceback: File
> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in
> get_response 101. resolver_match = resolver.resolve(request.path_info) File
> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in
> resolve 337. for pattern in self.url_patterns: File
> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in
> url_patterns 365. patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module) File
> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in
> urlconf_module 360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in
> import_module 40. *import*(name) File
> "/root/djangoprojects/provisioning/provisioning/urls.py" in  12.
> url(r'^customers/', include(vmware.urls)),
> Exception Type: NameError at /admin/ Exception Value: name 'vmware' is not
> defined
>
>  --
> 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/d3990a55-76d9-4b4a-81d0-903a00c021b5%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/CAJJc_8VhNO7G9FUQdvKFj8TFg8XSXR3EYiRAWFXCMyr09HXiOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django URLS help app not defined

2014-05-06 Thread G Z
project name = provisioning
app name = vmware

In my projects urls.py I have the following. I assume I set the new url 
link customers to myapp.urls because im watching a youtube video and thats 
what he did.

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include(vmware.urls)), #i'm assuming its my 
appsname.urls
)

In my vmware directory I have the urls.py file as the video had me design. 
To which I have the following code:

from django.conf.urls import patterns, include, url
from django.view.generic import ListView
from vmware.models import Customer

urlpatterns = patterns('',
  url(r'^customers/', ListView.as_view(

queryset=Customer.objects.all().order_by"-id")[:100],
template_name="VMS.html")),
)

Now when I syncdb and runserver I get no erros. But when I try to resolve 
the page I get the following. It says vmware is not defined but it is 
defined in my installed apps.

Environment:


Request Method: GET
Request URL: http://23.239.206.142:8001/admin/

Django Version: 1.6.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'vmware')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
  101. resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in resolve
  337. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in url_patterns
  365. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
in urlconf_module
  360. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
import_module
  40. __import__(name)
File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
  12. url(r'^customers/', include(vmware.urls)),

Exception Type: NameError at /admin/
Exception Value: name 'vmware' is not defined

-- 
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/031cb075-cdd8-47bf-9a6f-6135209deeb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django URLs problem

2014-05-06 Thread G Z
drwxr-xr-x 4 root root 4096 May  5 20:12 .
drwxr-xr-x 3 root root 4096 May  5 19:09 ..
-rw-r--r-- 1 root root  255 May  5 19:09 manage.py
drwxr-xr-x 2 root root 4096 May  5 22:51 provisioning
drwxr-xr-x 3 root root 4096 May  5 22:22 vmware

my project ursl is as follows

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

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

url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include(vmware.urls)),

Urls.py Question

2014-05-06 Thread G Z


project name = provisioning app name = vmware

In my projects urls.py I have the following. I assume I set the new url 
link customers to myapp.urls because im watching a youtube video and thats 
what he did.

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^customers/', include(vmware.urls)),
)

In my vmware directory I have the urls.py file as the video had me design. 
To which I have the following code:

from django.conf.urls import patterns, include, url
from django.view.generic import ListView
from vmware.models import Customer

urlpatterns = patterns('',
  url(r'^customers/', ListView.as_view(

queryset=Customer.objects.all().order_by"-id")[:100],
template_name="VMS.html")),
)

Now when I syncdb and runserver I get no erros. But when I try to resolve 
the page I get the following. It says vmware is not defined but it is 
defined in my installed apps.

Environment:
Request Method: GET Request URL: http://23.239.206.142:8001/admin/
Django Version: 1.6.4 Python Version: 2.7.3 Installed Applications: 
('django.contrib.admin', 'django.contrib.auth', 
'django.contrib.contenttypes', 'django.contrib.sessions', 
'django.contrib.messages', 'django.contrib.staticfiles', 'vmware') 
Installed Middleware: 
('django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.common.CommonMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.messages.middleware.MessageMiddleware', 
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback: File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
get_response 101. resolver_match = resolver.resolve(request.path_info) File 
"/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
resolve 337. for pattern in self.url_patterns: File 
"/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
url_patterns 365. patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module) File 
"/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
urlconf_module 360. self._urlconf_module = import_module(self.urlconf_name) 
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
import_module 40. *import*(name) File 
"/root/djangoprojects/provisioning/provisioning/urls.py" in  12. 
url(r'^customers/', include(vmware.urls)),
Exception Type: NameError at /admin/ Exception Value: name 'vmware' is not 
defined

-- 
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/d3990a55-76d9-4b4a-81d0-903a00c021b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


pinax-project-account login redirect to dynamic url

2014-05-06 Thread Daniel Kane
 

I'm writing a web app that uses the pinax-project-account and bootstrap. 
When a user logs in the login view should grab the 
ACCOUNT_LOGIN_REDIRECT_URL and redirect the user to it. There seems to be 
an issue with dynamic urls though because when I do this with a static 
/profile/ url, there is no problem. I've traced the stacktrace to it's root 
which is in the account app LoginView  in account.views. It seems that is 
where fallback_url is being assigned the value of 
ACCOUNT_LOGIN_REDIRECT_URL. 


account.views

def get_success_url(self, fallback_url=None, **kwargs):

if fallback_url is None:

fallback_url = settings.ACCOUNT_LOGIN_REDIRECT_URL

kwargs.setdefault("redirect_field_name", self.get_redirect_field_name())

return default_redirect(self.request, fallback_url, **kwargs)

  


   - Below is the rest of my related code. Does anyone know how to resolve 
   this?
   

settings.py

ABSOLUTE_URL_OVERRIDES = {

"user_accounts.userprofile": lambda o: "/profile/%s/" % o.slug,

}

ACCOUNT_LOGIN_REDIRECT_URL = "profile_update"


views.py


class ProfileUpdateView(UpdateView):

template_name = "account/profile.html"

model = UserProfile

context_object_name = "profile"

slug_field = "slug"


urls.py


 url(r"^(?P)/", (ProfileUpdateView.as_view()), name="profile_update")


StackTrace


NoReverseMatch at /account/login/

Reverse for 'profile_update' with arguments '()' and keyword arguments '{}' not 
found. 1 pattern(s) tried: ['profile/(?P)/']

Request Method:POSTRequest URL:http://127.0.0.1:8000/account/login/Django 
Version:1.6.2Exception Type:NoReverseMatchException Value:

Reverse for 'profile_update' with arguments '()' and keyword arguments '{}' not 
found. 1 pattern(s) tried: ['profile/(?P)/']

Exception 
Location:/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/django/core/urlresolvers.py
 
in _reverse_with_prefix, line 429Python Executable:
/home/falcon/dev/tiger/env/bin/pythonPython Version:2.7.5Python Path:

['/home/falcon/dev/tiger/tigersite',
 '/home/falcon/dev/tiger/env/src/idios',
 '/home/falcon/dev/tiger/env/lib/python2.7',
 '/home/falcon/dev/tiger/env/lib/python2.7/plat-i386-linux-gnu',
 '/home/falcon/dev/tiger/env/lib/python2.7/lib-tk',
 '/home/falcon/dev/tiger/env/lib/python2.7/lib-old',
 '/home/falcon/dev/tiger/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-i386-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages']

Server time:Tue, 6 May 2014 00:23:02 +
Traceback Switch to copy-and-paste view

   - 
   
/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/django/core/handlers/base.py
in get_response
   1. 
  
  response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
  
  ...
   ▶ Local vars 
   - 
   
/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/django/views/generic/base.py
in view
   1. 
  
  return self.dispatch(request, *args, **kwargs)
  
  ...
   ▶ Local vars 
   - 
   
/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/django/views/generic/base.py
in dispatch
   1. 
  
  return handler(request, *args, **kwargs)
  
  ...
   ▶ Local vars 
   - 
   
/home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/django/views/generic/edit.py
in post
   1. 
  
  return self.form_valid(form)
  
  ...
   ▶ Local vars 
   - 
   /home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/account/views.py
in form_valid
   1. 
  
  result=form.is_valid()
  
  2. 
  
  )
  
  3. 
  
  return super(LoginView, self).form_invalid(form)
  
  4. 
  
  5. 
  
  def form_valid(self, form):
  
  6. 
  
  self.login_user(form)
  
  7. 
  
  self.after_login(form)
  
  1. 
  
  return redirect(self.get_success_url())
  
  ...
   1. 
  
  2. 
  
  def after_login(self, form):
  
  3. 
  
  signals.user_logged_in.send(sender=LoginView, user=form.user, 
form=form)
  
  4. 
  
  5. 
  
  def get_success_url(self, fallback_url=None, **kwargs):
  
  6. 
  
  if fallback_url is None:
  
  ▶ Local vars 
   - 
   /home/falcon/dev/tiger/env/local/lib/python2.7/site-packages/account/views.py
in get_success_url
   1. 
  
  def after_login(self, form):
  
  2. 
  
  signals.user_logged_in.send(sender=LoginView, user=form.user, 
form=form)

Hide default permission in Django admin form

2014-05-06 Thread Robert Jonathan Šimon
I looked up the answer 
(http://stackoverflow.com/questions/6062655/remove-or-hide-default-permissions-from-django),
 
it worked, but suddenly it stopped working, i am not sure, what i did or if 
I reinstaled something. I have this solution:

from django.contrib import admin
from django.contrib.auth.models import Permission
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.forms import UserChangeForm

#
# In the models listed below standard permissions "add_model", 
"change_model"
# and "delete_model" will be created by syncdb, but hidden from admin 
interface.
# This is convenient in case you use your own set of permissions so the list
# in the admin interface wont be confusing.
# Feel free to add your models here. The first element is the app name 
(this is
# the directory your app is in) and the second element is the name of your 
model
# from models.py module of your app (Note: both names must be lowercased).
#
MODELS_TO_HIDE_STD_PERMISSIONS = (
("auth", "permission"),
("auth", "group"),
("auth", "user"),
("contenttypes", "contenttype"),
("sessions", "session"),
("sites", "site"),
("admin", "logentry"),
("mainpage","novinkymodel"),
("mainpage", "komentarknovinkymodel"),
("mainpage", "clovek"),
("mainpage", "ucitel"),
("mainpage", "trida"),
("mainpage", "predmety"),
("mainpage", "administrator"),
("mainpage", "student"),
("mainpage", "rodic"),
("kalendar", "udalost"),
("fotogalerie", "slozka"),
("fotogalerie", "fotka"),
("south", "migrationhistory")
)

def _get_corrected_permissions():
perms = Permission.objects.all()
for app_name, model_name in MODELS_TO_HIDE_STD_PERMISSIONS:
perms = perms.exclude(content_type__app_label=app_name, 
codename='add_%s' % model_name)
perms = perms.exclude(content_type__app_label=app_name, 
codename='change_%s' % model_name)
perms = perms.exclude(content_type__app_label=app_name, 
codename='delete_%s' % model_name)
return perms

class MyGroupAdminForm(forms.ModelForm):

class Meta:
model = Group

permissions = forms.ModelMultipleChoiceField(
_get_corrected_permissions(),
widget=admin.widgets.FilteredSelectMultiple(('permissions'), False),
help_text = 'Hold down "Control", or "Command" on a Mac, to select 
more than one.'
)

class MyGroupAdmin(GroupAdmin):

form = MyGroupAdminForm

class MyUserChangeForm(UserChangeForm):

user_permissions = forms.ModelMultipleChoiceField(
_get_corrected_permissions(),
widget=admin.widgets.FilteredSelectMultiple(('user_permissions'), 
False),
help_text = 'Hold down "Control", or "Command" on a Mac, to select 
more than one.'
)

class MyUserAdmin(UserAdmin):

form = MyUserChangeForm

admin.site.unregister(Group)
admin.site.register(Group, MyGroupAdmin)
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)



I am using Django 1.6.4 and Python 3.4. This code is in my app and file 
admin.py

-- 
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/2f5c18da-d3ef-45d9-9e30-fb4f8837fb47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Tutor] PyCountry currency formatting woes

2014-05-06 Thread Sithembewena Lloyd Dube
Thanks for this response, this is exactly what I needed to know.


On Mon, May 5, 2014 at 6:26 AM, Marc Tompkins wrote:

> On Sun, May 4, 2014 at 1:55 PM, Sithembewena Lloyd Dube  > wrote:
>
>> Thanks, i was actually getting the error information to update the post.
>> Apoligies to waste your time posting here - I could not find an appropriate
>> PyCountry discussion list and my next best bet seemed to be a Python users'
>> list.
>>
>>
> You also posted on StackOverflow; I just answered you there.  In short:
> the currency numeric is not guaranteed to be the same as the country
> numeric (in the case of the Euro, how could it possibly be?)  The numeric
> for DE is 276; the numeric for the Euro is 978.  Obviously they don't match.
>
> PyCountry is a wrapper around some tables provided by Debian; those tables
> don't include a country/currency mapping.  You can find those mapping
> tables at
>  http://www.currency-iso.org/en/home/tables/table-a1.html
> and roll your own wrapper; I'm sure it's been done a thousand times
> before, but I'm not aware of a Python package that does this.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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/CAH-SnCAxM%2Bnz4%2Bi24QePUHceR_AKovcXbTpnBu%3DBc7R3_1q5ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.