Re: Learn DJango first, then learn Pinax; or just learn Pinax straight-off?

2011-09-18 Thread
I suggest learn django first

2011/9/17 Alec Taylor 

> Good afternoon,
>
> I plan on using Pinax for a project I'm doing (releasing project under
> New BSD or similar).
>
> My Learning Plan is as follows:
> 1. https://docs.djangoproject.com/en/dev//intro/tutorial01/
> https://docs.djangoproject.com/en/dev//intro/tutorial02/
> https://docs.djangoproject.com/en/dev//intro/tutorial03/
> 2. http://pinaxproject.com/docs/dev/contributing/#getting-started
>
> My current Python skills are limited to PythonCGI only.
>
> Would you recommend I follow the aforementioned Learning Plan, or
> would you recommend a different method?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
> --
> 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.
>
>


-- 
Deng Chao

-- 
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: Practical Django Projects blog app admin not showing entries with draft status

2010-02-03 Thread
register the class to the admin, you can find it in the source code. And you
can download the source code at apress website.

2010/2/4 neridaj 

> I'm following along James Bennett's tutorials and when I save an entry
> as a draft it doesn't show up in the admin interface for further
> editing. When I log in with psql I can see the draft in the database
> but the admin doesn't show the draft in the entries, however the draft
> is listed in the Tagged Items table. HOw do I get the draft to show up
> in the entries, do I need to add something to the admin.py file for
> the blog app?
>
> class EntryAdmin(admin.ModelAdmin):
>prepopulated_fields = {'slug': ('title',)}
>
> Thanks for any help,
>
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
Deng Chao

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



Re: How to display Error Message

2010-01-05 Thread
If you use django's orm, maybe you can check their document at its website.

2010/1/6 Geobase Isoscale 

> Hi all,
>
> I have a Django extension  that enables me to call predefined PostgreSQL
> functions from the database. I would like to know how to display on the
> browser the error message gotten from the database when one enters invalid
> data into the database.
>
> Many Thanks
>
> Isoscale
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
Deng Chao
-- 

You received this message because you are subscribed to the Google Groups "Django users" group.

To post to this group, send email to django-us...@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: Generic view object_detail on a m2m relationship

2010-01-04 Thread
Try to make a loop in the template, I guess that may can work

2010/1/5 Delacroy Systems 

> This is how I did it in views.py:
>
> def businessshowservice_view(request, business_id):
>business = Business.objects.get(pk=business_id)
>services = Business.objects.get(pk=business_id).service_set.all()
>return object_list(request, queryset=services,
>   extra_context={'business' : business}
>)
>
> (now just have to figure out a way to get my stress back!)
>
> On Jan 4, 7:55 pm, Delacroy Systems  wrote:
> > I see that using object_detail is the 'incorrect' generic view to show
> > details. I am exploring other options, including writing a custom view
> > to give me what I want.
> >
> > On Jan 4, 8:29 am, Delacroy Systems  wrote:
> >
> > > I am trying to use the generic view, object_detail on a m2m
> > > relationship. I have multiple businesses that offer multiple services.
> > > I would like to show the services offered by each business. At the
> > > moment, I see all the services - not just the services that a
> > > particular business is offering.
> >
> > > In models.py:
> > > class Business(models.Model):
> > >   business = models.CharField(max_length=100)
> >
> > > class Service(models.Model):
> > >   service = models.CharField(max_length=100)
> > >   providers = models.ManyToManyField(Business, through =
> > > "BusinessService")
> >
> > > class BusinessService(models.Model):
> > >   business = models.ForeignKey(Business)
> > >   service = models.ForeignKey(Service)
> >
> > > In urls.py:
> > > def get_service():
> > > return Service.objects.all()
> >
> > > businessservice_list = {
> > > #'queryset' : BusinessService.objects.all(),
> > > 'queryset' : Business.objects.all(),
> > > 'extra_context': {'service_list': get_service}
> >
> > > ...skip some detail...
> > > (r'^showservice/(?P\d+)/$', list_detail.object_detail,
> > > businessservice_list),
> >
> > > In business_detail.html:
> > > {% block content %}
> > > Business Services
> > >   {% if object %}
> > > {{ object.business }}
> > > {{ service_list }}
> > >   {% endif %}
> > > {% endblock content%}
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>
>


-- 
Deng Chao

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Binary Post Data to ImageField

2009-12-21 Thread
As I know Django can not save binary data with it's default orm, you can try
to select another orm like sqlalchemy, or you can try to
modify the orm to make it can save binary data.

2009/12/21 Markus T. 

> Hi,
>
> I'm trying to save binary POST data to an ImageFile field - so far
> with no satisfying success.
>
> I can't seem to convince the client (Flex based image editor) to send
> binary data as correct "multipart/form-data"; I only have the option
> to send as raw binary data or with POST variables.
>
> My view function happily receives the binary data, and it looks ok. As
> far as I understand things, if the uploaded data was sent correctly as
> multipart-form-data, Django would create an InMemoryUploadFile object
> and pass it in request.FILES. I could use this code to save the image
> then:
>
> model_instance.image.save("%s.jpg" % img_id, request.FILES
> ['user_img'], True)
>
> What sensible approach could I use to update/save the image with
> binary POST data? I do not want to create a temporary file, though.
>
> I just don't seem to have enough in-depth Django knowledge to find a
> satisfying solution...
>
> Thanks!
>
> Markus
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>
>


-- 
Deng Chao

--

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




Re: How to change this function to use generic view

2009-12-07 Thread
Anyone? Please...

2009/12/7 一千瓦的刀狼 <knifew...@gmail.com>

> Hello? Anyone can help me?
>
> On Dec 6, 9:18 am, 邓超 <knifew...@gmail.com> wrote:
> > Hi all,
> >   I want to change below function to use the generic view function
> > update_object:
> >
> > @login_required
> > def edit_bug_page(request, bug_id = None):
> > if bug_id == None:
> > bugInstance = Bug()
> > else:
> > bugInstance = get_object_or_404(Bug, pk = bug_id)
> > members = bugInstance.project.member.order_by('member')
> >
> > if request.user not in members:
> > return HttpResponseRedirect('/bug/fail/')
> >
> > if request.method == 'POST':
> > form = BugForm(request.POST, instance = bugInstance)
> >
> > if form.is_valid():
> > bug = form.save()
> >
> > return HttpResponseRedirect('/bug/success/')
> > else:
> > form = BugForm(instance = bugInstance)
> >
> > variables = RequestContext(request, {'form': form})
> >
> > return render_to_response('add_bug.html', variables)
> >
> > But how to use the update_object function in my views.py? Someone can
> help
> > me? Thanks a lot!
> > --
> > Deng Chao
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
Deng Chao

--

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




How to change this function to use generic view

2009-12-05 Thread
Hi all,
  I want to change below function to use the generic view function
update_object:

@login_required
def edit_bug_page(request, bug_id = None):
if bug_id == None:
bugInstance = Bug()
else:
bugInstance = get_object_or_404(Bug, pk = bug_id)
members = bugInstance.project.member.order_by('member')

if request.user not in members:
return HttpResponseRedirect('/bug/fail/')

if request.method == 'POST':
form = BugForm(request.POST, instance = bugInstance)

if form.is_valid():
bug = form.save()

return HttpResponseRedirect('/bug/success/')
else:
form = BugForm(instance = bugInstance)

variables = RequestContext(request, {'form': form})

return render_to_response('add_bug.html', variables)

But how to use the update_object function in my views.py? Someone can help
me? Thanks a lot!
-- 
Deng Chao

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Got error when update object

2009-12-01 Thread
Hi DR,
  Thank you very much! It works now. I will check the doc about the
difference of the queryset and instance. Anyway, thanks a lot!

2009/12/1 Daniel Roseman <dan...@roseman.org.uk>

> On Dec 1, 3:24 pm, 邓超 <knifew...@gmail.com> wrote:
> > Hi all,
> >   I'm writing a small app, and get an error when trying to update the
> > object, the error message is
> >
> > 'QuerySet' object has no attribute '_meta'. and It shows that I made
> > some mistake on this line:
> > form = ProjectForm(instance = projectInstance). But I don't know where
> > am I wrong. The below is my code in views.py.
> >
> > @login_required
> > def edit_project(request, project_id = None):
> > if project_id == None:
> > projectInstance = Project()
> > else:
> > projectInstance = Project.objects.filter(id =
> > project_id).filter(Q(creater = request.user) | Q(administrator =
> > request.user))
>
> Here's your problem. filter() returns a queryset, not an instance.
> Either use get() (if you're sure you're never going to have more than
> one matching object), or slice the result with [0] to get a single
> instance.
> --
> DR.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
Deng Chao

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Got error when update object

2009-12-01 Thread
Hi all,
  I'm writing a small app, and get an error when trying to update the
object, the error message is

'QuerySet' object has no attribute '_meta'. and It shows that I made
some mistake on this line:
form = ProjectForm(instance = projectInstance). But I don't know where
am I wrong. The below is my code in views.py.


@login_required
def edit_project(request, project_id = None):
if project_id == None:
projectInstance = Project()
else:
projectInstance = Project.objects.filter(id =
project_id).filter(Q(creater = request.user) | Q(administrator =
request.user))

if projectInstance.count() == 0:
return HttpResponseRedirect('/edit/fail/')

if request.method == 'POST':
form = ProjectForm(request.POST, instance = projectInstance)

if form.is_valid():
project = form.save(commit = False)

if project.creater is None:
project.creater = request.user
else:
project.creater = project.creater

project.save()
form.save_m2m()

return HttpResponseRedirect('/')
else:
form = ProjectForm(instance = projectInstance)

variables = RequestContext(request, {'form': form})

return render_to_response('add_project.html', variables)

My environment is: UBUNTU910, Django 1.1.1. Anyone can help me? Thank you
very much!
-- 
Deng Chao

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problem about write data into the DB

2009-10-22 Thread
HI Bruno,
  Thank you for your answer. The reason I choose setup the whole environment
is I need setup them in a virtual machine and send this virtual machine to
my friends to test it, they are not familiar with django, they just want to
open the web browser and test the site. And I also want to get a try,
actually this is my first time to deploy a django project, I need chance to
exercise.
  The HTTP 500 error has solved just now. Yes, you are right. the apache
account hasn't the r/w access to the DB file, I modified the rights of the
DB file and my site works well now! Thank you very much!

2009/10/22 bruno desthuilliers <bruno.desthuilli...@gmail.com>

>
> On 21 oct, 17:28, 邓超 <knifew...@gmail.com> wrote:
> > Hi all,
> >   I deployed a django app on my laptop, the whole environment is like
> this:
> > the OS is UBUNTU904, the web server is Apache,
>
> If it's only for personal use on a single laptop, setting up Apache is
> possibly overkill - you could as well use the builtin dev server.
>
> >  and the database is sqlite3.
> > The deployment is success, but  when I try to write some data into the
> > database, I get the HTTP 500 error. And I check the error log, it
> > shows "*OperationalError:
> > unable to open database file*". What does this error mean? If there are
> some
> > operation permission need configure?
>
> Does the Apache process have r/w access on the sqlite DB file ? (on
> ubuntu, the user account for Apache is "www-data").
>
>
> >
>


-- 
Deng Chao

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



Problem about write data into the DB

2009-10-21 Thread
Hi all,
  I deployed a django app on my laptop, the whole environment is like this:
the OS is UBUNTU904, the web server is Apache, and the database is sqlite3.
The deployment is success, but  when I try to write some data into the
database, I get the HTTP 500 error. And I check the error log, it
shows "*OperationalError:
unable to open database file*". What does this error mean? If there are some
operation permission need configure?

-- 
Deng Chao

--~--~-~--~~~---~--~~
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: Django and CouchDB

2009-08-17 Thread
You can google it. I have read once, but forget the link address now.

2009/8/18 sjtirtha 

> Hi,
>
> can some body share about his experience using Django and CouchDB?
> I found some python API that can be used to access CouchDB, which one is
> the best and suitable to Django Framework.
>
> Regards,
> STeve
>
> >
>


-- 
Deng Chao

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



How to access blob type data in django

2009-07-28 Thread
Hi all,  I'm trying to setup a picture library website using django. What I
want to do is store the picture into the database directly and access the db
to show them in the html file when user view in the web. I have read some
documents and tutorial about the django but what I have learned is just
store the picture files in my hard disk not in the db. And it looks that the
django Model field hasn't such a type to deal with the binary data like blob
data type in the database. So can django meet my request? If django can do
it and how can I do it with django? Thank you very much!

-- 
Deng Chao

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