[google-appengine] ViewDoesNotExist

2008-11-20 Thread yinDojo

Hello,

I am new to google app engine and django.  I extracted the Google App
Engine Helper for Django and created an app.  I am trying to do a
simple test of accessing a simple webpage.  Below is the error that i
am getting.  But the views.py is under /mytest/ directory.  I have
attached the error and 2 urls.py.  Any suggestion what i should try.
Thanks.

ViewDoesNotExist at /mytest/
Could not import views. Error was: No module named views
Request Method: GET
Request URL:http://localhost:8082/mytest/
Exception Type: ViewDoesNotExist
Exception Value:Could not import views. Error was: No module named
views
Exception Location: /Applications/GoogleAppEngineLauncher.app/
Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/lib/django/django/core/urlresolvers.py in
_get_callback, line 127




#  urls.py
-
# this urls.py is located under appengine_django folder
from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^foo/', include('foo.urls')),

# Uncomment this for admin:
 (r'^admin/', include('django.contrib.admin.urls')),

  (r'^mytest/', include('mytest.urls')),

)




#  urls.py
-
# this urls.py is located under mytest folder
from django.conf.urls.defaults import *


urlpatterns = patterns('',

  (r'^$', 'views.index'),
   (r'^sign$', 'views.sign'),
)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: ViewDoesNotExist

2008-11-22 Thread yinDojo

Thanks for replying.  i got it to work.  :)  but i have to scope the
folder itselft.

(r'^sign$', 'mytest.views.sign'),

On Nov 20, 5:08 pm, Waldemar Kornewald <[EMAIL PROTECTED]> wrote:
> Hi!
>
> On Nov 20, 5:18 pm,yinDojo<[EMAIL PROTECTED]> wrote:
>
> > #  urls.py
> > -
> > # this urls.py is located under mytest folder
> > from django.conf.urls.defaults import *
>
> > urlpatterns = patterns('',
>
> >   (r'^$', 'views.index'),
> >    (r'^sign$', 'views.sign'),
> > )
>
> Please try this:
>
> urlpatterns = patterns('mytest.views',
>     (r'^$', 'index'),
>     (r'^sign$', 'sign'),
> )
>
> BTW, the admin interface doesn't work out of the box on App Engine.
> There's some code floating around that makes it work, but I don't know
> if it works with Django 
> 1.0.2:http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> Bye,
> Waldemar Kornewald
> --
> Shameless plug :)
> app-engine-patch: Use Django on App Engine - with lots of 
> goodieshttp://code.google.com/p/app-engine-patch/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] page not found (404)

2008-11-23 Thread yinDojo

Hello,

I get the below error after i click on the submit button.  I am trying
to save data from an input box to the datastore.  the line   , saveBUser should be a function in
the vews.py correct?  I have the feeling i am not giving this the
correct path.

I have included urls.py, views.py, step1_form.html, and forms.py.  Any
suggestion will be appreciated.  Thank you.

#   error that is coming back
---
Using the URLconf defined in urls, Django tried these URL patterns, in
this order:

   1. ^admin/
   2. ^mytest$

The current URL, /saveBUser, didn't match any of these.


#---
My urls.py one directory above my app. is :

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^foo/', include('foo.urls')),

# Uncomment this for admin:
 (r'^admin/', include('django.contrib.admin.urls')),

  (r'^mytest$', include('mytest.urls')),

)

#-
My urls.py at the app level is:

from django.conf.urls.defaults import *

urlpatterns = patterns('mytest.views',
  #(r'^$', 'mytest.views.index'),
  #(r'^views$', 'mytest.views.saveBusinessUser'),
(r'^$', 'index'),
(r'^saveBUser$', 'mytest.views.saveBUser'),
)


#
#My step1_form.html is:



{% if posts %}
  {% for saveBUser in posts %}
{% if saveBUser.firstName %}
  {{ saveBUser.firstName.nickname }} wrote:
{% else %}
  An anonymous person wrote:
{% endif %}
{{ saveBUser.firstName }}
  {% endfor %}
{% endif %}


  
{{ form.as_table }}
  
  





#-
#My views.py is:

def index(request):
  query = BusinessUser.gql('ORDER BY date DESC')
  form = AcctRegistration()
  return render_to_response('step1_form.html',
{'posts': query.fetch(20),
 'form': form
}
   )

def saveBUser(request):
  form = AcctRegistration(request.POST)
  if form.is_valid():
saveBUser = BusinessUser(firstName=form.clean_data['firstName'])

if users.GetCurrentUser():
  saveBUser.firstName = BusinessUser(firstName=form.clean_data
['firstName'])
  saveBUser.firstName = users.GetCurrentUser()

  saveBUser.put()

# ---   forms.py -

from django import newforms as forms

class AcctRegistration(forms.Form):
firstName=forms.CharField(label='First Name')

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] form.as_p

2008-12-21 Thread yinDojo

Hello, the following code will list all the attributes from my
models.py,  how can i get it to just show the attrubute that i want.


   {{form.as_p }}





for example, I just want to show the first name and last name of the
attributes and save them to the database once the form is submitted.


  
  
  




Thanks,
yinDojo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: form.as_p

2008-12-23 Thread yinDojo

The HTML is showing all the attributes from my models.py.  I only want
to show first name and last name. In views.py, only first_name and
last_name were listed, why are the rest of the attribute show up in
the html page?  How do i limit to a selection of attributes to show up
in an html page.
So i did more research and look at examples, below is my new attempt.

I really apprecaited the respond.

Regards,
-T

= models.py ===
class BusinessUser(db.Model):
"""Basic user profile with personal details."""
first_name = db.StringProperty()
last_name = db.StringProperty()
street_address = db.StringProperty()
city =  db.StringProperty()
state = db.StringProperty()
zip_code = db.StringProperty()

= form.html =
{% extends 'layout.html' %}
{% block title %}Create person{% endblock %}

{% block content %}


  {{ form.as_ul}}





{% endblock %}



  views.py =
class CreateBusinessForm(djangoforms.ModelForm):
class Meta:
model = BusinessUser
fields = ['first_name','last_name']

def add_person(request):
if request.method == 'POST': # If the form has been submitted...
form = CreateBusinessForm(request.POST)
if form.is_valid():
post = 
BusinessUser(first_name=form.clean_data['first_name'])
post = 
BusinessUser(first_name=form.clean_data['last_name'])
post.put()
return HttpResponseRedirect('/')
else:
form = CreateBusinessForm()
return create_object(request, BusinessUser)


On Dec 21, 1:28 pm, Thomas  wrote:
> HiyinDojo,
>
> I'm not sure, if I understood your problem.
>
> You have a template like this - lets call it "index.html"
>
> <---
> 
>  
>   
>    {{form.as_p }}
>    
>   
>  
> 
> <---
>
> Right??
>
> Then your models.py has to look like this:
> <---
> import os
> from google.appengine.ext import webapp
> from google.appengine.ext.webapp.util import run_wsgi_app
> from google.appengine.ext.webapp import template
>
> class MainHandler(webapp.RequestHandler):
>
>   def get(self):
>     template_values = {
>       'form.as_p' : ' type="text" name="last_name">'
>       }
>     path = os.path.join(os.path.dirname(__file__), './index.html')
>     self.response.out.write(template.render(path, template_values))
>
> def main():
>     run_wsgi_app(webapp.WSGIApplication([('/', MainHandler)],
> debug=True))
>
> if __name__ == '__main__':
>     main()
> -->
>
> Per "self.response.out.write(template.render(path, template_values))"
> you take a file path to the template file and a dictionary of values,
> and return the rendered text. Take a look 
> tohttp://www.djangoproject.com/documentation/0.96/templates/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] update

2009-01-10 Thread yinDojo

Hello, i have a model that contains a person name and address
information.  The first form is to same their first name and last
name.  When the user clicks on the submit button it will take them to
the person_address.html.   When they click on the save button it will
update the address information to the newly create person.  My model
contains many attributes, so i want to separate it into a two steps
form.  The first form will save their first and last name and so on.
The second form will save their address and email and so on.  How
could i accomplisth this? Should  i pass the key to the
person_address.html, then pass that key to the function in the
view.py?
Can i pass the key when using return render_to_response
('person_address.html',{'form':form,})

Thank You.  -T


# =  models.py ==
class personInfo(db.Model):
"""Basic user profile with personal details."""
first_name = db.StringProperty()
last_name = db.StringProperty()
company_name = db.StringProperty()
title = db.StringProperty()
street_address = db.StringProperty()
city =  db.StringProperty()
state = db.StringProperty()
zip_code = db.StringProperty()
email = db.EmailProperty()


# = view.py ==
def add_person(request):
if request.method == 'POST': # If the form has been submitted...
form = CreateBusinessForm(request.POST)
if form.is_valid():
first_name = form.cleaned_data['first_name']
last_name = form.cleaned_data['last_name']
create_object(request, businesspromotion)
return 
render_to_response('person_address.html',{'form':form,})
else:
form = CreateBusinessForm()
return render_to_response('person_info.html',{'form':form,})


# = person_address.html 
{% extends 'layout.html' %}
{% block title %}Create person{% endblock %}

{% block content %}
Business Form page2
Back to listing




Street Address:


City:



  {% if object %}

  {% endif %}


{% endblock %}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---