Re: help with foreignkeys

2012-05-13 Thread Nikolas Stevenson-Molnar
When you have a FK to park in your comment model, you automatically get a reference to a list of comments from the park model. E.g: class Park(models.Model): #Park fields here, but no explicit relationship to Comment class Comment(models.Model): park = models.ForeignKey(Park)

Re: Use Django to implement my GUI!

2012-05-13 Thread Eugène Ngontang
Thanks Guys for all. I will carefully look at all your suggestions and see what is better in a production environment. But the idea of having the possibility to abstract the frontend so that it can be changed is the best i think and was what i intended to do after my server become working and

Re: help with foreignkeys

2012-05-13 Thread psychok7
i think you are right :) , i can always get the parks associated comments if i query comments model (im used to only doing it the other way around). gonna try that out thanks On Monday, May 14, 2012 2:57:17 AM UTC+1, jondykeman wrote: > > If all comment have to have a park and user. > > I

Re: help with foreignkeys

2012-05-13 Thread jondykeman
If all comment have to have a park and user. I would have a ForeignKey to Park and User in the Comments model, and no Foreign key in the Parks model. As such a comment will always need to be linked to an existing park and user object, but a park can be created without needing a comment. JD

Re: help with foreignkeys

2012-05-13 Thread psychok7
yes, like a park doesn't have to have comments, but all the comments must have an associated park and user all the time. what is the django syntax for me to achieve this? On Monday, May 14, 2012 2:49:18 AM UTC+1, jondykeman wrote: > > As far as I understand it the ForeignKey will have to be

Re: help with foreignkeys

2012-05-13 Thread jondykeman
As far as I understand it the ForeignKey will have to be unique=True and null=False. I want to get a better sense of what you are trying to achieve. Is it that you want to link comment and park only some of the time? JD On Sunday, May 13, 2012 7:41:39 PM UTC-6, psychok7 wrote: > > so i have

help with foreignkeys

2012-05-13 Thread psychok7
so i have this 2 models (Comment and Park) Comment has a foreign key to USER and PARK PARK has a foreign key to Comment my question is, isn't there going to be a deadlock if i don't have a comment or a park created? i mean , in order to create a Park i need to have a comment, and in order to

form resubmit on refresh problem

2012-05-13 Thread jondykeman
Hello, I have a form submission problem I can't seem to figure out a way around. Normally, once a form was submitted I would HttpResponseRedirect() to the main page. However, there is something I can't seem to make work with this approach. The form is being completed/submitted in the

Re: UpdateView Creates a new object

2012-05-13 Thread Xavier Ordoquy
Hi, You should just use action="" since it will post to the url the page was generated by. This will allow you to use a single template for both create and view view while they keep their respective urls. As a side note, you should use the url template tag rather than hardcode urls ;) Regards,

Re: can the Django test server serve cgi scripts?

2012-05-13 Thread Russell Keith-Magee
On Mon, May 14, 2012 at 2:15 AM, Gelonida N wrote: > I know, that performance would be entire crap. > However sometimes this could be useful for a minimalist setup. > > So let me explain: > > For testing I'd like start no web server at all, just the django test > server.

Re: Creating an user/password management app

2012-05-13 Thread Russell Keith-Magee
On Sun, May 13, 2012 at 6:58 PM, Peter Steinmetz wrote: > Hi, > > given an existing SQL DB which stores user credentials. This DB is > used as an authentication backend by a mail server. > Now I'd like to create a web frontend to manage the credentials in > this

Re: How do you install Django on a shared hosting without root access?

2012-05-13 Thread Babatunde Akinyanmi
Lol. Nice way to go. On 5/13/12, Gerald Klein wrote: > What host? > > > thanks > > --jerry > > On Sun, May 13, 2012 at 2:49 PM, Dan Santos wrote: > >> I forced my local web host (twisted their arm) and the day after they >> created a new procedure for

Re: How do you install Django on a shared hosting without root access?

2012-05-13 Thread Gerald Klein
What host? thanks --jerry On Sun, May 13, 2012 at 2:49 PM, Dan Santos wrote: > I forced my local web host (twisted their arm) and the day after they > created a new procedure for setting up Django without having to use root > access. > > Problem solved :) > > > > On

Re: files are downloadable in browser because of apache conf file! help!!!

2012-05-13 Thread doniyor
yeah, you are right, i realized this after having read the official docs with close focus for the 3rd time.. :) thanks thanks.. Am Sonntag, 13. Mai 2012 19:41:50 UTC+2 schrieb Jani Tiainen: > > You should deploy django files outside www directories. That way even > incorrect config

Re: Use Django to implement my GUI!

2012-05-13 Thread John Yeukhon Wong
Maybe pyjs? Do the GUI part using Python (which renders into javascript), and you can connect it using Django as your backend. On Sunday, May 13, 2012 6:14:36 AM UTC-4, Eugene NGONTANG wrote: > > Hi! > > I'm a python developper, but new in django. > > I'm devolopping a multi clients-server

Re: How do you install Django on a shared hosting without root access?

2012-05-13 Thread Dan Santos
I forced my local web host (twisted their arm) and the day after they created a new procedure for setting up Django without having to use root access. Problem solved :) On Saturday, May 12, 2012 8:39:27 PM UTC+2, Dan Santos wrote: > > Hi I'm confused about how to setup Django on my shared

Re: UpdateView Creates a new object

2012-05-13 Thread Michael Ackerman
Yes they are using the same template. Its a very basic template: {% extends "base.html" %} {% block main %} {% csrf_token %} {{ form }} {% endblock %} I figured since update and create were practically the same, I wanted to see if I could be a bit more DRY. Hence why I'm also looking for a way

Re: consistent (un)capitalization in form labels

2012-05-13 Thread Ejah
And, you can specify for each field in a form your own label tekst, which will overwrite the default. See form fields, label. Hth On 13 mei, 20:42, Ejah wrote: > I would solve this with css. > label { >     text-transform: lowercase;} > > Done. > Hth. > > On 13 mei, 12:02,

Re: consistent (un)capitalization in form labels

2012-05-13 Thread Ejah
I would solve this with css. label { text-transform: lowercase; } Done. Hth. On 13 mei, 12:02, "?manu*" wrote: > Hi all, > > my graphic design prescribes that every label in html FORMS should be > not capitalized and without any suffix. For example, a "my_date"

Re: How do you install Django on a shared hosting without root access?

2012-05-13 Thread Babatunde Akinyanmi
Alwaysdata.com will also save you headaches, has excellent support plus they have a free plan. On 5/12/12, Michael Ray wrote: > I second Webfaction! It will save you a lot of headaches. > > -- > Michael Ray > Sent with Sparrow (http://www.sparrowmailapp.com/?sig) > >

can the Django test server serve cgi scripts?

2012-05-13 Thread Gelonida N
I know, that performance would be entire crap. However sometimes this could be useful for a minimalist setup. So let me explain: For testing I'd like start no web server at all, just the django test server. (./manage.py ./runserver ) It will handle all static files and all django views. Now

Re: How to add Profile field to User change list ?

2012-05-13 Thread Karen Tracey
On Tue, May 8, 2012 at 4:12 AM, yillkid wrote: > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.admin', > > 'project.auth', > ) > You've got two apps

Re: files are downloadable in browser because of apache conf file! help!!!

2012-05-13 Thread Jani Tiainen
You should deploy django files outside www directories. That way even incorrect config shouldn't reveal any actual files. On Sat, May 12, 2012 at 8:20 AM, doniyor wrote: > hey guys, i was configuring my django project on server, in httpd.conf > file. suddenly i have

Re: Use Django to implement my GUI!

2012-05-13 Thread Alec Taylor
You could always create a responsive interface—e.g.: using twitter-bootstrap—and then distribute it onto every platform. Web (obviously): Django templates or "standard" web frontend—using e.g.: REST, XMLRPC or JSONRPC—that calls functions and serialises data in a less data heavy way (on clients'

Re: Django & uWSGI best practices

2012-05-13 Thread chuwy
Yeah. But default Ubuntu's uwsgi init-script seems so pretty, featureful and complete, but without a word about emperor-mode, so I think this is not mainstream way of running applications. Anyway, many thanks. P.S. If you can give more "random" advices or links about deploying multiapp

Re: Use Django to implement my GUI!

2012-05-13 Thread Jani Tiainen
Hi, There is several ways to achieve what you maybe want to do. One of the simplest way is separate frontend (your userinterface) and server backend. You can build your Django application as a service (xml-rpc, json-rpc, restful). That would give you advantage to choose whatever frontend you

Re: Get request.user outside of [admin|models|views].py

2012-05-13 Thread Alireza Savand
Also i found https://github.com/seveas/django-echelon very usefull Specially *CurrentUserFiled* For the information, use shoulda be always authenticated so it's not a case here! Thank you On Sun, May 13, 2012 at 6:27 PM, Rafał Stożek wrote: > It is possible using simple

Re: Get request.user outside of [admin|models|views].py

2012-05-13 Thread Rafał Stożek
It is possible using simple middleware and http://docs.python.org/library/threading.html#threading.local class. But note that code doesn't have to always be called from HTTP - it means that you must handle situation where user is not known. Examples: http://djangosnippets.org/snippets/2179/

Re: pre_save vs post_save

2012-05-13 Thread Alireza Savand
Aha i solved it sender.objects.get(id=kwargs['instance'].id) be sender.objects.get(*pk*=kwargs['instance'].*pk*) Thank you again Karl ;) On Sunday, May 13, 2012 5:39:34 PM UTC+4, Alireza Savand wrote: > > Okay, i found a problem in it. > One of my models doesn't use *id* as a default *pk*. >

Re: pre_save vs post_save

2012-05-13 Thread Alireza Savand
I tried already, another error will be issued ;), and it's totally weird pasted at http://dpaste.de/PEOmN/ *Exception Value: Cannot resolve keyword 'id' into field * On Sun, May 13, 2012 at 6:13 PM, Karl Sutt wrote: > I think you can just change the "id" in > > instance =

Re: pre_save vs post_save

2012-05-13 Thread Karl Sutt
I think you can just change the "id" in instance = sender.objects.get(id=kwargs['instance'].id) to "iso" and that should to the trick. Try it, as I haven't verified it. And let us know. Good luck, Karl Sutt On Sun, May 13, 2012 at 2:39 PM, Alireza Savand wrote: >

Re: pre_save vs post_save

2012-05-13 Thread Alireza Savand
Okay, i found a problem in it. One of my models doesn't use *id* as a default *pk*. is use different primary key, called *iso.* So here the traceback http://dpaste.de/o7kSw/ It's not working with those model with different primary key :| On Saturday, May 12, 2012 3:13:28 PM UTC+4, Karl Sutt

Re: Use Django to implement my GUI!

2012-05-13 Thread Alireza Savand
No, i posted django-tastypie not tastypie itself and it's easy to use. Anyway if i'm implementing GUI based i would make it website, since it's an advantages of SaaS. But using client app[desktop-app] and a server-app[django] and having multiply client and ... makes maintaining like a nightmare.

Re: UpdateView Creates a new object

2012-05-13 Thread Xavier Ordoquy
Hi, What does you form html tag looks like ? Sounds like you're sending the updateview form to the createview. Regards, Xavier Ordoquy, Linovia. Le 13 mai 2012 à 11:59, Michael Ackerman a écrit : > My updateview seems to be creating another object instead of updating the > object. The good

Re: Use Django to implement my GUI!

2012-05-13 Thread Eugène Ngontang
Yes, I can see tastypie is a good service, that even support REST protocol. But I'd firt basically implement my gui with django and when i will master well django, i could use tastypie, and turn my server to support REST, it will be a good thing. But please let's keep using only django for the

Creating an user/password management app

2012-05-13 Thread Peter Steinmetz
Hi, given an existing SQL DB which stores user credentials. This DB is used as an authentication backend by a mail server. Now I'd like to create a web frontend to manage the credentials in this existing DB. I. e. users should be able to login using the credentials in this DB and should be able

Template Tags adding unwanted line feed

2012-05-13 Thread Phang Mulianto
Hi all, i have a template tags for menu... it's display as i wanted in the template. Then i refactor it, change the calling method of the template tags, then the menu shifted down, like given an enter / line feed. and to fix it i use css with adding top:-20px to shifted it up as would normally

Re: Use Django to implement my GUI!

2012-05-13 Thread Alireza Savand
https://github.com/toastdriven/django-tastypie On Sunday, May 13, 2012 2:14:36 PM UTC+4, Eugene NGONTANG wrote: > > Hi! > > I'm a python developper, but new in django. > > I'm devolopping a multi clients-server application. > > The server and the clients are communicating via sockets, The

Use Django to implement my GUI!

2012-05-13 Thread Eugene NGONTANG
Hi! I'm a python developper, but new in django. I'm devolopping a multi clients-server application. The server and the clients are communicating via sockets, The server receive somme states from clients, and display them in the User interface. In the other hand, the server has to send a

Re: is django for me?

2012-05-13 Thread Sebastian E. Ovide
Did you try web2py (http://www.web2py.com/) ? if you have a spare hour, just invest it in play with it On Sat, May 12, 2012 at 3:08 AM, giraffasaurus wrote: > Hi everyone, > > i recently got my first web design job and i am wondering if django is > the software

consistent (un)capitalization in form labels

2012-05-13 Thread ?manu*
Hi all, my graphic design prescribes that every label in html FORMS should be not capitalized and without any suffix. For example, a "my_date" field should be rendered as: my date To achieve this I need to set a "label" attribute in every Form. For ModelForm (Forms automatically created from

Get request.user outside of [admin|models|views].py

2012-05-13 Thread Alireza Savand
Hi Let me explain it. i developing and app to trace the models activity, hmmm. actualy it's reversioning app for other models. As a reversioning model shoulda store user_id. What i'm trying to do is to connect those models post_save signal to create a reversion on each changes. But i don't

Re: examples of integrating Sencha 2.0 Javascript front end.

2012-05-13 Thread Jani Tiainen
Hi, We're using ExtJS 4.1 (not Sencha Touch 2.0) but we decided not to "integrate" ExtJS anyway in the Django itself. We have built some helpers to produce output responses ExtJS expects but nothing major. Front end is usually designed with Sencha Architect 2 so it's plain JS. Also in newer

Re: Django psycopg error

2012-05-13 Thread akaariai
It seems the browsershots really uses psycopg, and you will need that to use the software. The latest releases of the psycopg 1 series are from late 2010 so you have a good chance to get it working. - Anssi On May 13, 1:52 am, Mike Di Domenico wrote: > It really