Re: models.Model

2011-10-17 Thread Daniel Roseman
On Sunday, 16 October 2011 23:43:56 UTC+1, youpsla wrote: > > Hello, > I'm new to Django and I've only a medium background in funtionnal > programming in Python. > > I'm currently reading and working on the Django tutorial. I've few > questions on a example of code because things are not so

Newbee question about PostgreSQL

2011-10-17 Thread Nico
Hi, I am new to Django AND PostgreSQL. I want to setup a PostgreSQL backend. I have created a database createdb myproject Then, as superuser in psql: CREATE USER george WITH PASSWORD 'password'; GRANT ALL PRIVILEGES ON DATABASE money TO george; Then I added this info in settings.py

Tutorial help: Make the poll app modifiable in the admin

2011-10-17 Thread Daniel
Hello i am progressing well on the tutorial here: https://docs.djangoproject.com/en/1.3/intro/tutorial02/ however, I am stuck on Make the poll app modifiable in the admin. I have created an admin.py file within my polls directory. with the suggested code. However I keep getting this error

Re: models.Model

2011-10-17 Thread Webb Newbie
"models" is a module that contains classes Model and CharField. Person inherits from Model. first_name and last_name are instances of CharField. There's no functional programming here. -WN. On Sun, Oct 16, 2011 at 6:43 PM, youpsla wrote: > 1 from django.db import models >

Re: Newbee question about PostgreSQL

2011-10-17 Thread kenneth gonsalves
On Mon, 2011-10-17 at 03:00 -0700, Nico wrote: > So I tried the command line: >psql myproject george -W > This prompted my for the password of george and then returned an > error: >psql: FATAL: Ident authentication failed for user "george" find pg_hba.conf and change 'ident' to

Re: Newbee question about PostgreSQL

2011-10-17 Thread Simon Riggs
On Mon, Oct 17, 2011 at 11:00 AM, Nico wrote: > Hi, I am new to Django AND PostgreSQL. I want to setup a PostgreSQL > backend. > > I have created a database >    createdb myproject > Then, as superuser in psql: >    CREATE USER george WITH PASSWORD 'password'; >    GRANT

Re: Newbee question about PostgreSQL

2011-10-17 Thread Simon Riggs
On Mon, Oct 17, 2011 at 11:58 AM, kenneth gonsalves wrote: > On Mon, 2011-10-17 at 03:00 -0700, Nico wrote: >> So I tried the command line: >>    psql myproject george -W >> This prompted my for the password of george and then returned an >> error: >>    psql: FATAL:  

Re: models.Model

2011-10-17 Thread youpsla
Thanks you 2 for your answers. I think I've understood now. Again I apologize for the newby Python question but I've read three times "Dive in Python" and it hasn't made me thnigs clear. That's the reason why I've posted. I thought there was a hierarchy like this models.Model.CharField

Re: models.Model

2011-10-17 Thread youpsla
hello again, sorry for eventually annoying. But later in the Django tutorial, there is this code: from django.conf.urls import patterns, include, url . urlpatterns = patterns('', (r'^polls/$', 'polls.views.index'), ..)), ) What I

Re: models.Model

2011-10-17 Thread Daniel Roseman
On Monday, 17 October 2011 12:04:41 UTC+1, youpsla wrote: > > Thanks you 2 for your answers. > > I think I've understood now. Again I apologize for the newby Python > question but I've read three times "Dive in Python" and it hasn't made > me thnigs clear. That's the reason why I've posted. >

Re: models.Model

2011-10-17 Thread Daniel Roseman
On Monday, 17 October 2011 12:18:00 UTC+1, youpsla wrote: > > hello again, sorry for eventually annoying. But later in the Django > tutorial, > > there is this code: > > from django.conf.urls import patterns, include, url > . > urlpatterns = patterns('',

Re: Newbee question about PostgreSQL

2011-10-17 Thread kenneth gonsalves
On Mon, 2011-10-17 at 12:04 +0100, Simon Riggs wrote: > > find pg_hba.conf and change 'ident' to 'password' on the lines at > the > > end of the file > > Changing the rules in that way would break all existing connections. I do not understand > > You should always use md5 rather than password,

Re: Tutorial help: Make the poll app modifiable in the admin

2011-10-17 Thread Ramiro Morales
On Mon, Oct 17, 2011 at 7:05 AM, Daniel wrote: > Hello i am progressing well on the tutorial here: > https://docs.djangoproject.com/en/1.3/intro/tutorial02/ > however, I am stuck on Make the poll app modifiable in the admin. > > I have created an admin.py file within my polls

Re: Newbee question about PostgreSQL

2011-10-17 Thread Nico
Thanks for the feedback! I have edited /etc/postgresql/8.4/main/pg_hba.conf and added the following line at the bottom: local myproject george trust (by the way; I am using a Kubuntu workstation) It should give me local access using a trusted connection for the

Re: Newbee question about PostgreSQL

2011-10-17 Thread Philip Mountifield
Have you sent a HUP signal to the postmaster or restarted the service since making those changes? Regards, Phil On 17/10/2011 13:45, Nico wrote: Thanks for the feedback! I have edited /etc/postgresql/8.4/main/pg_hba.conf and added the following line at the bottom: local myproject george

Re: Django models design question

2011-10-17 Thread Stuart
Hello Omer -- I believe you have two options. You could use the AttributeValue approach I described earlier. You could add features to take care of 'data types' and the like. The work may be quite tedious, but it has the advantage of not being clever. In other words, you would do the work to

Re: Newbee question about PostgreSQL

2011-10-17 Thread Nico
Yes, I have restarted the service. Of course :) Nico On Oct 17, 2:47 pm, Philip Mountifield wrote: > Have you sent a HUP signal to the postmaster or restarted the service > since making those changes? > > Regards, Phil -- You received this message because you are

Re: Tutorial help: Make the poll app modifiable in the admin

2011-10-17 Thread Daniel
thanks for your reply. 1. yes i am following the tutorial explicitly. 2. yes, i haven't removed it. 3. yes using 1.3 I did manage to find a workaround though. I simply executed the commands via the python shell (run-> shell). the error i was getting was when i went to run->run module. Can you

Re: Newbee question about PostgreSQL

2011-10-17 Thread Philip Mountifield
The order of configuration in the file is also important; on a connection attempt the records are examined sequentially. Perhaps you problem lies here if you just added the new details to the bottom of the config file. Regards, Phil On 17/10/2011 14:01, Nico wrote: Yes, I have restarted the

Re: Django models design question

2011-10-17 Thread omerd
Thank you very much! I choose the first option for now. If I have any problems, I will write them here On Oct 17, 2:51 pm, Stuart wrote: > Hello Omer -- > > I believe you have two options. You could use the AttributeValue > approach I described earlier. You could add

Re: Automaticall list all fields of generic model in template

2011-10-17 Thread Andre Terra
Even better, use django-form-utils! https://bitbucket.org/carljm/django-form-utils/overview Cheers, AT On Sun, Oct 16, 2011 at 7:57 PM, Mario Gudelj wrote: > I think you need this > https://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > > On 16 October 2011

Re: models.Model

2011-10-17 Thread youpsla
Hello Daniel thanks for your answer and sorry for my english. As you said, it could be a problem of translation !!! :-) I really appreciate your help, I'm doing lots of progress in my python object programming curve ... OK, then to be sure how Python works ... let see this code: 1 from

Re: Newbee question about PostgreSQL

2011-10-17 Thread Nico
Hi Phil, Thank you! I moved the line a few positions up and it now works. All people who responded to my question, thanks very much! Kind regards, Nico On Oct 17, 3:08 pm, Philip Mountifield wrote: > The order of configuration in the file is also important; on a >

Re: Automaticall list all fields of generic model in template

2011-10-17 Thread Tom Evans
Did either of you read the OPs email? He is not looking for forms... OP: There is nothing built in, but you can easily iterate through a model's fields, they are all available in the _meta attribute on a model instance: >>> u = User.objects.get(id=1) >>> for field in u._meta.fields: ... print

Class Based FormView - Initial Logic

2011-10-17 Thread Kurtis
Hey, I have a FormView and a Form. I want to put in some logic that will take place before the Form is even displayed. I know I could throw this in a decorator and wrap the View but there's only a couple of views that need this specific functionality and didn't see a need for a whole new

Re: Class Based FormView - Initial Logic

2011-10-17 Thread Andre Terra
Maybe some place inside get(), dispatch() or get_form_kwargs()? Cheers, AT On Mon, Oct 17, 2011 at 3:57 PM, Kurtis wrote: > Hey, > > I have a FormView and a Form. I want to put in some logic that will > take place before the Form is even displayed. I know I could

Looking for a good Document Management System (DMS) to plug into my Django app

2011-10-17 Thread CareerDhaba tech
Hi folks, I have been looking around all over to find a high quality DMS to plug into my Django application. I'd like to be able to upload and download .docx or .pdf files, edit the metadata, and also be able to serve the content of the files on the front end. If the plugin allows for preview,

Re: Suse Linux installation

2011-10-17 Thread Andrew Johnson
Thanks for the response! Where can I get more guidance about how to use the website you reference? I go there and see nothing about django and am unsure how to proceed. On Oct 14, 1:07 pm, aledr wrote: > You can get it directly from the Python repo[1]. > Otherwise

cannot concatenate 'str' and 'FilterExpression' objects

2011-10-17 Thread nav
Dear Folks, I am using a number of subdomains for my website and decided to create a custom url tag and try as shown on http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-rewrite-urls-messing-up-on-deployment-setups My template tag being used in my template like this: About Us

Re: Suse Linux installation

2011-10-17 Thread aledr
It is the openSUSE software repos site. You can check how to usage it here[1]. Choose the correct folder from the openSUSE version you are using. [1]: http://en.opensuse.org/SDB:Zypper_usage On Mon, Oct 17, 2011 at 4:37 PM, Andrew Johnson wrote: > Thanks for the

Re: Iteration over queryset in a model

2011-10-17 Thread eyscooby
Ok, sorry I thought I was starting to understand it a little better, but now I think I took a step backwards, so if it is ok with you let's step back and take it a step at a time. So, my first step is wondering if I really need a manager or not?? I was thinking from your first response to me that

Question on cleaning ModelForms

2011-10-17 Thread Jeff Heard
class FarmersMarket(ModelForm): class Meta: model = models.FarmersMarket exclude = ('location',) def clean(self): place, (lat, lng) = _g.geocode(self.cleaned_data['address']) self.cleaned_data['location'] = Point(lng,lat) return self.cleaned_data Here's

django 1.3: how to use pagination with class based views?

2011-10-17 Thread Andriyko
Hello, I have following view in views.py: . class ArticleArchiveIndexView(ArticleViewAbstractClass, ArchiveIndexView): queryset = Article.live.all() date_field = 'pub_date' context_object_name = 'articles_list' paginate_by = ARTICLES_PER_PAGE .. How do I use

Re: Suse Linux installation

2011-10-17 Thread Andrew Johnson
Thanks again for your reply. On the django installation guide is says: A Django package is available for openSUSE Linux in the openSUSE Build Service. The current package can be installed by subscribing to the devel:languages:python project and typing 'zypper install python- django'.

Re: Suse Linux installation

2011-10-17 Thread aledr
In case of openSUSE 11.3, as root type: zypper ar http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_11.3/devel:languages:python.repo In case of openSUSE 11.4, as root type: zypper ar

Re: django 1.3: how to use pagination with class based views?

2011-10-17 Thread Andriyko
Ok. page_obj is what I need. On Oct 17, 10:34 pm, Andriyko wrote: > Hello, > > I have following view in views.py: > . > class  ArticleArchiveIndexView(ArticleViewAbstractClass, > ArchiveIndexView): >     queryset = Article.live.all() >     date_field = 'pub_date' >    

Re: Question on cleaning ModelForms

2011-10-17 Thread Brian Bouterse
I've done it before using a post save signal, although I had lat,lng = NULL in the schema so that differs from your request here. After saving, I would issue an update. I forget why I didn't use a pre-save signal. Aside from signals, you may also be able to use a model field default with a

Re: Tutorial confusion: flat project layout with django 1.3.1

2011-10-17 Thread garyrob
Ah! Thanks everyone for the feedback. The reason I was confused may be stupid, but FWIW here it is: Underneath the Search input area, there's a popup menu that says "Django 1.3". My eye went over there and registered the 1.3 without figuring out that it refers to what is being searched in. I

Re: Tutorial confusion: flat project layout with django 1.3.1

2011-10-17 Thread garyrob
Actually, it seems like the search popup should focus on whatever documentation you're looking at. So, instead of saying "Django 1.3" I would argue that it should have said "Django Dev". That would mean that it was defaulting to the use it would probably be put to, and simultaneously tell the

Geodjango Tutorial: SRID problem when loading data from shapefile to PostGIS table

2011-10-17 Thread Pauline Emery
Dear all, I'm having a problem doing the section "LayerMapping" of the GeoDjango official Tutorial [1]. After creating load.py in the world directory. Leaving as specified: "the transform keyword set to False because the data in the shapefile does not need to be converted -- it's already in

Blank output from treemenus under nginx

2011-10-17 Thread Alastair Campbell
Hi everyone, I got a surprise when using treemenus, where it worked really well on my local dev (django-server) , but disappeared on live (nginx using mod_wsgi on debian). I installed the treemenu app, imported the data (menu items) from a datadump of my local app, and uploaded the templates

Re: Class Based FormView - Initial Logic

2011-10-17 Thread Russell Keith-Magee
On Tue, Oct 18, 2011 at 1:57 AM, Kurtis wrote: > Hey, > > I have a FormView and a Form. I want to put in some logic that will > take place before the Form is even displayed. I know I could throw > this in a decorator and wrap the View but there's only a couple of > views

name conflicts in static files

2011-10-17 Thread dmitry b
Hi, With the new way of handling static files in Django 1.3 what would happen if two applications have identically named static files? E.g.: |___ app1 | | static | |_ styles.css |___ app2 | static |_ styles.css

Re: name conflicts in static files

2011-10-17 Thread SmileyChris
The first app in INSTALLED_APPS wins, just like how name conflicts with templates work. You can use the following command to check what static file gets picked: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#findstatic -- You received this message because you are subscribed to

Re: Ajax replacement in django

2011-10-17 Thread Kevin
Just a simple thought, if you'd prefer to avoid JavaScript/client-side scripting entirely, and only code using Python. It might be an idea to look at Pyjamas to generate your page. It technically uses Ajax, but from the programmers point of view, it feels more like coding a desktop application.

Re: name conflicts in static files

2011-10-17 Thread creecode
Just a general tip for folks. Always namespace your template and static files to avoid problems. Toodle-loo.. creecode -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit