output string for template render object

2012-05-27 Thread Min Hong Tan
hi all,

i have one question
return render_to_response(mainPageTemplate,
  {'programs':find_program ,
   'generate_html':generate_html,
   'generate_script':generate_script
   },
  context_instance=RequestContext(request))

on the above return value.  i have two parameter one is return string value
with javascript and html components.
i have put the {% autoescape off %} as well to avoid conversation.  but, i
noticed it seems like can not capture the
html 's component that i specified in  the generate_html.  even javascript
put at $(document).ready(function(){ }
is it i left out anything? thanks


Regards,
MH

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



global name 'content' is not defined

2012-05-27 Thread Ali Shaikh
 'model.py`
   from django.db import models

   class Page(models.Model):
name = models.CharField(max_length=20, primary_key=True)
content = models.TextField(blank=True)

   # Create your models here.

`view.py`
from wiki.models import Page
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.core.context_processors import csrf


def view_page(request, page_name):
try:
page = Page.objects.get(pk=page_name)
except Page.DoesNotExist:
return render_to_response("create.html",{"page_name":page_name})
return render_to_response("view.html", {"page_name":page_name,
"content":content},context_instance=RequestContext(request))

def edit_page(request, page_name):
try:
page = Page.objects.get(pk=page_name)
content= page.contents
except Page.DoesNotExist:
content= ""
return render_to_response("edit.html", {"page_name":page_name,
"content":content},context_instance=RequestContext(request))

def save_page(request, page_name):
content= request.POST["content"]
try:
page = Page.objects.get(pk=page_name)
page.content= content
except Page.DoesNotExist:
page = Page(name=page_name,content=content)
page.save()
return HttpResponseRedirect("/wikicamp/" + page_name + "/")

Traceback


Environment:
Request Method: GET
Request URL:

Django Version: 1.4
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'wiki')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:

enter code here

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/home/tanveer/djcode/wikicamp/wiki/views.py" in view_page
  16.   return render_to_response("view.html", {"page_name":page_name,
"content":content},context_instance=RequestContext(request))

Exception Type: NameError at /wikicamp/start/
Exception Value: global name 'content' is not defined


PLs help..:(

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



Re: global name 'content' is not defined

2012-05-27 Thread Nikhil Verma
Hi

>From the traceback the error is in :-

def view_page(request, page_name):
   try:
   page = Page.objects.get(pk=page_name)
   except Page.DoesNotExist:
   return render_to_response("create.
>
> html",{"page_name":page_name})
>return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>

Before looking further make sure everything is imported correctly.

Now, It is not able recognize content,  what is content ?

You should do content = page.content and then assign  a key named 'content'
: content just like you had.

Page is a class and content,name are its attributes.

so when you do this :-

page = Page.objects.get(pk=page_name)

# You are making a query from the Page table that will return something ,
page_name you are already passing it as an argument (don't know how) that's
why it is not throwing an error but for content , it is an entity/attribute
of page .

So make an object of that class Page and then access its attributes.

I am also not an expert in django but i think this info might help you.


On Sun, May 27, 2012 at 2:28 PM, Ali Shaikh  wrote:

>  'model.py`
>   from django.db import models
>
>   class Page(models.Model):
>name = models.CharField(max_length=20, primary_key=True)
>content = models.TextField(blank=True)
>
>   # Create your models here.
>
> `view.py`
> from wiki.models import Page
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect, HttpResponse
> from django.shortcuts import get_object_or_404, render_to_response
> from django.core.urlresolvers import reverse
> from django.template import RequestContext
> from django.shortcuts import render_to_response
> from django.core.context_processors import csrf
>
>
> def view_page(request, page_name):
>try:
>page = Page.objects.get(pk=page_name)
>except Page.DoesNotExist:
>return
> render_to_response("create.html",{"page_name":page_name})
>return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> def edit_page(request, page_name):
>try:
>page = Page.objects.get(pk=page_name)
>content= page.contents
>except Page.DoesNotExist:
>content= ""
>return render_to_response("edit.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> def save_page(request, page_name):
>content= request.POST["content"]
>try:
>page = Page.objects.get(pk=page_name)
>page.content= content
>except Page.DoesNotExist:
>page = Page(name=page_name,content=content)
>page.save()
>return HttpResponseRedirect("/wikicamp/" + page_name + "/")
>
>Traceback
>
>
> Environment:
> Request Method: GET
> Request URL:
>
> Django Version: 1.4
> Python Version: 2.6.6
> Installed Applications:
> ('django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'wiki')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
>
> enter code here
>
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>  111. response = callback(request,
> *callback_args, **callback_kwargs)
> File "/home/tanveer/djcode/wikicamp/wiki/views.py" in view_page
>  16.   return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> Exception Type: NameError at /wikicamp/start/
> Exception Value: global name 'content' is not defined
>
>
> PLs help..:(
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Re: global name 'content' is not defined

2012-05-27 Thread Nevio Vesic
You're missing a `content` at def view_page. I've marked possible solution *(as 
red)* that could fix it. 

def view_page(request, page_name):
   try:
   page = Page.objects.get(pk=page_name)
   *content = page.content*
   except Page.DoesNotExist:
   return render_to_response("create.
html",{"page_name":page_name})
   return render_to_response("view.html", {"page_name":page_name, 
"content":content},context_instance=RequestContext(request))


On Sunday, May 27, 2012 10:58:13 AM UTC+2, Ali Shaikh wrote:
>
> 'model.py` 
>from django.db import models 
>
>class Page(models.Model): 
> name = models.CharField(max_length=20, primary_key=True) 
> content = models.TextField(blank=True) 
>
># Create your models here. 
>
> `view.py` 
> from wiki.models import Page 
> from django.shortcuts import render_to_response 
> from django.http import HttpResponseRedirect, HttpResponse 
> from django.shortcuts import get_object_or_404, render_to_response 
> from django.core.urlresolvers import reverse 
> from django.template import RequestContext 
> from django.shortcuts import render_to_response 
> from django.core.context_processors import csrf 
>
>
> def view_page(request, page_name): 
> try: 
> page = Page.objects.get(pk=page_name) 
> except Page.DoesNotExist: 
> return 
> render_to_response("create.html",{"page_name":page_name}) 
> return render_to_response("view.html", {"page_name":page_name, 
> "content":content},context_instance=RequestContext(request)) 
>
> def edit_page(request, page_name): 
> try: 
> page = Page.objects.get(pk=page_name) 
> content= page.contents 
> except Page.DoesNotExist: 
> content= "" 
> return render_to_response("edit.html", {"page_name":page_name, 
> "content":content},context_instance=RequestContext(request)) 
>
> def save_page(request, page_name): 
> content= request.POST["content"] 
> try: 
> page = Page.objects.get(pk=page_name) 
> page.content= content 
> except Page.DoesNotExist: 
> page = Page(name=page_name,content=content) 
> page.save() 
> return HttpResponseRedirect("/wikicamp/" + page_name + "/") 
>
> Traceback 
>
>
> Environment: 
> Request Method: GET 
> Request URL: 
>
> Django Version: 1.4 
> Python Version: 2.6.6 
> Installed Applications: 
> ('django.contrib.auth', 
>  'django.contrib.contenttypes', 
>  'django.contrib.sessions', 
>  'django.contrib.sites', 
>  'django.contrib.messages', 
>  'django.contrib.staticfiles', 
>  'wiki') 
> Installed Middleware: 
> ('django.middleware.common.CommonMiddleware', 
>  'django.contrib.sessions.middleware.SessionMiddleware', 
>  'django.middleware.csrf.CsrfViewMiddleware', 
>  'django.contrib.auth.middleware.AuthenticationMiddleware', 
>  'django.contrib.messages.middleware.MessageMiddleware') 
>
>
> Traceback: 
>
> enter code here 
>
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ 
> base.py" in get_response 
>   111. response = callback(request, 
> *callback_args, **callback_kwargs) 
> File "/home/tanveer/djcode/wikicamp/wiki/views.py" in view_page 
>   16. return render_to_response("view.html", 
> {"page_name":page_name, 
> "content":content},context_instance=RequestContext(request)) 
>
> Exception Type: NameError at /wikicamp/start/ 
> Exception Value: global name 'content' is not defined 
>
>
> PLs help..:(

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/nojisJrWsyQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tutorial database problem

2012-05-27 Thread Jirka Vejrazka
Hi,

  you're creating your database file in /usr/bin which is intended for
system executable files, not databases etc. It's highly likely that
you don't even have write permissions there (unless you work using the
"root" account which is a big NO-NO).

  Set your database file somewhere where you can write for sure, such
as /home//test_db.db.

  You can easily find out if you have write permissions somewhere by
using the "touch" command, i.e. "touch /home//test_db.db -
it'll either create an empty file which means that this path is OK for
your database, or give you an error.

  HTH

Jirka

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



Re: Tutorial database problem

2012-05-27 Thread phantom21
initially I'd created given the path as /home/mark/database/mark.db
but that gave me the same error so I wanted to try creating it in the
same place as sqlite3 existed, with the same results.

Mark


On May 27, 6:29 am, Jirka Vejrazka  wrote:
> Hi,
>
>   you're creating your database file in /usr/bin which is intended for
> system executable files, not databases etc. It's highly likely that
> you don't even have write permissions there (unless you work using the
> "root" account which is a big NO-NO).
>
>   Set your database file somewhere where you can write for sure, such
> as /home//test_db.db.
>
>   You can easily find out if you have write permissions somewhere by
> using the "touch" command, i.e. "touch /home//test_db.db -
> it'll either create an empty file which means that this path is OK for
> your database, or give you an error.
>
>   HTH
>
>     Jirka

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



Re: global name 'content' is not defined

2012-05-27 Thread Tanveer Ali Sha
thank you nikhil and nevio...:)

On Sun, May 27, 2012 at 2:48 PM, Nevio Vesic  wrote:

> You're missing a `content` at def view_page. I've marked possible solution
> *(as red)* that could fix it.
>
> def view_page(request, page_name):
>try:
>page = Page.objects.get(pk=page_name)
>*content = page.content*
>
>except Page.DoesNotExist:
>return render_to_response("create.**
> html",{"page_name":page_name})
>return render_to_response("view.html"**, {"page_name":page_name,
> "content":content},context_**instance=RequestContext(**request))
>
>
> On Sunday, May 27, 2012 10:58:13 AM UTC+2, Ali Shaikh wrote:
>>
>> 'model.py`
>>from django.db import models
>>
>>class Page(models.Model):
>> name = models.CharField(max_length=**20, primary_key=True)
>> content = models.TextField(blank=True)
>>
>># Create your models here.
>>
>> `view.py`
>> from wiki.models import Page
>> from django.shortcuts import render_to_response
>> from django.http import HttpResponseRedirect, HttpResponse
>> from django.shortcuts import get_object_or_404, render_to_response
>> from django.core.urlresolvers import reverse
>> from django.template import RequestContext
>> from django.shortcuts import render_to_response
>> from django.core.context_processors import csrf
>>
>>
>> def view_page(request, page_name):
>> try:
>> page = Page.objects.get(pk=page_name)
>> except Page.DoesNotExist:
>> return 
>> render_to_response("create.**html",{"page_name":page_name})
>>
>> return render_to_response("view.html"**, {"page_name":page_name,
>> "content":content},context_**instance=RequestContext(**request))
>>
>> def edit_page(request, page_name):
>> try:
>> page = Page.objects.get(pk=page_name)
>> content= page.contents
>> except Page.DoesNotExist:
>> content= ""
>> return render_to_response("edit.html"**, {"page_name":page_name,
>> "content":content},context_**instance=RequestContext(**request))
>>
>> def save_page(request, page_name):
>> content= request.POST["content"]
>> try:
>> page = Page.objects.get(pk=page_name)
>> page.content= content
>> except Page.DoesNotExist:
>> page = Page(name=page_name,content=**content)
>> page.save()
>> return HttpResponseRedirect("/**wikicamp/" + page_name + "/")
>>
>> Traceback
>>
>>
>> Environment:
>> Request Method: GET
>> Request URL:
>>
>> Django Version: 1.4
>> Python Version: 2.6.6
>> Installed Applications:
>> ('django.contrib.auth',
>>  'django.contrib.contenttypes'**,
>>  'django.contrib.sessions',
>>  'django.contrib.sites',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'wiki')
>> Installed Middleware:
>> ('django.middleware.common.**CommonMiddleware',
>>  'django.contrib.sessions.**middleware.SessionMiddleware',
>>  'django.middleware.csrf.**CsrfViewMiddleware',
>>  'django.contrib.auth.**middleware.**AuthenticationMiddleware',
>>  'django.contrib.messages.**middleware.MessageMiddleware')
>>
>>
>> Traceback:
>>
>> enter code here
>>
>> File "/usr/local/lib/python2.6/**dist-packages/django/core/**handlers/
>> base.py" in get_response
>>   111. response = callback(request,
>> *callback_args, **callback_kwargs)
>> File "/home/tanveer/djcode/**wikicamp/wiki/views.py" in view_page
>>   16. return render_to_response("view.html"**,
>> {"page_name":page_name,
>> "content":content},context_**instance=RequestContext(**request))
>>
>> Exception Type: NameError at /wikicamp/start/
>> Exception Value: global name 'content' is not defined
>>
>>
>> PLs help..:(
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/nojisJrWsyQJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Database Query in Shell

2012-05-27 Thread Sandeep kaur
I have a table Amounts which has 2 columns field and other_field.
These columns are filled in such a way that either other_field is null
or other_field = field.
I want to make a database query such that

if field == other_field :
   field = "OTHER"
else:
   field = field

That means the entries in table where 2 columns are equal, there field
should be assigned a string  "OTHER" and other_field should remain as
such.
How can I give such query in shell.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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



DatabaseError at /admin/ attempt to write a readonly database

2012-05-27 Thread Fadi Samara
Hi,

I have django running against apache with wsgi, using sqlite3 as my 
database.

When I run the admin page, I will end up with "attempt to write a readonly 
database", the only solution worked for me to chmod 777 to the django 
project directory.According to Django website they don't recommend 
"Authenticating against Django’s user database from Apache" this solution 
and left it to the community to make a better solution.

Can any one please point me to a secure and recommended solution to 
let Apache authenticate a Django project database.

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jBDhsxfRdW4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tutorial database problem

2012-05-27 Thread Fadi Samara
Hi,

I'm not creating it outside the project path, I create /u01/my-project and
gave it 755 permission, and have use default path for the database file to
be in the same directory of the manage.py file.

I'm using a normal user (not root), but I think the Apache user does not
have access to database file unless it's chmod 777.

Any help?

On Sun, May 27, 2012 at 8:29 PM, Jirka Vejrazka wrote:

> Hi,
>
>  you're creating your database file in /usr/bin which is intended for
> system executable files, not databases etc. It's highly likely that
> you don't even have write permissions there (unless you work using the
> "root" account which is a big NO-NO).
>
>  Set your database file somewhere where you can write for sure, such
> as /home//test_db.db.
>
>  You can easily find out if you have write permissions somewhere by
> using the "touch" command, i.e. "touch /home//test_db.db -
> it'll either create an empty file which means that this path is OK for
> your database, or give you an error.
>
>  HTH
>
>Jirka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Fadi Samara
+61 410 387 353

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



Re: Tutorial database problem

2012-05-27 Thread Fadi Samara
so have you found any solution?

On Sun, May 27, 2012 at 8:55 PM, phantom21  wrote:

> initially I'd created given the path as /home/mark/database/mark.db
> but that gave me the same error so I wanted to try creating it in the
> same place as sqlite3 existed, with the same results.
>
> Mark
>
>
> On May 27, 6:29 am, Jirka Vejrazka  wrote:
> > Hi,
> >
> >   you're creating your database file in /usr/bin which is intended for
> > system executable files, not databases etc. It's highly likely that
> > you don't even have write permissions there (unless you work using the
> > "root" account which is a big NO-NO).
> >
> >   Set your database file somewhere where you can write for sure, such
> > as /home//test_db.db.
> >
> >   You can easily find out if you have write permissions somewhere by
> > using the "touch" command, i.e. "touch /home//test_db.db -
> > it'll either create an empty file which means that this path is OK for
> > your database, or give you an error.
> >
> >   HTH
> >
> > Jirka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Fadi Samara
+61 410 387 353

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



Re: Database Query in Shell

2012-05-27 Thread mgc_django-users

On 27/05/2012 9:28 PM, Sandeep kaur wrote:

I have a table Amounts which has 2 columns field and other_field.
These columns are filled in such a way that either other_field is null
or other_field = field.
I want to make a database query such that

if field == other_field :
field = "OTHER"
else:
field = field

That means the entries in table where 2 columns are equal, there field
should be assigned a string  "OTHER" and other_field should remain as
such.
How can I give such query in shell.

To get a queryset containing all the objects where field == other_field 
should be something like the following:


from django.db.models import F

Amounts.objects.filter(field = F("other_field"))

to then update all those objects with "OTHER" as the value for field 
would be:


Amounts.objects.filter(field = F("other_field")).update(field="OTHER")

Note that this won't execute the "else" portion above, but as it is not 
making any change (field already equals field), I assume this isn't an 
issue.


Regards,
Michael.

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



Re: Database Query in Shell

2012-05-27 Thread Sandeep kaur
On Sun, May 27, 2012 at 6:05 PM,   wrote:

> To get a queryset containing all the objects where field == other_field
> should be something like the following:
>
> from django.db.models import F
>
> Amounts.objects.filter(field = F("other_field"))
>
> to then update all those objects with "OTHER" as the value for field would
> be:
>
> Amounts.objects.filter(field = F("other_field")).update(field="OTHER")
>
> Note that this won't execute the "else" portion above, but as it is not
> making any change (field already equals field), I assume this isn't an
> issue.
>
You are great, sir.
Thank you.
The query successfully updated the field column as was required.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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



Re: DatabaseError at /admin/ attempt to write a readonly database

2012-05-27 Thread Antoni Aloy
Don't use sqlite, use a postressql or mysql database.

If you just need sqlite:

Create an special user for your application, and addit to the www-data group,
and mark sqlite databse as read/write for that user.

Hope it help!

2012/5/27 Fadi Samara :
> Hi,
>
> I have django running against apache with wsgi, using sqlite3 as my
> database.
>
> When I run the admin page, I will end up with "attempt to write a readonly
> database", the only solution worked for me to chmod 777 to the django
> project directory.According to Django website they don't recommend
> "Authenticating against Django’s user database from Apache" this solution
> and left it to the community to make a better solution.
>
> Can any one please point me to a secure and recommended solution to
> let Apache authenticate a Django project database.
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/jBDhsxfRdW4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



Re: Error with Views on Admin and Index page

2012-05-27 Thread Peter of the Norse
Can we see your urls.py? I'm worried that you’re directing to a views.py file 
that doesn't actually exist.

On May 24, 2012, at 2:38 PM, cat123 wrote:

> No I'm not doing the Django tutorial. I'm following a couple of older
> Django books that were published circa 2009 using Django 1.1. ('m
> using Django 1.3). I did set up Staticfiles  (the Django 1.3 way, the
> best I could as a newbie, following djangoproject directions) but
> staticfiles is of course for static pages...I did create a page with
> base.html and css, and was able to view that.  Are Admin pages and the
> Index page considered staticfiles? If so, maybe I didn't set that up
> right?
> 
> 
> On May 24, 1:14 pm, Apokalyptica Painkiller 
> wrote:
>> Are you doing django's tutorial? If it is correct in which part are you?
>> 
>> 2012/5/24 cat123 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi Apo:
>> 
>>> Thanks for the feedback...When I look at those links, they're both
>>> about views from apps that have been created. I haven't created any
>>> apps yet... so which Views do you think it may be talking about, and
>>> where would I look for this?
>> 
>>> On May 24, 12:14 pm, Apokalyptica Painkiller
>>>  wrote:
 Hello why don't you check this two links:
>> 
 http://stackoverflow.com/questions/5350241/django-import-error-that-r...
>> 
 http://stackoverflow.com/questions/3496920/django-viewdoesnotexist
>> 
 Good luck :)
>> 
 2012/5/24 cat123 
>> 
> I'm new to Django and recently got my very first environment set up
> (Python 2.7, Django 1.3, with Postgres 9.1.3 and virtualenv)...
>> 
> I set up everything for "Admin," (first time setup),got the LogIn
> Page. But when I logged in, instead of going to the admin screen, I
> got a message saying:
>> 
> TemplateSyntaxError at /admin/
> Caught ViewDoesNotExist while rendering. Could not import views. Error
> was: No module named views.
>> 
> I noticed I also get something similar after I uncommented the django-
> supplied index page (in urls.py) (which I have also never
> resolved...seems they may be connected?):
>> 
> ViewDoesNotExist at / Could not import hgb_project.views. Error was:
> No module named views
>> 
> Would appreciate any help anyone has to offer...
>> 
> Thanks,
> cat
>> 
> --
> You received this message because you are subscribed to the Google
>>> Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>> 
 --
 I live each day
 Like it's my last
 I live for rock and roll
 I never look back
>> 
 I'm a rocker
 Do as I feel as I say
 I'm a rocker
 And no one can take that away
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>> 
>> --
>> I live each day
>> Like it's my last
>> I live for rock and roll
>> I never look back
>> 
>> I'm a rocker
>> Do as I feel as I say
>> I'm a rocker
>> And no one can take that away
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

Peter of the Norse
rahmc...@radio1190.org



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



Re: Tutorial database problem

2012-05-27 Thread phantom21
No.  Why I'm asking.  I don't see a problem with the DATABASES section
of the file, but another pair of eyes might.  The error implies a
problem with the ENGINES line, but, again, I don't see it.

Mark


On May 27, 6:56 am, Fadi Samara  wrote:
> so have you found any solution?
>
>
>
>
>
>
>
>
>
> On Sun, May 27, 2012 at 8:55 PM, phantom21  wrote:
> > initially I'd created given the path as /home/mark/database/mark.db
> > but that gave me the same error so I wanted to try creating it in the
> > same place as sqlite3 existed, with the same results.
>
> > Mark
>
> > On May 27, 6:29 am, Jirka Vejrazka  wrote:
> > > Hi,
>
> > >   you're creating your database file in /usr/bin which is intended for
> > > system executable files, not databases etc. It's highly likely that
> > > you don't even have write permissions there (unless you work using the
> > > "root" account which is a big NO-NO).
>
> > >   Set your database file somewhere where you can write for sure, such
> > > as /home//test_db.db.
>
> > >   You can easily find out if you have write permissions somewhere by
> > > using the "touch" command, i.e. "touch /home//test_db.db -
> > > it'll either create an empty file which means that this path is OK for
> > > your database, or give you an error.
>
> > >   HTH
>
> > >     Jirka
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Fadi Samara
> +61 410 387 353

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



Re: Httprequest with xml body - how to parse with elementtree?

2012-05-27 Thread francescortiz
This link could help:
http://lmgtfy.com/?q=python+parse+xml


On Saturday, May 26, 2012 4:24:29 PM UTC+2, Benjamin Carlson wrote:
>
> I'm new to django, and am trying to write a web service. 
>
> The request will have xml in the body. How can I parse that into 
> elementtree root node?
>
> Thanks in advance!
>
> -Ben
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/x_1kgvUaZPwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Is there are some id obfuscate libs in django?

2012-05-27 Thread forrest yang
Just try to convert the increasing numeric id in the database to some other 
obfuscated id. 
The lib need to support long type integer range conversion and convert in 
two directions.
Is there are some id obfuscate libs in django or widely used in django 
community?

Any one knows that?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/0lkBciSL24MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is there are some id obfuscate libs in django?

2012-05-27 Thread Marcin Tustin
Why would you want this? Arbitrary integers are already completely opaque.

On Sun, May 27, 2012 at 4:12 PM, forrest yang wrote:

> Just try to convert the increasing numeric id in the database to some
> other obfuscated id.
> The lib need to support long type integer range conversion and convert in
> two directions.
> Is there are some id obfuscate libs in django or widely used in django
> community?
>
> Any one knows that?
>
> Thanks
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/0lkBciSL24MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Marcin Tustin
Tel: 07773 787 105

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



Re: Is there are some id obfuscate libs in django?

2012-05-27 Thread Brian Schott
Keep in mind that obfuscation isn't security, so the answer really depend on 
your goal.  Are you concerned about auto-incrementing integer IDs being 
sequential in REST urls?  If so, use named slugs or UUIDs from 
django-extensions.  UUIDs aren't obfuscated from a security perspective (they 
can be deduced), but sufficient for most purposes to make sequencing not 
obvious.  You can also use the M2Crypto library to generate a random token and 
use that to add a home-grown access key.  The snippet below isn't complete, but 
hopefully gives you an idea.

 models.py --

import M2Crypto
from django_extensions.db import fields as extensions

class Foo(models.Model):

uuid = extensions.UUIDField(
editable=False,
help_text="Automatically generated globally unique ID.")

token = models.CharField(
help_text="Automatically generated authorization token",
max_length=255,
editable=False, default=None, blank=True, null=True)

def save(self, *args, **kwargs):
""" set the authorization token on first save """
if not self.id:
self.token = base64.urlsafe_b64encode(
M2Crypto.m2.rand_bytes(16))
super(Foo, self).save(*args, **kwargs)

-- views.py --

from django.views.generic import DetailView

class FooTokenView(DetailView):

def get_object(self):
object = get_object_or_404(Foo,
   uuid=self.kwargs['uuid'],
   token=self.kwargs['token'])
return object

---


Brian Schott
bfsch...@gmail.com



On May 27, 2012, at 11:14 AM, Marcin Tustin wrote:

> Why would you want this? Arbitrary integers are already completely opaque.
> 
> On Sun, May 27, 2012 at 4:12 PM, forrest yang  wrote:
> Just try to convert the increasing numeric id in the database to some other 
> obfuscated id. 
> The lib need to support long type integer range conversion and convert in two 
> directions.
> Is there are some id obfuscate libs in django or widely used in django 
> community?
> 
> Any one knows that?
> 
> Thanks
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/0lkBciSL24MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> Marcin Tustin
> Tel: 07773 787 105
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.



smime.p7s
Description: S/MIME cryptographic signature


Is Django Right for Me?

2012-05-27 Thread KevinE
Not a web developer but have a bit of software savy and looking to develop 
a custom app for use in my business which is consulting engineering. I want 
to develop application that helps me in documenting inspections I make on a 
jobsite. Basicly what happens is I would go out with a tablet and use my 
webapp to collect and document construction progress mainly to document 
construction deficiencies and monitor progress of construction. From the 
data collected on the job site I would push this data through a reporting 
engine to prepare a pdf style site review report which would get emailed to 
the project architect, all the consultants, owner and contractor - the 
intent is to have this happen while on the job site. On the office side I 
want to develop a basic project based document management system where I 
can document when field reviews were conducted, summarize deficiencies and 
also ensure that deficiencies are completed and signed off on (as the 
engineer I take legal responsibility for all the deficiencies). I also want 
to be able to manage all my projects find projects by client, owner, 
architect etc. 

By the looks of it Django should be able to do all this but the one issue 
that I am unsure about is an offline mode. The idea is to have a tablet 
with a data connection but if there is no data connection I still need to 
complete the forms and cache the data until it can be sync'd later on. From 
what I have read, data syncing can get a bit knarly, something I don't want 
to get into myself. 

I envision a custom android app for the tablet - for this I need access to 
the GPS and camera (my ultra cool feature will be my tablet automatically 
pulling up a project page as I drive up to the job site based on the GPS 
coordinates!). Will this be a web page or will it be an actual app?

Guess I am looking for some basic advice on how to architect this with the 
above issues in mind. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4ag4SAJmCckJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Off-line Django apps / Caching and synchronizing data

2012-05-27 Thread KevinE

>
> Just posted a similar question - sounds like we need a "DjangoOffline" 
> component. Does such a beast exist? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Ti36numnK1UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Off-line Django apps / Caching and synchronizing data

2012-05-27 Thread Marcin Tustin
As per the above it's not really a django issue. The main django
participation would be to provide an AJAX api which the client web page can
sync with when it gets back online, which you would need to do for any AJAX
application.

If you do get your project working, do write up a tutorial. I'd be
interested in reading about it for sure.

On Sun, May 27, 2012 at 5:35 PM, KevinE wrote:

> Just posted a similar question - sounds like we need a "DjangoOffline"
>> component. Does such a beast exist?
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Ti36numnK1UJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Marcin Tustin
Tel: 07773 787 105

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



Re: Off-line Django apps / Caching and synchronizing data

2012-05-27 Thread Marcin Tustin
You might also like this:
http://stackoverflow.com/questions/2786303/offline-mode-app-in-a-html5-browser-possible


On Sun, May 27, 2012 at 5:39 PM, Marcin Tustin wrote:

> As per the above it's not really a django issue. The main django
> participation would be to provide an AJAX api which the client web page can
> sync with when it gets back online, which you would need to do for any AJAX
> application.
>
> If you do get your project working, do write up a tutorial. I'd be
> interested in reading about it for sure.
>
>
> On Sun, May 27, 2012 at 5:35 PM, KevinE wrote:
>
>> Just posted a similar question - sounds like we need a "DjangoOffline"
>>> component. Does such a beast exist?
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/Ti36numnK1UJ.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>


-- 
Marcin Tustin
Tel: 07773 787 105

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



anybody used Jython 2.5+ and Django

2012-05-27 Thread Gelonida N

Did anybody play with this?

What versions of django are supported?

What DB engines are supported?

Any performance comparison between Cpython and Jython?

Thanks in advance for pointers / comments


Any hints on how to create  such a setup on  Ubuntu 12.04?


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



Re: Error with Views on Admin and Index page

2012-05-27 Thread aron.s...@gmail.com
W.11

- Reply message -
From: "Peter of the Norse" 
Date: Sun, May 27, 2012 9:53 am
Subject: Error with Views on Admin and Index page
To: 

Can we see your urls.py? I'm worried that you’re directing to a views.py file 
that doesn't actually exist.

On May 24, 2012, at 2:38 PM, cat123 wrote:

> No I'm not doing the Django tutorial. I'm following a couple of older
> Django books that were published circa 2009 using Django 1.1. ('m
> using Django 1.3). I did set up Staticfiles  (the Django 1.3 way, the
> best I could as a newbie, following djangoproject directions) but
> staticfiles is of course for static pages...I did create a page with
> base.html and css, and was able to view that.  Are Admin pages and the
> Index page considered staticfiles? If so, maybe I didn't set that up
> right?
> 
> 
> On May 24, 1:14 pm, Apokalyptica Painkiller 
> wrote:
>> Are you doing django's tutorial? If it is correct in which part are you?
>> 
>> 2012/5/24 cat123 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi Apo:
>> 
>>> Thanks for the feedback...When I look at those links, they're both
>>> about views from apps that have been created. I haven't created any
>>> apps yet... so which Views do you think it may be talking about, and
>>> where would I look for this?
>> 
>>> On May 24, 12:14 pm, Apokalyptica Painkiller
>>>  wrote:
 Hello why don't you check this two links:
>> 
 http://stackoverflow.com/questions/5350241/django-import-error-that-r...
>> 
 http://stackoverflow.com/questions/3496920/django-viewdoesnotexist
>> 
 Good luck :)
>> 
 2012/5/24 cat123 
>> 
> I'm new to Django and recently got my very first environment set up
> (Python 2.7, Django 1.3, with Postgres 9.1.3 and virtualenv)...
>> 
> I set up everything for "Admin," (first time setup),got the LogIn
> Page. But when I logged in, instead of going to the admin screen, I
> got a message saying:
>> 
> TemplateSyntaxError at /admin/
> Caught ViewDoesNotExist while rendering. Could not import views. Error
> was: No module named views.
>> 
> I noticed I also get something similar after I uncommented the django-
> supplied index page (in urls.py) (which I have also never
> resolved...seems they may be connected?):
>> 
> ViewDoesNotExist at / Could not import hgb_project.views. Error was:
> No module named views
>> 
> Would appreciate any help anyone has to offer...
>> 
> Thanks,
> cat
>> 
> --
> You received this message because you are subscribed to the Google
>>> Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>> 
 --
 I live each day
 Like it's my last
 I live for rock and roll
 I never look back
>> 
 I'm a rocker
 Do as I feel as I say
 I'm a rocker
 And no one can take that away
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>> 
>> --
>> I live each day
>> Like it's my last
>> I live for rock and roll
>> I never look back
>> 
>> I'm a rocker
>> Do as I feel as I say
>> I'm a rocker
>> And no one can take that away
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

Peter of the Norse
rahmc...@radio1190.org



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

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



Re: Error with Views on Admin and Index page

2012-05-27 Thread aron.s...@gmail.com


- Reply message -
From: "Peter of the Norse" 
Date: Sun, May 27, 2012 9:53 am
Subject: Error with Views on Admin and Index page
To: 

Can we see your urls.py? I'm worried that you’re directing to a views.py file 
that doesn't actually exist.

On May 24, 2012, at 2:38 PM, cat123 wrote:

> No I'm not doing the Django tutorial. I'm following a couple of older
> Django books that were published circa 2009 using Django 1.1. ('m
> using Django 1.3). I did set up Staticfiles  (the Django 1.3 way, the
> best I could as a newbie, following djangoproject directions) but
> staticfiles is of course for static pages...I did create a page with
> base.html and css, and was able to view that.  Are Admin pages and the
> Index page considered staticfiles? If so, maybe I didn't set that up
> right?
> 
> 
> On May 24, 1:14 pm, Apokalyptica Painkiller 
> wrote:
>> Are you doing django's tutorial? If it is correct in which part are you?
>> 
>> 2012/5/24 cat123 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi Apo:
>> 
>>> Thanks for the feedback...When I look at those links, they're both
>>> about views from apps that have been created. I haven't created any
>>> apps yet... so which Views do you think it may be talking about, and
>>> where would I look for this?
>> 
>>> On May 24, 12:14 pm, Apokalyptica Painkiller
>>>  wrote:
 Hello why don't you check this two links:
>> 
 http://stackoverflow.com/questions/5350241/django-import-error-that-r...
>> 
 http://stackoverflow.com/questions/3496920/django-viewdoesnotexist
>> 
 Good luck :)
>> 
 2012/5/24 cat123 
>> 
> I'm new to Django and recently got my very first environment set up
> (Python 2.7, Django 1.3, with Postgres 9.1.3 and virtualenv)...
>> 
> I set up everything for "Admin," (first time setup),got the LogIn
> Page. But when I logged in, instead of going to the admin screen, I
> got a message saying:
>> 
> TemplateSyntaxError at /admin/
> Caught ViewDoesNotExist while rendering. Could not import views. Error
> was: No module named views.
>> 
> I noticed I also get something similar after I uncommented the django-
> supplied index page (in urls.py) (which I have also never
> resolved...seems they may be connected?):
>> 
> ViewDoesNotExist at / Could not import hgb_project.views. Error was:
> No module named views
>> 
> Would appreciate any help anyone has to offer...
>> 
> Thanks,
> cat
>> 
> --
> You received this message because you are subscribed to the Google
>>> Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>> 
 --
 I live each day
 Like it's my last
 I live for rock and roll
 I never look back
>> 
 I'm a rocker
 Do as I feel as I say
 I'm a rocker
 And no one can take that away
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>> 
>> --
>> I live each day
>> Like it's my last
>> I live for rock and roll
>> I never look back
>> 
>> I'm a rocker
>> Do as I feel as I say
>> I'm a rocker
>> And no one can take that away
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

Peter of the Norse
rahmc...@radio1190.org



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

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



Re: output string for template render object

2012-05-27 Thread Chew Kok Hoor
Hi Min Hong,

I think you need to provide a simple example, of values in the context
(programs, generate_html,generate_script), your template and the result as
well as the expected result so that it is easier for forum members to help
you.

Thanks.

Regards,
Kok Hoor

On Sun, May 27, 2012 at 4:28 PM, Min Hong Tan  wrote:

> hi all,
>
> i have one question
> return render_to_response(mainPageTemplate,
>   {'programs':find_program ,
>'generate_html':generate_html,
>'generate_script':generate_script
>},
>   context_instance=RequestContext(request))
>
> on the above return value.  i have two parameter one is return string
> value with javascript and html components.
> i have put the {% autoescape off %} as well to avoid conversation.  but, i
> noticed it seems like can not capture the
> html 's component that i specified in  the generate_html.  even javascript
> put at $(document).ready(function(){ }
> is it i left out anything? thanks
>
>
> Regards,
> MH
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Off-line Django apps / Caching and synchronizing data

2012-05-27 Thread ALJ
Thanks for the link Marcin. To anyone else interested in looking into this, 
it looks like the first stop is to read Mark Pilgrim's chapter "Let's Take 
This Offline " in "Dive Into 
HTML5".

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/n_G3vXkco2IJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Admin site - search by related ManyToMany

2012-05-27 Thread Lee
I'm looking for advice on the best way to approach a conceptually
simple custom search feature for a basic Admin site. I've spent days
reading about custom views, advanced search, dynamic tables, EAV,
etc., enough to realize that there a lot of possible solutions, some
probably much easier and maintainable than others.

Say I have an Admin site that maintains Items and their associated
Characteristics. Items and Characteristics are both user-defined so I
have an Admin interface for each. When a Characteristic is assigned to
an Item a value is supplied; for example the user defines a
Characteristic named "color" and assigns that characteristic to an
item with a value of "red." Each Item can have many Characteristics
and each Characteristic can be assigned to many Items. So the models
look like this:

class Characteristic(models.Model):
name = models.CharField(unique=True, max_length=100)
items =
models.ManyToManyField('Item',blank=True,through='ItemCharacteristic')
def __unicode__(self):
return self.name

class Item(models.Model):
name = models.CharField(unique=True, max_length=100)
characteristics =
models.ManyToManyField('Characteristic',blank=True,through='ItemCharacteristic')
def __unicode__(self):
return self.name

class ItemCharacteristic(models.Model):
item = models.ForeignKey(Item)
characteristic = models.ForeignKey(Characteristic)
characteristic_value = models.CharField(max_length=4000)
def __unicode__(self):
return self.item.name + ":" + self.characteristic.name

With these models the default Admin interface allows the user to
filter the ItemCharacteristic joining table for single Item/
Characteristic combinations. What I would like is a basic Item Search
by Characteristic page, that displays a text box for each defined
Characteristic, labeled with the Characteristic name, and filters the
Items changelist to show only Items that are assigned the chosen
Characteristics, with the entered Characteristic values.

Thanks very much for any help or ideas.

Lee

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



Django Admin events

2012-05-27 Thread Mariano DAngelo
Anybody nows if django support capturing events on model admin widgets.

I have a field, and when the users change it I want to make a query with 
that value and load to another field, but I do wanna wait to save method...

Is there any way besides writing my own widgets?

thanks

Example

Field: products on change load field price from the model price_list

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GkROi3vy-6oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Getting the Database Version

2012-05-27 Thread Vanessa Gomes
Hello, guys.

Does anyone know where I can find the name / version of the database? For
example, if I'm using PostegreSQL, want it returned something like "8.4.11
PostgreSQL, psycopg2 2.4.4."

-- 
Vanessa Gomes de Lima
Graduanda em Ciência da Computação - 2009.1 - Centro de Informática - UFPE

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



Django ForeignKey which does not require referential integrity?

2012-05-27 Thread diabeteman
Hello everyone,

I recently posted a question on stackoverflow.com but didn't get any 
answers. I've found similar questions but without any satisfying solutions.

Here is my question 
http://stackoverflow.com/questions/10623854/django-soft-foreignfield-without-database-integrity-checks
Here is a related question 
http://stackoverflow.com/questions/3558907/django-foreignkey-which-does-not-require-referential-integrity

Could you give me some orientation on how to create a custom ForeignKey 
field that does not create database constraints with syncdb and south 
migrations?

Thanks in advance for the help :)

Robin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bi5y3oeB8xYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is Django Right for Me?

2012-05-27 Thread Russell Keith-Magee
On Mon, May 28, 2012 at 12:28 AM, KevinE  wrote:
> Not a web developer but have a bit of software savy and looking to develop a
> custom app for use in my business which is consulting engineering. I want to
> develop application that helps me in documenting inspections I make on a
> jobsite. Basicly what happens is I would go out with a tablet and use my
> webapp to collect and document construction progress mainly to document
> construction deficiencies and monitor progress of construction. From the
> data collected on the job site I would push this data through a reporting
> engine to prepare a pdf style site review report which would get emailed to
> the project architect, all the consultants, owner and contractor - the
> intent is to have this happen while on the job site. On the office side I
> want to develop a basic project based document management system where I can
> document when field reviews were conducted, summarize deficiencies and also
> ensure that deficiencies are completed and signed off on (as the engineer I
> take legal responsibility for all the deficiencies). I also want to be able
> to manage all my projects find projects by client, owner, architect etc.
>
> By the looks of it Django should be able to do all this but the one issue
> that I am unsure about is an offline mode. The idea is to have a tablet with
> a data connection but if there is no data connection I still need to
> complete the forms and cache the data until it can be sync'd later on. From
> what I have read, data syncing can get a bit knarly, something I don't want
> to get into myself.
>
> I envision a custom android app for the tablet - for this I need access to
> the GPS and camera (my ultra cool feature will be my tablet automatically
> pulling up a project page as I drive up to the job site based on the GPS
> coordinates!). Will this be a web page or will it be an actual app?
>
> Guess I am looking for some basic advice on how to architect this with the
> above issues in mind.

>From what you've described, Django will certainly be able to help out
here. However, you're going to need to combine Django with some other
tools to solve all your problems.

Django is a server-side framework -- that is, it deals with the
database and web server that doles out content to whatever client asks
for it -- be it web browser, mobile app, or whatever. In terms of your
problem, that means that Django will be able to provide the interface
by which data is submitted to the server, store the data that is
collected, and provide a web presence to serve that data back to
users. Django doesn't have any built-in PDF generation capability, but
there are a lot of Python libraries that can be used to generate PDFs,
and it's easy to use Django to extract data and feed it into a PDF
generator. Django's documentation contains some simple examples of how
this can be done. [1]

[1] https://docs.djangoproject.com/en/1.4/howto/outputting-pdf/

So - Django will be great on the server side. However, the bigger part
of your problem is the client side, and that's an area where Django
has deliberately avoided offering a solution, so you'll need to
combine Django with some client-side tools that are able to:

 * Provide access to the camera and geolocation features of the device you're on
 * Store data on the device while there is no live access to the server
 * Cache updates on the mobile device while offline for delivery when
it comes back online.
 * If necessary, synchronize updates made on the mobile device with
updates on the server

Features like geolocation and offline access can be implemented in
native HTML5 without the need to build an app at all; see
http://html5demos.com for some examples of the cool things you can do
on webpages with a modern browser. You can also use a HTML5-based
development approach embedded in a native app container; for example,
tools like Phonegap [2] and Appcelerator [3] are designed to help out
here.

[2] http://phonegap.com/
[3] http://www.appcelerator.com/

I can't say I know of any libraries that can be used to address the
synchronisation problem -- but then, I haven't really been looking for
one either. It wouldn't surprise me if there is something out there
that you could use, but if it does, it's got very little to do with
the Django side of the fence -- all Django cares about is that you're
using HTTP to communicate with the server.

So - in summary:
 * Yes, Django could be a useful part of your tech stack to do what
you're describing
 * However, it won't solve the problem on it's own -- you'll need to
pick a client side framework too.

Yours,
Russ Magee %-)

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



Re: output string for template render object

2012-05-27 Thread Min Hong Tan
hi Chew,

Thanks.  I have found out the html code that i render is invalid. :P  too
tire for late night programming

Regards,
MH

On Sun, May 27, 2012 at 11:17 AM, Chew Kok Hoor  wrote:

> Hi Min Hong,
>
> I think you need to provide a simple example, of values in the context
> (programs, generate_html,generate_script), your template and the result as
> well as the expected result so that it is easier for forum members to help
> you.
>
> Thanks.
>
> Regards,
> Kok Hoor
>
> On Sun, May 27, 2012 at 4:28 PM, Min Hong Tan wrote:
>
>> hi all,
>>
>> i have one question
>> return render_to_response(mainPageTemplate,
>>   {'programs':find_program ,
>>'generate_html':generate_html,
>>'generate_script':generate_script
>>},
>>   context_instance=RequestContext(request))
>>
>> on the above return value.  i have two parameter one is return string
>> value with javascript and html components.
>> i have put the {% autoescape off %} as well to avoid conversation.  but,
>> i noticed it seems like can not capture the
>> html 's component that i specified in  the generate_html.  even
>> javascript put at $(document).ready(function(){ }
>> is it i left out anything? thanks
>>
>>
>> Regards,
>> MH
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Getting the Database Version

2012-05-27 Thread Russell Keith-Magee
On Mon, May 28, 2012 at 5:09 AM, Vanessa Gomes  wrote:
> Hello, guys.
>
> Does anyone know where I can find the name / version of the database? For
> example, if I'm using PostegreSQL, want it returned something like "8.4.11
> PostgreSQL, psycopg2 2.4.4."

Hi Vanessa,

Django doesn't currently have any API for accessing that sort of
detail. You'd have to get a handle on the native DB cursor and ask the
DB directly. However, this won't be cross-database compatible -- every
database will have a different way of retrieving the version.

The closest Django can get you is to tell you the identifier for the
backend -- that will tell you that you're on Postgres vs MySQL, but
won't tell you versions.

from django.db import connections
print connections['default'].vendor

will output the database vendor string.

You're not the first person to ask for this feature-- there was a
ticket opened just recently for this exact idea:

https://code.djangoproject.com/ticket/18332

If you're enthused about the idea, this should be a fairly easy
contribution your could make.

Yours
Russ Magee %-)

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



django-registration simple backend help

2012-05-27 Thread psychok7
hi there i am writing an app using django-registration 0.8 installed from 
pip and using the simple-backend

my problem is, when i register a new user it logs me in after inserting in 
the db and redirects me to /users// but if i login normally using 
the django.contrib.auth it redirects me to accounts/profile.

my question is, how do i unify this redirect since it should take me to the 
same place?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/PMGDG1tK1IoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Getting the Database Version

2012-05-27 Thread Vanessa Gomes
Hey, actually I'm fixing the ticket.
:)

I know about connection.vendor, actually on the solution for sqlite3 I used
it.

Thank you.

2012/5/27 Russell Keith-Magee 

> On Mon, May 28, 2012 at 5:09 AM, Vanessa Gomes 
> wrote:
> > Hello, guys.
> >
> > Does anyone know where I can find the name / version of the database? For
> > example, if I'm using PostegreSQL, want it returned something like
> "8.4.11
> > PostgreSQL, psycopg2 2.4.4."
>
> Hi Vanessa,
>
> Django doesn't currently have any API for accessing that sort of
> detail. You'd have to get a handle on the native DB cursor and ask the
> DB directly. However, this won't be cross-database compatible -- every
> database will have a different way of retrieving the version.
>
> The closest Django can get you is to tell you the identifier for the
> backend -- that will tell you that you're on Postgres vs MySQL, but
> won't tell you versions.
>
> from django.db import connections
> print connections['default'].vendor
>
> will output the database vendor string.
>
> You're not the first person to ask for this feature-- there was a
> ticket opened just recently for this exact idea:
>
> https://code.djangoproject.com/ticket/18332
>
> If you're enthused about the idea, this should be a fairly easy
> contribution your could make.
>
> Yours
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Vanessa Gomes de Lima
Graduanda em Ciência da Computação - 2009.1 - Centro de Informática - UFPE

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



Re: Tutorial database problem

2012-05-27 Thread phantom21
See above.  Initially I had tried /home/mark/database/mark.db, but got
the same error, so I tried it in the directory sqlite3 executable
resides.  Got THE SAME ERROR!

The error has nothing to do with where the database resides it seems.
The error seems to indicate some issue with the ENGINES line, but I
can't see it.  Why I'm asking for help.  Maybe other eyes can see what
I can't.

Mark


On May 27, 5:38 pm, Dennis Lee Bieber  wrote:
> On Sat, 26 May 2012 20:38:22 -0700 (PDT), phantom21 
> declaimed the following in gmane.comp.python.django.user:
>
> > I've tried to set up the database as sqlite3.  I keep getting an error
> > on the ENGINE line, but can't figure out why as it looks correct.
>
>         Not an expert but...
>
> >         'NAME': '/usr/bin/sqlite3/mark.db',  # Or path to database
> > file if using sqlite3
>
>         Why are you attempting to store the database /data/ file in a system
> protected (I'd hope) directory?
>
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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



setting up new django project

2012-05-27 Thread xaegis
Hello, this is my first time posting to a list!
 I am running python 2.7 with django 1.4 installed on Ubuntu 12.04
I am having trouble creating new projects with django. Whenever I use
the command:
Code:

sudo /usr/local/lib/python2.7/dist-packages/django/bin/django-admin.py
startproject cms

I get errors or permission denied messages but if I use:
Code:

django-admin.py startproject cms

Everything seems to work correctly. I know at some point I created a
sym link in:
Code:

/usr/local/bin

but is this the proper way to do this? Should I be using the full path
instead? Also, why is django found in dist-packages instead of site-
packages in the python directory? The books I am using are telling me
the python files should be located in site-packages.

I also noticed that django "startproject" created two directories
called "cms" one nested inside the other. Is this the default
behavior, and why?


I am also having trouble setting up the sqlite3 back-end and I keep
getting the error:

Code:
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
sqlite3/base.py", line 281, in _cursor
self._sqlite_create_connection()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
sqlite3/base.py", line 271, in _sqlite_create_connection
self.connection = Database.connect(**kwargs)
pysqlite2.dbapi2.OperationalError: unable to open database file


Thanks in advance.

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



Re: Is Django Right for Me?

2012-05-27 Thread ivan sugiarto
furthermore if you want to integrate Django, Tablet and PC you should make
Django webservice (either using Json or XML), after that you must create
Tablet and PC application that fetch django webservice.

So the rough architecture would be :

Web Apps (ie Django, PHP or Java) --->create Web Service (XML or JSON) --->
Fetched by (using either GET or POST method) Android or PC apps

the android or pc apps must use database to store data for offline use, I
recommend sqlite http://www.sqlite.org/, i have used it in numerous apps
and it runs smoothly :)

PS sorry of my bad english

On Mon, May 28, 2012 at 6:45 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Mon, May 28, 2012 at 12:28 AM, KevinE 
> wrote:
> > Not a web developer but have a bit of software savy and looking to
> develop a
> > custom app for use in my business which is consulting engineering. I
> want to
> > develop application that helps me in documenting inspections I make on a
> > jobsite. Basicly what happens is I would go out with a tablet and use my
> > webapp to collect and document construction progress mainly to document
> > construction deficiencies and monitor progress of construction. From the
> > data collected on the job site I would push this data through a reporting
> > engine to prepare a pdf style site review report which would get emailed
> to
> > the project architect, all the consultants, owner and contractor - the
> > intent is to have this happen while on the job site. On the office side I
> > want to develop a basic project based document management system where I
> can
> > document when field reviews were conducted, summarize deficiencies and
> also
> > ensure that deficiencies are completed and signed off on (as the
> engineer I
> > take legal responsibility for all the deficiencies). I also want to be
> able
> > to manage all my projects find projects by client, owner, architect etc.
> >
> > By the looks of it Django should be able to do all this but the one issue
> > that I am unsure about is an offline mode. The idea is to have a tablet
> with
> > a data connection but if there is no data connection I still need to
> > complete the forms and cache the data until it can be sync'd later on.
> From
> > what I have read, data syncing can get a bit knarly, something I don't
> want
> > to get into myself.
> >
> > I envision a custom android app for the tablet - for this I need access
> to
> > the GPS and camera (my ultra cool feature will be my tablet automatically
> > pulling up a project page as I drive up to the job site based on the GPS
> > coordinates!). Will this be a web page or will it be an actual app?
> >
> > Guess I am looking for some basic advice on how to architect this with
> the
> > above issues in mind.
>
> From what you've described, Django will certainly be able to help out
> here. However, you're going to need to combine Django with some other
> tools to solve all your problems.
>
> Django is a server-side framework -- that is, it deals with the
> database and web server that doles out content to whatever client asks
> for it -- be it web browser, mobile app, or whatever. In terms of your
> problem, that means that Django will be able to provide the interface
> by which data is submitted to the server, store the data that is
> collected, and provide a web presence to serve that data back to
> users. Django doesn't have any built-in PDF generation capability, but
> there are a lot of Python libraries that can be used to generate PDFs,
> and it's easy to use Django to extract data and feed it into a PDF
> generator. Django's documentation contains some simple examples of how
> this can be done. [1]
>
> [1] https://docs.djangoproject.com/en/1.4/howto/outputting-pdf/
>
> So - Django will be great on the server side. However, the bigger part
> of your problem is the client side, and that's an area where Django
> has deliberately avoided offering a solution, so you'll need to
> combine Django with some client-side tools that are able to:
>
>  * Provide access to the camera and geolocation features of the device
> you're on
>  * Store data on the device while there is no live access to the server
>  * Cache updates on the mobile device while offline for delivery when
> it comes back online.
>  * If necessary, synchronize updates made on the mobile device with
> updates on the server
>
> Features like geolocation and offline access can be implemented in
> native HTML5 without the need to build an app at all; see
> http://html5demos.com for some examples of the cool things you can do
> on webpages with a modern browser. You can also use a HTML5-based
> development approach embedded in a native app container; for example,
> tools like Phonegap [2] and Appcelerator [3] are designed to help out
> here.
>
> [2] http://phonegap.com/
> [3] http://www.appcelerator.com/
>
> I can't say I know of any libraries that can be used to address the
> synchronisation problem -- but then, I haven't really been lookin

Re: setting up new django project

2012-05-27 Thread azizmb.in
HI

You should have a look at
virtualenv
 and virtualenvwrapper
.

On Mon, May 28, 2012 at 8:23 AM, xaegis  wrote:

> Hello, this is my first time posting to a list!
>  I am running python 2.7 with django 1.4 installed on Ubuntu 12.04
> I am having trouble creating new projects with django. Whenever I use
> the command:
> Code:
>
> sudo /usr/local/lib/python2.7/dist-packages/django/bin/django-admin.py
> startproject cms
>
> I get errors or permission denied messages but if I use:
> Code:
>
> django-admin.py startproject cms
>
> Everything seems to work correctly. I know at some point I created a
> sym link in:
> Code:
>
> /usr/local/bin
>
> but is this the proper way to do this? Should I be using the full path
> instead? Also, why is django found in dist-packages instead of site-
> packages in the python directory? The books I am using are telling me
> the python files should be located in site-packages.
>
> I also noticed that django "startproject" created two directories
> called "cms" one nested inside the other. Is this the default
> behavior, and why?
>
>
> I am also having trouble setting up the sqlite3 back-end and I keep
> getting the error:
>
> Code:
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
> sqlite3/base.py", line 281, in _cursor
>self._sqlite_create_connection()
>  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
> sqlite3/base.py", line 271, in _sqlite_create_connection
>self.connection = Database.connect(**kwargs)
> pysqlite2.dbapi2.OperationalError: unable to open database file
>
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
- Aziz M. Bookwala

Website  | Twitter  |
Github 

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



Re: Tutorial database problem

2012-05-27 Thread ajohnston
What happens if you do:

$ python manage.py shell   ## at the bash prompt
>> import django.db.backends.sqlite3  ## in the python shell

If you get an error, you might try reinstalling django. But I'm not sure 
what the problem is/was. Your DATABASES code looks fine.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/zKE53KxtfbMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.