Re: Populating a list in a form based on a relationship

2012-02-13 Thread Shawn Milochik
You override the __init__ of the form object and set the .choices 
property of the form field representing the items.



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



Populating a list in a form based on a relationship

2012-02-13 Thread dimz25
Hi all,

I'm new to django/python. I have been looking through the docs since
several days but cannot get it to work. This is probably some common
stuff to handle.

Here's the situation:

My app should display a form based on the Report model. A Report has
several fields (reference, na, items) A Report can contain several
items. The items are defined and to be found in the model Item. Till
here I got it working.

Now, the tricky part for me is the following:

A company can make its own item collections. An item collection has a
name, a company (fk to Company model), and a list of items (many to
many relationship to Item model, using a through attribute because
that relation needs to store more information)

So, how can I get the Report form to display the items (in a multiple
select menu) that are part of an item collection. I don't want to
display the whole item list as it is working now.

In the following code you'll find my models.py and views.py:
http://dpaste.com/702880/

I tried to replace the many to many relationship in the report model
to ItemCollection instead of Item, but then it displays the names of
my different ItemCollections which is not the desired result.

To make things clear, a Report is not necesarily related to an
ItemCollection. The ItemCollection is related to a Company. The Report
is made/encoded by a Company. The company selects which items go into
that report.

Based on the company I pass as an argument, the form should get the
list of Items from ItemCollections. I suppose this has to be done in
the view, but I can't get my head around it.

-- 
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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Python_Junkie
Now that you have your file >>models.py   place this file in the
app folder after creating your app

1.  python manage.py start app  My_Erp (for example)
2.  a blank models.py file will be created, overwrite this with your
models.py
3. run the command to sync the database, assuming that your set up the
settings.py file has been set up correctly to connect to the database
of your choice.

python manage.py syncdb

Let me know if this works for you









On Feb 13, 3:56 pm, Saadat  wrote:
> Thank you Python_junkie
> I've created the poll app and I'm working on this Hospital ERP thing.
> I've also created the database schema and put some dummy values for
> testing. Then I created the models using 'inspected' command and saved
> the models in models.py file. Now I'm confused where to put the
> models.py file and what to with it. Guide me please.
>
> Thanks a lot.
> Saadat
>
> On Feb 10, 6:18 pm, Python_Junkie 
> wrote:
>
>
>
>
>
>
>
> > Not sure from your post, which piece you are stuck on.
>
> > 1. Have you used Django before?
> > If not start with the tutorial
>
> >https://www.djangoproject.com/
>
> > 2. If you have a basic understanding of Django, have you been able to
> > set up a basic project /app and connect run syncdb.
> > One can always connect to the sqllite database, because it is built
> > in, but getting some other database to connect can be a time consuming
> > process if the procedure has not been established on your machine.
>
> > 3. If you have done the above 2 items then you should move in a
> > parallel path.
>
> > a. Start defining your database model to support the business and the
> > workflow that you intend to create.
> > b. Use some sort of wire frame (framework) to lay out your web pages
> > to support and interact step 3 a.
>
> > On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
>
> > > Hello, nice thread.
>
> > > **tagged to keep following..
>
> > > +adesst
>
> > > -Original Message-
> > > From: Saadat 
>
> > > Sender: django-users@googlegroups.com
> > > Date: Fri, 10 Feb 2012 02:58:16
> > > To: Django users
> > > Reply-To: django-users@googlegroups.com
> > > Subject: Creating a hospital erp (hospital management) in Django
>
> > > Hello All,
> > > I'm in my final year of computer science engineering and for my final
> > > year project, i'm creating a hospital erp. I'm a bit confused about
> > > where to start from. Any sort of help will be appreciated. Thanks a
> > > lot.
>
> > > Cheers
> > > Saadat
>
> > > --
> > > 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 
> > > athttp://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 while running django-admin.py

2012-02-13 Thread Kejun He
hi,
  paste the traceback. Maybe reinstall django can resolve the problem.

On Tue, Feb 14, 2012 at 7:44 AM, WebServices wrote:

> django-admin.py startproject throwing error - Syntax error
>
> --
> 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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Ovnicraft
On Fri, Feb 10, 2012 at 5:58 AM, Saadat  wrote:

> Hello All,
> I'm in my final year of computer science engineering and for my final
> year project, i'm creating a hospital erp. I'm a bit confused about
> where to start from. Any sort of help will be appreciated. Thanks a
> lot.
>

Maybe DRY can help you and start from OpenERP .
Its wrote in python, MVC, WS, etc.

Regards,

>
> Cheers
> Saadat
>
> --
> 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.
>
>


-- 
Cristian Salamea
@ovnicraft

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



error while running django-admin.py

2012-02-13 Thread WebServices
django-admin.py startproject throwing error - Syntax error

-- 
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: How can I know when the third multiple is reached in an arbitrarily long list

2012-02-13 Thread Jason
Thank you so much Shawn - you saved the day there!

-- 
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/-/Bsqh5-j2Q34J.
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: How can I know when the third multiple is reached in an arbitrarily long list

2012-02-13 Thread Shawn Milochik
You can use the divisibleby template tag in combination with a 
forloop.counter (both explained on this page):


https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#divisibleby

--
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 setup on Win7 - can't import some things

2012-02-13 Thread Bob Carlson
Thanks. That cleared the View Does Not Exist error. It was left over from the a
previous state of the tutorial.

Cheers, Bob

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Bill Freeman
Sent: Monday, February 13, 2012 12:32
To: django-users@googlegroups.com
Subject: Re: Django setup on Win7 - can't import some things

Are you sure that you don't have something like:

...
urlpatterns = patterns('polls.views',
...

instead of the empty string first argument to patterns that you show?

On 2/13/12, Bob Carlson  wrote:
> I'm now on the 1.2 tutorial, but a similar error message is coming up. 
> The urls.py file is
>
> from django.conf.urls.defaults import * from polls.models import Poll
>
> info_dict = {
> 'queryset': Poll.objects.all(),
> }
>
> urlpatterns = patterns('',
> (r'^$', 'django.views.generic.list_detail.object_list', info_dict),
> 
>
> The error message is
> ViewDoesNotExist at /polls/
> Could not import polls.views.django.views.generic.list_detail. Error 
> was: No module named django.views.generic.list_detail
>
> List_detail is clearly there in the django/generic folder.
>
> Cheers, Bob
>
> -Original Message-
> From: django-users@googlegroups.com 
> [mailto:django-users@googlegroups.com]
> On
> Behalf Of Brett Epps
> Sent: Monday, February 13, 2012 10:12
> To: django-users@googlegroups.com
> Subject: Re: Django setup on Win7 - can't import some things
>
> Hi Bob,
>
> It sounds like you're using the 1.3 or later version of the tutorial.
> Class-based generic views were added in 1.3.  Try this link for the 
> correct
> version:
>
> https://docs.djangoproject.com/en/1.2/intro/tutorial01/
>
> (Note the 1.2 in the URL.)
>
> Hope that helps,
>
> Brett
>
>
> On 2/13/12 10:35 AM, "LostInTheTrees"  wrote:
>
>>I am trying to get started with Django and having some trouble. I'm 
>>using Django 1.2 to reserve the ability to go to Google's app engine 
>>if I want. I have python 2.7 installed and working on Win7. I 
>>unstalled Django 1.2 using the install script and it copied Django 
>>into the site-packages directory.
>>
>>I have been working through the tutorial and am just about finished.
>>However, in the last step, the tutorial uses generic views. When I run 
>>it, I get "cannot import name DetailView". The import command, 
>>straight from the tutorial is "from django.views.generic import 
>>DetailView, ListView".
>>
>>Early on, I could not execute django-admin.py. I had already installed 
>>PIL and I had read about *.pth files in .../site-packages/*. So I 
>>created a file django.pth. In it I put the single line "django\bin".
>>After this, django-admin.py could be easily executed.
>>
>>Do I have to add more lines to django.pth? Is there something else I 
>>missed?
>>
>>-Bob
>>
>>--
>>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.
>
>

--
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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Saadat
Yeah, the project is to be written in Django and it was meant to be
written in Django only.

On Feb 10, 7:05 pm, Python_Junkie 
wrote:
> Is the project referenced in this link written in Django.
>
> Was your goal for your class project to write a Django app?
>
> On Feb 10, 8:27 am, Richard House  wrote:
>
>
>
>
>
>
>
> > Hi Saadat,
> > Rather than creating something new, have you looked at contributing to 
> > software from such lists like 
> > this?http://en.wikipedia.org/wiki/List_of_open-source_healthcare_software
>
> > Regards,
> > Richard
>
> > On 10 Feb 12, at 10:58, Saadat wrote:
>
> > > Hello All,
> > > I'm in my final year of computer science engineering and for my final
> > > year project, i'm creating a hospital erp. I'm a bit confused about
> > > where to start from. Any sort of help will be appreciated. Thanks a
> > > lot.
>
> > > Cheers
> > > Saadat
>
> > > --
> > > 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 
> > > athttp://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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Saadat
Hi Patricio
I dont understand what you mean by System Development methodology.
What exactly do you want me to let you know?

Thanks

On Feb 10, 6:59 pm, Patricio Valarezo 
wrote:
> El 10/02/12 8:26, Python_Junkie escribi :
>
>
>
>
>
>
>
>
>
> > I had not completed my previous post, and hit the send button by
> > mistake.
>
> > One wire frame work is
> >http://www.balsamiq.com/products/mockups/manifesto
>
> > And you can download a free trial.
>
> > If you search on Frameworks then you will find a number of others that
> > are open source, or you can simply use yellow stickies, as some of
> > these web sites suggest as an alternative.
>
> > Then convert the yellow stickies into web pages and link them to the
> > backend database.
>
> > Good luck
>
> > On Feb 10, 8:18 am, Python_Junkie
> > wrote:
> >> Not sure from your post, which piece you are stuck on.
>
> >> 1. Have you used Django before?
> >> If not start with the tutorial
>
> >>https://www.djangoproject.com/
>
> >> 2. If you have a basic understanding of Django, have you been able to
> >> set up a basic project /app and connect run syncdb.
> >> One can always connect to the sqllite database, because it is built
> >> in, but getting some other database to connect can be a time consuming
> >> process if the procedure has not been established on your machine.
>
> >> 3. If you have done the above 2 items then you should move in a
> >> parallel path.
>
> >> a. Start defining your database model to support the business and the
> >> workflow that you intend to create.
> >> b. Use some sort of wire frame (framework) to lay out your web pages
> >> to support and interact step 3 a.
>
> >> On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
>
> >>> Hello, nice thread.
> >>> **tagged to keep following..
> >>> +adesst
> >>> -Original Message-
> >>> From: Saadat
> >>> Sender: django-users@googlegroups.com
> >>> Date: Fri, 10 Feb 2012 02:58:16
> >>> To: Django users
> >>> Reply-To: django-users@googlegroups.com
> >>> Subject: Creating a hospital erp (hospital management) in Django
> >>> Hello All,
> >>> I'm in my final year of computer science engineering and for my final
> >>> year project, i'm creating a hospital erp. I'm a bit confused about
> >>> where to start from. Any sort of help will be appreciated. Thanks a
> >>> lot.
>
> What about choosing a system development methodology? A simple one could
> you give some clues, the code is always the last thing to do.
>
> --
> Patricio Valarezo Lozano.
> patov...@pupilabox.net.ecwww.pupilabox.net.ec
> "las cosas no se hacen solas, alguien las tiene que hacer..."

-- 
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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Saadat
Thanks Richard House,
Its my final project and I have to create something new. So I cannot
work on something that has already been built. Thanks again.

On Feb 10, 6:27 pm, Richard House  wrote:
> Hi Saadat,
> Rather than creating something new, have you looked at contributing to 
> software from such lists like 
> this?http://en.wikipedia.org/wiki/List_of_open-source_healthcare_software
>
> Regards,
> Richard
>
> On 10 Feb 12, at 10:58, Saadat wrote:
>
>
>
>
>
>
>
> > Hello All,
> > I'm in my final year of computer science engineering and for my final
> > year project, i'm creating a hospital erp. I'm a bit confused about
> > where to start from. Any sort of help will be appreciated. Thanks a
> > lot.
>
> > Cheers
> > Saadat
>
> > --
> > 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 
> > athttp://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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Saadat
Thank you Python_junkie
I've created the poll app and I'm working on this Hospital ERP thing.
I've also created the database schema and put some dummy values for
testing. Then I created the models using 'inspected' command and saved
the models in models.py file. Now I'm confused where to put the
models.py file and what to with it. Guide me please.

Thanks a lot.
Saadat

On Feb 10, 6:18 pm, Python_Junkie 
wrote:
> Not sure from your post, which piece you are stuck on.
>
> 1. Have you used Django before?
> If not start with the tutorial
>
> https://www.djangoproject.com/
>
> 2. If you have a basic understanding of Django, have you been able to
> set up a basic project /app and connect run syncdb.
> One can always connect to the sqllite database, because it is built
> in, but getting some other database to connect can be a time consuming
> process if the procedure has not been established on your machine.
>
> 3. If you have done the above 2 items then you should move in a
> parallel path.
>
> a. Start defining your database model to support the business and the
> workflow that you intend to create.
> b. Use some sort of wire frame (framework) to lay out your web pages
> to support and interact step 3 a.
>
> On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
>
>
>
>
>
>
>
> > Hello, nice thread.
>
> > **tagged to keep following..
>
> > +adesst
>
> > -Original Message-
> > From: Saadat 
>
> > Sender: django-users@googlegroups.com
> > Date: Fri, 10 Feb 2012 02:58:16
> > To: Django users
> > Reply-To: django-users@googlegroups.com
> > Subject: Creating a hospital erp (hospital management) in Django
>
> > Hello All,
> > I'm in my final year of computer science engineering and for my final
> > year project, i'm creating a hospital erp. I'm a bit confused about
> > where to start from. Any sort of help will be appreciated. Thanks a
> > lot.
>
> > Cheers
> > Saadat
>
> > --
> > 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 
> > athttp://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: Custom constraints on User fields

2012-02-13 Thread Shawn Milochik
It's probably related to the 80/20 rule. No tool or framework is going 
to be 100% what you need. Use it for the 80%. When your needs can't be 
handled by the tool, you can choose to twist yourself into a pretzel 
within the constraints of the tool or break free and do it the "manual" 
way -- usually with more maintainable results.


Just because there's no easy way to do something in Django doesn't mean 
there's something wrong with Django. Nor does it mean that your 
requirements are wrong. It just means you have to use your developer skills.


Incidentally, the auth.models.User model is a subject of a lot of debate 
and inconvenience for a lot of people, and if you check out Django's 
Trac instance and the history of django-developers you'll see that 
people are working on changing it. Not that it will help you in this 
case, but perhaps you could read up on the threads and see if you want 
to get involved in the work.


Shawn


--
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: Custom constraints on User fields

2012-02-13 Thread Nicolas Bazire
On Feb 13, 9:27 pm, Shawn Milochik  wrote:
> On 02/13/2012 03:25 PM, Nicolas Bazire wrote:
>
> > On Feb 13, 9:16 pm, Shawn Milochik  wrote:
> >> You can override and customize the forms, then manually add the unique
> >> indexes to your database.
>
> > Overriding the forms is only part of the problem.
> > For instance, forms are not used with Model.objects.create().
> > I want to enforce such constraints and not just at the form level.
>
> Yep. Notice my response that you quoted. Manually add the unique index
> to your database in addition to overriding the forms.

Okay, then new question : how to do that without creating manual
indexes? The application is supposed to be easily reusable, if I start
to include custom index creation or South migrations this is really
going to be difficult to maintain.

But that's not my main concern : how come redefining field constraints
is so difficult?

Extending the User model or monkeypatching it is highly discouraged,
but I have no clue as to how to achieve that in a clean way without
modifying the database manually.

-- 
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: Custom constraints on User fields

2012-02-13 Thread Shawn Milochik

On 02/13/2012 03:25 PM, Nicolas Bazire wrote:

On Feb 13, 9:16 pm, Shawn Milochik  wrote:

You can override and customize the forms, then manually add the unique
indexes to your database.


Overriding the forms is only part of the problem.
For instance, forms are not used with Model.objects.create().
I want to enforce such constraints and not just at the form level.



Yep. Notice my response that you quoted. Manually add the unique index 
to your database in addition to overriding the forms.


--
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: Custom constraints on User fields

2012-02-13 Thread Nicolas Bazire
On Feb 13, 9:16 pm, Shawn Milochik  wrote:
> You can override and customize the forms, then manually add the unique
> indexes to your database.

Overriding the forms is only part of the problem.
For instance, forms are not used with Model.objects.create().
I want to enforce such constraints and not just at the form level.

-- 
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: Custom constraints on User fields

2012-02-13 Thread Shawn Milochik
You can override and customize the forms, then manually add the unique 
indexes to your database.


Django doesn't provide much index functionality and adding indexes to 
your database manually may be required for something like this or 
performance.


Whenever possible update the related code with comments about the 
indexes that exist in the database.


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



Custom constraints on User fields

2012-02-13 Thread Nicolas Bazire
Hi,

I'm looking for the right way to add custom constraints on some fields
in the User model provided by django.contrib.auth. I'm not only
talking about form validation, but also database constraints (for
instance, unique).

Basically what I want to do is make the field "email" mandatory and
unique, how can I code that?

I was able to implement such "custom constraints" using pre_save
signal or a Proxy model, but I'm not really sure that either of those
implementations are a good choice.

Nicolas

-- 
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-admin.py startproject doesn't work

2012-02-13 Thread Jonathan Paugh
On 02/13/2012 11:01 AM, Dennis Lee Bieber wrote:
> On Sun, 12 Feb 2012 23:02:20 -0800 (PST), raddy 
> wrote:
...
>   Can you run ANY python script (.py) file by typing its name on the
> command line?... Say something that does nothing more than:
> 
> print "I'm running"
> 
> (test while /in/ the directory that has the file, first)
> 
>   My suspicion is that you don't have .py defined as a valid "command
> file extension" NOR do you have the associations set to run one. What

I'm pretty sure you can also make .py files executable by mucking around
in the Windows registry, if you don't have PowerShell--although I can't
recommend that, of course. You should be able to find tutorials for that
or similar, none of which will recommend actually doing it.

You have to make 2 registry entries, which will be similar to the
preexisting ones for .exe files. (command file extension and association).

Backup your registry and think about how much you value your Windows
installation. If you open regedit.exe, you can search for EXE, and you
will eventually find both entries that need to be replicated, albeit
among many unrelated entries.

However, I haven't used Windows OSes since 2009, and no one can make me
go back. I.e. if you do this, you're on your own.

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

2012-02-13 Thread Jonathan Paugh
On 02/13/2012 06:51 AM, xina towner wrote:
> Hi, I get this message when I try to acces to the admin page:
> 
> AlreadyRegistered at /admin
> 
> 
> The model Location is already registered
> 
> 
> does anybody know which is the problem?
> 

This is a horrible, horrible problem which I've worked around as follows:


from django.contrib.admin import site

def adminRegister(model, admin_class=None, **kwargs):
  '''(Re)register a model with the AdminSite site.'''
  if model in site._registry:
site.unregister(model)
  site.register(model, admin_class, **kwargs)

class MagicModel(models.Model):
  pass
adminRegister(MagicModel)


I encountered this whenever I tried to run ./manage.py shell and
./manage.py runserver at the same time. If I understood what I read in
the development list, though, this is being fixed for release 1.4.

-- 
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: Model field that links to a page ID, or external URL

2012-02-13 Thread Jonathan Paugh
On 02/13/2012 11:09 AM, Diederik van der Boor wrote:
> Hi,
> 
> In CMS interfaces I generally encounter a problem with URL fields.
> In most situations, the following options need to be supported:
> - An URL to an external page  (Django's URLField can handle that)
> - An URL to an internal page (e.g. Django CMS)
> - An URL to an other model (e.g. article)
> 
> How can I reasonably store this information in a model field?
> I would love to store these values as foreign key, as it would allow more 
> querying options.
> 
> I've written a solution for this before using a forms.MultiValueField / 
> MultiWidget input,
> which did involve the ugly hack of saving the contents as string, using the 
> format:
> - http://...external-page/
> - pageid://##-- the internal page
> - articleid://##  -- link to an article.
> This works, and did fit in the project deadline.
> However, I would like to improve upon this.
> 
> Does anyone have a suggestion on how to store the various information 
> properly?
> 
> Greetings,
> Diederik
> 
Each model supports a get_absolute_url(self) method, which allows you to
retrieve each object's url in whatever way you want, including pulling
values from self (i.e. the model object.). Returned urls are in serveral
formats; my prefered is '/full/path/to/article'.

-- 
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 setup on Win7 - can't import some things

2012-02-13 Thread Bill Freeman
Are you sure that you don't have something like:

...
urlpatterns = patterns('polls.views',
...

instead of the empty string first argument to patterns that you show?

On 2/13/12, Bob Carlson  wrote:
> I'm now on the 1.2 tutorial, but a similar error message is coming up. The
> urls.py file is
>
> from django.conf.urls.defaults import *
> from polls.models import Poll
>
> info_dict = {
> 'queryset': Poll.objects.all(),
> }
>
> urlpatterns = patterns('',
> (r'^$', 'django.views.generic.list_detail.object_list', info_dict),
> 
>
> The error message is
> ViewDoesNotExist at /polls/
> Could not import polls.views.django.views.generic.list_detail. Error was: No
> module named django.views.generic.list_detail
>
> List_detail is clearly there in the django/generic folder.
>
> Cheers, Bob
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> On
> Behalf Of Brett Epps
> Sent: Monday, February 13, 2012 10:12
> To: django-users@googlegroups.com
> Subject: Re: Django setup on Win7 - can't import some things
>
> Hi Bob,
>
> It sounds like you're using the 1.3 or later version of the tutorial.
> Class-based generic views were added in 1.3.  Try this link for the correct
> version:
>
> https://docs.djangoproject.com/en/1.2/intro/tutorial01/
>
> (Note the 1.2 in the URL.)
>
> Hope that helps,
>
> Brett
>
>
> On 2/13/12 10:35 AM, "LostInTheTrees"  wrote:
>
>>I am trying to get started with Django and having some trouble. I'm
>>using Django 1.2 to reserve the ability to go to Google's app engine if
>>I want. I have python 2.7 installed and working on Win7. I unstalled
>>Django 1.2 using the install script and it copied Django into the
>>site-packages directory.
>>
>>I have been working through the tutorial and am just about finished.
>>However, in the last step, the tutorial uses generic views. When I run
>>it, I get "cannot import name DetailView". The import command, straight
>>from the tutorial is "from django.views.generic import DetailView,
>>ListView".
>>
>>Early on, I could not execute django-admin.py. I had already installed
>>PIL and I had read about *.pth files in .../site-packages/*. So I
>>created a file django.pth. In it I put the single line "django\bin".
>>After this, django-admin.py could be easily executed.
>>
>>Do I have to add more lines to django.pth? Is there something else I
>>missed?
>>
>>-Bob
>>
>>--
>>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.
>
>

-- 
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-admin.py startproject doesn't work

2012-02-13 Thread Bob Carlson
I had this problem. I read about *.pth files and found one for the PIL library.

I put a file called django.pth in .../site-packages/.

I put one line in the pth file: "django\bin".

I am confused about the pth file though. Should I have more directories in
there?

Cheers, Bob

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of James Jang
Sent: Monday, February 13, 2012 09:34
To: Django users
Subject: Re: django-admin.py startproject doesn't work

Is "django-admin.py" file in the directory, "Django-1.3.1"??



(If not copy or move the file from in "Django-1.3.1/django/bin/" to
"Django-1.3.1/".)



On 2월13일, 오후4시02분, raddy  wrote:
> I have windows7 OS and have installed Python27 and Django1.3.1 I have 
> also set the path in the environment variables to: C:
> \Python27\;C:\Python27\python.exe;C:\Python27\Scripts;C:\Python27\Lib
> \site-packages\django\bin
>
> Commands like python and import django works well but when i try 
> creating a new project I get the following error:
>
> C:\Python27\Django-1.3.1>django-admin.py startproject mysite 
> 'django-admin.py' is not recognized as an internal or external 
> command, operable program or batch file.
>
> C:\Python27\Django-1.3.1>
>
> Please 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.

-- 
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 setup on Win7 - can't import some things

2012-02-13 Thread Bob Carlson
I'm now on the 1.2 tutorial, but a similar error message is coming up. The
urls.py file is

from django.conf.urls.defaults import *
from polls.models import Poll

info_dict = {
'queryset': Poll.objects.all(),
}

urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list', info_dict),


The error message is 
ViewDoesNotExist at /polls/
Could not import polls.views.django.views.generic.list_detail. Error was: No
module named django.views.generic.list_detail

List_detail is clearly there in the django/generic folder.

Cheers, Bob

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Brett Epps
Sent: Monday, February 13, 2012 10:12
To: django-users@googlegroups.com
Subject: Re: Django setup on Win7 - can't import some things

Hi Bob,

It sounds like you're using the 1.3 or later version of the tutorial.
Class-based generic views were added in 1.3.  Try this link for the correct
version:

https://docs.djangoproject.com/en/1.2/intro/tutorial01/

(Note the 1.2 in the URL.)

Hope that helps,

Brett


On 2/13/12 10:35 AM, "LostInTheTrees"  wrote:

>I am trying to get started with Django and having some trouble. I'm 
>using Django 1.2 to reserve the ability to go to Google's app engine if 
>I want. I have python 2.7 installed and working on Win7. I unstalled 
>Django 1.2 using the install script and it copied Django into the 
>site-packages directory.
>
>I have been working through the tutorial and am just about finished.
>However, in the last step, the tutorial uses generic views. When I run 
>it, I get "cannot import name DetailView". The import command, straight 
>from the tutorial is "from django.views.generic import DetailView, 
>ListView".
>
>Early on, I could not execute django-admin.py. I had already installed 
>PIL and I had read about *.pth files in .../site-packages/*. So I 
>created a file django.pth. In it I put the single line "django\bin".
>After this, django-admin.py could be easily executed.
>
>Do I have to add more lines to django.pth? Is there something else I 
>missed?
>
>-Bob
>
>--
>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: Django setup on Win7 - can't import some things

2012-02-13 Thread Bob Carlson
I guess that's it. I was conscious of the different tutorial versions, but must
have gotten onto the wrong one at some point.

Cheers, Bob

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Brett Epps
Sent: Monday, February 13, 2012 10:12
To: django-users@googlegroups.com
Subject: Re: Django setup on Win7 - can't import some things

Hi Bob,

It sounds like you're using the 1.3 or later version of the tutorial.
Class-based generic views were added in 1.3.  Try this link for the correct
version:

https://docs.djangoproject.com/en/1.2/intro/tutorial01/

(Note the 1.2 in the URL.)

Hope that helps,

Brett


On 2/13/12 10:35 AM, "LostInTheTrees"  wrote:

>I am trying to get started with Django and having some trouble. I'm 
>using Django 1.2 to reserve the ability to go to Google's app engine if 
>I want. I have python 2.7 installed and working on Win7. I unstalled 
>Django 1.2 using the install script and it copied Django into the 
>site-packages directory.
>
>I have been working through the tutorial and am just about finished.
>However, in the last step, the tutorial uses generic views. When I run 
>it, I get "cannot import name DetailView". The import command, straight 
>from the tutorial is "from django.views.generic import DetailView, 
>ListView".
>
>Early on, I could not execute django-admin.py. I had already installed 
>PIL and I had read about *.pth files in .../site-packages/*. So I 
>created a file django.pth. In it I put the single line "django\bin".
>After this, django-admin.py could be easily executed.
>
>Do I have to add more lines to django.pth? Is there something else I 
>missed?
>
>-Bob
>
>--
>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: Django setup on Win7 - can't import some things

2012-02-13 Thread Brett Epps
Hi Bob,

It sounds like you're using the 1.3 or later version of the tutorial.
Class-based generic views were added in 1.3.  Try this link for the
correct version:

https://docs.djangoproject.com/en/1.2/intro/tutorial01/

(Note the 1.2 in the URL.)

Hope that helps,

Brett


On 2/13/12 10:35 AM, "LostInTheTrees"  wrote:

>I am trying to get started with Django and having some trouble. I'm
>using Django 1.2 to reserve the ability to go to Google's app engine
>if I want. I have python 2.7 installed and working on Win7. I
>unstalled Django 1.2 using the install script and it copied Django
>into the site-packages directory.
>
>I have been working through the tutorial and am just about finished.
>However, in the last step, the tutorial uses generic views. When I run
>it, I get "cannot import name DetailView". The import command,
>straight from the tutorial is "from django.views.generic import
>DetailView, ListView".
>
>Early on, I could not execute django-admin.py. I had already installed
>PIL and I had read about *.pth files in .../site-packages/*. So I
>created a file django.pth. In it I put the single line "django\bin".
>After this, django-admin.py could be easily executed.
>
>Do I have to add more lines to django.pth? Is there something else I
>missed?
>
>-Bob
>
>-- 
>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: django-admin.py startproject doesn't work

2012-02-13 Thread jak.plopelor
I don't know, but on ubuntu it's call just 'django-admin' without the.
py

-- 
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 setup on Win7 - can't import some things

2012-02-13 Thread LostInTheTrees
I am trying to get started with Django and having some trouble. I'm
using Django 1.2 to reserve the ability to go to Google's app engine
if I want. I have python 2.7 installed and working on Win7. I
unstalled Django 1.2 using the install script and it copied Django
into the site-packages directory.

I have been working through the tutorial and am just about finished.
However, in the last step, the tutorial uses generic views. When I run
it, I get "cannot import name DetailView". The import command,
straight from the tutorial is "from django.views.generic import
DetailView, ListView".

Early on, I could not execute django-admin.py. I had already installed
PIL and I had read about *.pth files in .../site-packages/*. So I
created a file django.pth. In it I put the single line "django\bin".
After this, django-admin.py could be easily executed.

Do I have to add more lines to django.pth? Is there something else I
missed?

-Bob

-- 
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: sqlite3 database error

2012-02-13 Thread Tom Evans
On Mon, Feb 13, 2012 at 4:01 PM, Dennis Lee Bieber
 wrote:
> On Mon, 13 Feb 2012 01:50:12 -0800 (PST), Marcus Maximus
>  wrote:
>
>
>>        'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
>>win32-x86-3071000\test.db',                      # Or path to database
>
>        Is that a typo? "Webseite" and not "Website"?
>

Webseite is German for web-site, so probably not.

Cheers

Tom

-- 
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-admin.py startproject doesn't work

2012-02-13 Thread James Jang
Is "django-admin.py" file in the directory, "Django-1.3.1"??



(If not copy or move the file from in "Django-1.3.1/django/bin/" to
"Django-1.3.1/".)



On 2월13일, 오후4시02분, raddy  wrote:
> I have windows7 OS and have installed Python27 and Django1.3.1
> I have also set the path in the environment variables to: C:
> \Python27\;C:\Python27\python.exe;C:\Python27\Scripts;C:\Python27\Lib
> \site-packages\django\bin
>
> Commands like python and import django works well but
> when i try creating a new project I get the following error:
>
> C:\Python27\Django-1.3.1>django-admin.py startproject mysite
> 'django-admin.py' is not recognized as an internal or external
> command,
> operable program or batch file.
>
> C:\Python27\Django-1.3.1>
>
> Please 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.



Model field that links to a page ID, or external URL

2012-02-13 Thread Diederik van der Boor
Hi,

In CMS interfaces I generally encounter a problem with URL fields.
In most situations, the following options need to be supported:
- An URL to an external page  (Django's URLField can handle that)
- An URL to an internal page (e.g. Django CMS)
- An URL to an other model (e.g. article)

How can I reasonably store this information in a model field?
I would love to store these values as foreign key, as it would allow more 
querying options.

I've written a solution for this before using a forms.MultiValueField / 
MultiWidget input,
which did involve the ugly hack of saving the contents as string, using the 
format:
- http://...external-page/
- pageid://##-- the internal page
- articleid://##  -- link to an article.
This works, and did fit in the project deadline.
However, I would like to improve upon this.

Does anyone have a suggestion on how to store the various information properly?

Greetings,
Diederik

-- 
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: Comments Link- How to?

2012-02-13 Thread Babatunde Akinyanmi
Oh ok. Just render the comments as usual then use jquery of pure
javascript to hide it by default. Tie the link to the onclick event
such that it triggers the unhiding of the comment div. Simple.


On 2/13/12, coded kid  wrote:
> Okay. Just like this.  Comment
> Link Name 
>
> Where "Comment Link Name" is the name you want to give to your link.
> So when a user click on it, it should show the comment form on the
> same page.  I hope you now get my point?
>
> On Feb 13, 1:26 pm, Babatunde Akinyanmi  wrote:
>> Please Rephrase. I don't get the part of "comment link name"
>>
>> On 2/13/12, coded kid  wrote:
>>
>> > Hi Guys, How can I link to “Django Comment form”, so that when a user
>> > clicks on the “Comment Link Name” It will display the Comment Form on
>> > the same page with the post. I hope you get my point? If you do please
>> > answer and if you don’t ask me to explain further.
>>
>> > --
>> > 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.
>>
>> --
>> Sent from my mobile device
>
> --
> 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: Mod_Wsgi + Apache 2.2 + Threads + httplib2

2012-02-13 Thread sbrandt
mod_wsgi doesn't support print, does it? Its usage should raise an
exception.

-- 
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: Comments form customization

2012-02-13 Thread Fabio Natali

On 02/13/2012 11:12 AM, Fabio Natali wrote:

http://stackoverflow.com/questions/1456267/django-comments-want-to-remove-user-url-not-expand-the-model-how-to/4766543#4766543


This link worked fine for me. :-)

--
Fabio Natali FNstudio
http://fnstudio.it
fabio_natali@skype

--
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: Comments form customization

2012-02-13 Thread Fabio Natali

On 02/13/2012 11:44 AM:

Yeah, thanks for the reply. I followed the doc but it's not working
for me.

[...]

Hi there!

If you have an object my_object passed by your view to your template, I
think you can write:

{% load comments %}
{% get_comment_count for my_object as comment_count %}
{% get_comment_list for my_object as comment_list %}
{% get_comment_form for my_object as form %}

and then you can:


  {% csrf_token %}
  {{ form }}
  

  
  

  


Let me know it that's of any help. In case, write me what kind of error
you get. Also, I can pass you my source code so you can have an example.

Cheers, Fabio.

--
Fabio Natali

--
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: Comments Link- How to?

2012-02-13 Thread coded kid
Okay. Just like this.  Comment
Link Name 

Where "Comment Link Name" is the name you want to give to your link.
So when a user click on it, it should show the comment form on the
same page.  I hope you now get my point?

On Feb 13, 1:26 pm, Babatunde Akinyanmi  wrote:
> Please Rephrase. I don't get the part of "comment link name"
>
> On 2/13/12, coded kid  wrote:
>
> > Hi Guys, How can I link to “Django Comment form”, so that when a user
> > clicks on the “Comment Link Name” It will display the Comment Form on
> > the same page with the post. I hope you get my point? If you do please
> > answer and if you don’t ask me to explain further.
>
> > --
> > 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.
>
> --
> Sent from my mobile device

-- 
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: sqlite3 database error

2012-02-13 Thread ajohnston
Also 'Webseite' in your file path may be misspelled?

-- 
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 while testing

2012-02-13 Thread xina towner
Lots of Thanks :)

On 13 February 2012 13:52, Sandro Dutra  wrote:

> Think it's a name conflict with the model Location, probably it's
> registered 2 times in "admin.py" (line 4), or try to change the model
> name.
>
> 2012/2/13 xina towner :
> > I'm getting this error when I try to do my tests, can anybody help me
> > please?
> >
> > Traceback (most recent call last):
> >   File "/home/xino/workspace/unnamedapp/accounts/tests.py", line 209, in
> > test_request_invitation
> > resp = self.client.get('/accounts/invite/request/')
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> > line 439, in get
> > response = super(Client, self).get(path, data=data, **extra)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> > line 241, in get
> > return self.request(**r)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> > line 381, in request
> > response = self.handler(environ)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> > line 84, in __call__
> > response = self.get_response(request)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/handlers/base.py",
> > line 169, in get_response
> > response = self.handle_uncaught_exception(request, resolver,
> > sys.exc_info())
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/handlers/base.py",
> > line 218, in handle_uncaught_exception
> > return callback(request, **param_dict)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py",
> > line 93, in _wrapped_view
> > response = view_func(request, *args, **kwargs)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/views/defaults.py",
> > line 31, in server_error
> > return http.HttpResponseServerError(t.render(Context({})))
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> > line 123, in render
> > return self._render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/utils.py",
> > line 60, in instrumented_test_render
> > return self.nodelist.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> > line 744, in render
> > bits.append(self.render_node(node, context))
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> > line 73, in render_node
> > result = node.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/loader_tags.py",
> > line 127, in render
> > return compiled_parent._render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/utils.py",
> > line 60, in instrumented_test_render
> > return self.nodelist.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> > line 744, in render
> > bits.append(self.render_node(node, context))
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> > line 73, in render_node
> > result = node.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/loader_tags.py",
> > line 64, in render
> > result = block.nodelist.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> > line 744, in render
> > bits.append(self.render_node(node, context))
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> > line 73, in render_node
> > result = node.render(context)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/defaulttags.py",
> > line 437, in render
> > url = reverse(view_name, args=args, kwargs=kwargs,
> > current_app=context.current_app)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> > line 391, in reverse
> > *args, **kwargs)))
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> > line 312, in reverse
> > possibilities = self.reverse_dict.getlist(lookup_view)
> >   File
> >
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py"

Re: sqlite3 database error

2012-02-13 Thread Stanwin Siow
Try this:

>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',  # Add
>> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': 'test.db',  # Or path to database
>> file if using sqlite3.
>> 'USER': '',  # Not used with sqlite3.
>> 'PASSWORD': '',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for
>> default. Not used with sqlite3.
>> }

> 




Best Regards,

Stanwin Siow



On Feb 13, 2012, at 9:03 PM, ajohnston wrote:

> Try changing the slashes form \ to /
> 
> On Feb 13, 4:50 am, Marcus Maximus  wrote:
>> Hey guys,
>> 
>> i am using sqlite3 for my django app. BUT I have problems installing
>> it. Here are my configs:
>> 
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',  # Add
>> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
>> win32-x86-3071000\test.db',  # Or path to database
>> file if using sqlite3.
>> 'USER': '',  # Not used with sqlite3.
>> 'PASSWORD': '',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for
>> default. Not used with sqlite3.
>> }
>> 
>> }
>> 
>> I tried this:
>> 
> from django.db import connection
> cursor = connection.cursor()
>> 
>> But I got this error:
>> 
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "C:\Python27\lib\site-packages\django\db\backends\__init__.py",
>> line 250,
>>  in cursor
>> cursor = self.make_debug_cursor(self._cursor())
>>   File "C:\Python27\lib\site-packages\django\db\backends
>> \sqlite3\base.py", line
>> 207, in _cursor
>> self.connection = Database.connect(**kwargs)
>> OperationalError: unable to open database file
>> 
>> Can sb pls help me?
>> 
>> greetings
>> 
>> Maximus
>> 
>> PS.: I created my sqlite3 file like that:
>> 
>>>sqlite3 test.db
>> ...>
>> ...>
>> ...>);
>> ...>Syntax error
>>>
>> 
>> Can sb show me a better way to create an empty sqlite3 db file?
> 
> -- 
> 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: sqlite3 database error

2012-02-13 Thread ajohnston
Sorry. To be clearer, I should have said. In your db file name:

C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-win32-
x86-3071000\test.db

try changing the \ to /

See:
https://docs.djangoproject.com/en/dev/ref/settings/#name

-- 
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: sqlite3 database error

2012-02-13 Thread ajohnston
Try changing the slashes form \ to /

On Feb 13, 4:50 am, Marcus Maximus  wrote:
> Hey guys,
>
> i am using sqlite3 for my django app. BUT I have problems installing
> it. Here are my configs:
>
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3',  # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>         'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
> win32-x86-3071000\test.db',                      # Or path to database
> file if using sqlite3.
>         'USER': '',                      # Not used with sqlite3.
>         'PASSWORD': '',                  # Not used with sqlite3.
>         'HOST': '',                      # Set to empty string for
> localhost. Not used with sqlite3.
>         'PORT': '',                      # Set to empty string for
> default. Not used with sqlite3.
>     }
>
> }
>
> I tried this:
>
> >>> from django.db import connection
> >>> cursor = connection.cursor()
>
> But I got this error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\backends\__init__.py",
> line 250,
>  in cursor
>     cursor = self.make_debug_cursor(self._cursor())
>   File "C:\Python27\lib\site-packages\django\db\backends
> \sqlite3\base.py", line
> 207, in _cursor
>     self.connection = Database.connect(**kwargs)
> OperationalError: unable to open database file
>
> Can sb pls help me?
>
> greetings
>
> Maximus
>
> PS.: I created my sqlite3 file like that:
>
>    >sqlite3 test.db
> ...>
> ...>
> ...>);
> ...>Syntax error
>    >
>
> Can sb show me a better way to create an empty sqlite3 db file?

-- 
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 while testing

2012-02-13 Thread Sandro Dutra
Think it's a name conflict with the model Location, probably it's
registered 2 times in "admin.py" (line 4), or try to change the model
name.

2012/2/13 xina towner :
> I'm getting this error when I try to do my tests, can anybody help me
> please?
>
> Traceback (most recent call last):
>   File "/home/xino/workspace/unnamedapp/accounts/tests.py", line 209, in
> test_request_invitation
>     resp = self.client.get('/accounts/invite/request/')
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> line 439, in get
>     response = super(Client, self).get(path, data=data, **extra)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> line 241, in get
>     return self.request(**r)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> line 381, in request
>     response = self.handler(environ)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/client.py",
> line 84, in __call__
>     response = self.get_response(request)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/handlers/base.py",
> line 169, in get_response
>     response = self.handle_uncaught_exception(request, resolver,
> sys.exc_info())
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/handlers/base.py",
> line 218, in handle_uncaught_exception
>     return callback(request, **param_dict)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py",
> line 93, in _wrapped_view
>     response = view_func(request, *args, **kwargs)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/views/defaults.py",
> line 31, in server_error
>     return http.HttpResponseServerError(t.render(Context({})))
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> line 123, in render
>     return self._render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/utils.py",
> line 60, in instrumented_test_render
>     return self.nodelist.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> line 744, in render
>     bits.append(self.render_node(node, context))
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/loader_tags.py",
> line 127, in render
>     return compiled_parent._render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/test/utils.py",
> line 60, in instrumented_test_render
>     return self.nodelist.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> line 744, in render
>     bits.append(self.render_node(node, context))
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/loader_tags.py",
> line 64, in render
>     result = block.nodelist.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/base.py",
> line 744, in render
>     bits.append(self.render_node(node, context))
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/debug.py",
> line 73, in render_node
>     result = node.render(context)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/template/defaulttags.py",
> line 437, in render
>     url = reverse(view_name, args=args, kwargs=kwargs,
> current_app=context.current_app)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 391, in reverse
>     *args, **kwargs)))
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 312, in reverse
>     possibilities = self.reverse_dict.getlist(lookup_view)
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 229, in _get_reverse_dict
>     self._populate()
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 208, in _populate
>     for name in pattern.reverse_dict:
>   File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-package

Re: sqlite3 database error

2012-02-13 Thread Babatunde Akinyanmi
After specifying the path to where you want your sqlite database to be
i.e db name setting, after your syncdb, the database will be created
automatically if it doesn't already exist in the path you stated.

On 2/13/12, Marcus Maximus  wrote:
> Hey guys,
>
> i am using sqlite3 for my django app. BUT I have problems installing
> it. Here are my configs:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',  # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
> win32-x86-3071000\test.db',  # Or path to database
> file if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
> }
> }
>
> I tried this:
>
 from django.db import connection
 cursor = connection.cursor()
>
> But I got this error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\backends\__init__.py",
> line 250,
>  in cursor
> cursor = self.make_debug_cursor(self._cursor())
>   File "C:\Python27\lib\site-packages\django\db\backends
> \sqlite3\base.py", line
> 207, in _cursor
> self.connection = Database.connect(**kwargs)
> OperationalError: unable to open database file
>
> Can sb pls help me?
>
> greetings
>
> Maximus
>
> PS.: I created my sqlite3 file like that:
>
>>sqlite3 test.db
> ...>
> ...>
> ...>);
> ...>Syntax error
>>
>
> Can sb show me a better way to create an empty sqlite3 db file?
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: Comments Link- How to?

2012-02-13 Thread Babatunde Akinyanmi
Please Rephrase. I don't get the part of "comment link name"

On 2/13/12, coded kid  wrote:
> Hi Guys, How can I link to “Django Comment form”, so that when a user
> clicks on the “Comment Link Name” It will display the Comment Form on
> the same page with the post. I hope you get my point? If you do please
> answer and if you don’t ask me to explain further.
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: complete for dropdown box in admin

2012-02-13 Thread kenneth gonsalves
On Mon, 2012-02-13 at 17:15 +0530, Anoop Thomas Mathew wrote:
> http://harvesthq.github.com/chosen/
> Hope this helps.
> 
> 

looks just like what I wanted. And this helps too:

http://bradmontgomery.net/blog/chosenjs-in-the-django-admin/
-- 
regards
Kenneth Gonsalves

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



sqlite3 database error

2012-02-13 Thread Marcus Maximus
Hey guys,

i am using sqlite3 for my django app. BUT I have problems installing
it. Here are my configs:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',  # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
win32-x86-3071000\test.db',  # Or path to database
file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

I tried this:

>>> from django.db import connection
>>> cursor = connection.cursor()

But I got this error:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\site-packages\django\db\backends\__init__.py",
line 250,
 in cursor
cursor = self.make_debug_cursor(self._cursor())
  File "C:\Python27\lib\site-packages\django\db\backends
\sqlite3\base.py", line
207, in _cursor
self.connection = Database.connect(**kwargs)
OperationalError: unable to open database file

Can sb pls help me?

greetings

Maximus

PS.: I created my sqlite3 file like that:

   >sqlite3 test.db
...>
...>
...>);
...>Syntax error
   >

Can sb show me a better way to create an empty sqlite3 db file?

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



Comments Link- How to?

2012-02-13 Thread coded kid
Hi Guys, How can I link to “Django Comment form”, so that when a user
clicks on the “Comment Link Name” It will display the Comment Form on
the same page with the post. I hope you get my point? If you do please
answer and if you don’t ask me to explain further.

-- 
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 templates: filter hides table contents

2012-02-13 Thread Gelonida N
Hi,

I wanted to know whether anybody modified the django admin templates such,
that the filter div could be hidden.

At the moment the  containing the filters may hide the
contents of the table.


As I can imagine, that I'm not the only one who might  have large tables
and doesn't like, that part of the table data is hidden behind these
filters I wanted to know whether anybody changed the templates / style
sheets / javascript such, that it is possible to
show / hide the filter window (similiar to how it is done for the
django debug tool bar.

Usage of jquery for showing / hiding is no wroblem as I juse jquery
already for other pages.

Thanks in advance for your answers.



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



error

2012-02-13 Thread xina towner
Hi, I get this message when I try to acces to the admin page:

AlreadyRegistered at /admin


The model Location is already registered


does anybody know which is the problem?

-- 
Gràcies,

Rubén

-- 
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: complete for dropdown box in admin

2012-02-13 Thread Anoop Thomas Mathew
Hi,

http://harvesthq.github.com/chosen/
Hope this helps.

Thanks,
Anoop Thomas Mathew

atm
___
Life is short, Live it hard.




On 13 February 2012 12:17, kenneth gonsalves  wrote:

> hi,
>
> I need a widget in admin to autoselect (I do not know what it is called)
> a foreign key - that is if I type 'f' it goes to the first occurrence of
> 'f' and so on. I hope I am clear.
> --
> regards
> Kenneth Gonsalves
>
> --
> 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: Admin inline for inherited model cant find pointer to parent model

2012-02-13 Thread Demetrio Girardi
Looking more into this,

my parent model has a primary key field named 'code'. The inline forms
do show the 'code' field for the child model instances, and the data
is in the formset's querydict:
QueryDict <... u'childmodel_set-0-code': [u'...'] ...>

However the table column name for the one-to-one relationship between
parent and child is called 'parendmodel__ptr__id', and the admin is
looking for 'childmodel_set-0-parentmodel_ptr' in the formset data.
Why?

On Mon, Feb 13, 2012 at 10:43 AM, Demetrio Girardi
 wrote:
> I have a child model that I wish edit inline in the admin site. When
> trying to save edits I get a MultiValueDictKeyError:
>
> "Key 'childmodel_set-0-parentmodel_ptr' not found in "
>
> It seems to me the admin is trying to get the reference to the parent
> model from the form data. How can I fix this? Do I need a custom form?

-- 
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: Comments form customization

2012-02-13 Thread coded kid
Hey Fabio,
How do you get your comment form to display? Been fighting with this
for the past 5hrs. Please any idea? Thanks.

On Feb 13, 11:12 am, Fabio Natali  wrote:
> On 02/13/2012 10:52 AM, Vovk Donets wrote:
>
> > It's not really great solution, but maybe it will give you a hint: you
> > can add/remove fileds to the form on the fly. And for not logged in
> > users show all fields, but for authenticated only subset of the all form
> > fields.
>
> Ehi Vladimir, thank you for your quick reply!
>
> I found a couple of interesting links.
>
> http://mitchfournier.com/2010/08/12/customizing-django-comments-remov...http://stackoverflow.com/questions/1456267/django-comments-want-to-re...
>
> The first deals with writing your own comment templates, so to remove
> unnecessary fields (name, url, email).
>
> The latter deals with writing your own custom comment form, no need to
> hack template stuff. This looks nicer to me, I think I'll try it first.
>
> Vladimir, is that the approach you meant?
>
> I am still not sure this is the best solution for me. So, those of you
> who are listening, if you have any further advice/hint, don't hesitate
> to email me! :-)
>
> Cheers, Fabio.
>
> --
> Fabio Natali

-- 
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: Comments form customization

2012-02-13 Thread Fabio Natali

On 02/13/2012 10:52 AM, Vovk Donets wrote:

It's not really great solution, but maybe it will give you a hint: you
can add/remove fileds to the form on the fly. And for not logged in
users show all fields, but for authenticated only subset of the all form
fields.


Ehi Vladimir, thank you for your quick reply!

I found a couple of interesting links.

http://mitchfournier.com/2010/08/12/customizing-django-comments-remove-unwanted-fields/
http://stackoverflow.com/questions/1456267/django-comments-want-to-remove-user-url-not-expand-the-model-how-to/4766543#4766543

The first deals with writing your own comment templates, so to remove 
unnecessary fields (name, url, email).


The latter deals with writing your own custom comment form, no need to 
hack template stuff. This looks nicer to me, I think I'll try it first.


Vladimir, is that the approach you meant?

I am still not sure this is the best solution for me. So, those of you 
who are listening, if you have any further advice/hint, don't hesitate 
to email me! :-)


Cheers, Fabio.

--
Fabio Natali

--
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: Comments form customization

2012-02-13 Thread Vovk Donets
It's not really great solution, but maybe it will give you a hint: you can
add/remove fileds to the form on the fly. And for not logged in users show
all fields, but for authenticated only subset of the all form fields.

2012/2/13 Fabio Natali 

> Hi everybody,
>
> I am using comments app from contrib in Django 1.3.
>
> In my website I let only authenticated users to leave a comment so I'd
> like to get rid of those "name", "email" and "url" fields that come with
> the standard comment form. Indeed, I already know the name and email of
> current logged user, there's no need for the user to submit his/her name
> and email again.
>
> So, I'd just like a FK field to the user that left the comment. More of
> that, I would like that field to be automatically populated while the user
> submit the comment.
>
> Could you give me some hints for such customization?
>
> Thank you very much,
> Fabio.
>
> --
> Fabio Natali
>
>
-- 
*Vovk Donets*
 python developer

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



Admin inline for inherited model cant find pointer to parent model

2012-02-13 Thread Demetrio Girardi
I have a child model that I wish edit inline in the admin site. When
trying to save edits I get a MultiValueDictKeyError:

"Key 'childmodel_set-0-parentmodel_ptr' not found in "

It seems to me the admin is trying to get the reference to the parent
model from the form data. How can I fix this? Do I need a custom form?

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



Comments form customization

2012-02-13 Thread Fabio Natali

Hi everybody,

I am using comments app from contrib in Django 1.3.

In my website I let only authenticated users to leave a comment so I'd 
like to get rid of those "name", "email" and "url" fields that come with 
the standard comment form. Indeed, I already know the name and email of 
current logged user, there's no need for the user to submit his/her name 
and email again.


So, I'd just like a FK field to the user that left the comment. More of 
that, I would like that field to be automatically populated while the 
user submit the comment.


Could you give me some hints for such customization?

Thank you very much,
Fabio.

--
Fabio Natali

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



Comment post not allowed (400)

2012-02-13 Thread coded kid
Hey guys, when I include the django comments form in the template I
want to use it, After visting the page, I can only see "POST" and
"PREVIEW" button and the form itself is not showing. So I clicked on
the 'POST" button to see what's next.

After clicking it, I get this:

Comment post not allowed (400)
Why:Missing content_type or object_pk field.

The comment you tried to post to this view wasn't saved because
something tampered with the security information in the comment form.
The message above should explain the problem, or you can check the
comment documentation for more help.

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 400 error page.

Django Documents aint helping in this case. Please What I'm I missing?
below is the codes in my form.html

{% load comments i18n %}
{% csrf_token
%}
  {% if next %}{% endif %}
  {% for field in form %}
{% if field.is_hidden %}
  {{ field }}
{% else %}
  {% if field.errors %}{{ field.errors }}{% endif %}
  
{{ field.label_tag }} {{ field }}
  
{% endif %}
  {% endfor %}
  

{#  #}
  


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