Replicate admin format in django template

2012-01-12 Thread Nikhil Verma
Hi I have a column which is a TextField. When we look at django admin it appears as a box. models.py add_detail = models.TextField() Let say you write the following text in that add_detail textbox in django admin :- Mission Impossible 4 Actor : Tom cruise I am displaying this add_detail in

Removing Save functionality from Admin

2012-01-12 Thread Swaroop Shankar V
Hi, I have a model called Photos, I would like to remove the save button and functionality from the admin area for photos model. Is it possible? Thanks and Regards, Swaroop Shankar V -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Replicate admin format in django template

2012-01-12 Thread Thorsten Sanders
You need to convert the new lines to html code there are 2 templatetags for doing so: https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#linebreaks On 12.01.2012 09:54, Nikhil Verma wrote: Hi I have a column which is a TextField. When we look at django admin it appears as a box.

Staging (dev,test,prod) in django

2012-01-12 Thread Thomas Guettler
Hi, in my environment there are three stages: dev, test, prod. Every stage has its own linux user, and all three stages can live on different hosts. The application is installed in $HOME of a user with this name schema: proj_customer_S (S is d=dev q=qualtitytest p=prod) There are some c

how to change column name in many2many relations?

2012-01-12 Thread ?manu*
Is it possible to change the column name in many2many relations? I can change in in foreignKeys with the db_column attribute. I can change the table name in many2many relations with db_table. What about column names in many2many relations? Thanks, E. -- You received this message because you are

"Current" timezone in admin

2012-01-12 Thread Danny W. Adair
Hi, With 1.4 timezone support I was wondering if/how django admin supports the current user's timezone. There's no corresponding HTTP header like "Accept-Language" so I guess the timezone must be set in the session (looked up from a profile or whatever). Is there a hook that allows the "current" t

Re: Help me with django Form

2012-01-12 Thread Daniel Roseman
On Thursday, 12 January 2012 01:49:40 UTC, coded kid wrote: > > Hi guys, I’ve been trying to signup using the django form I created. > Whenever I signup, the form is always saving the id no and not other > fields like names, username.pasword,email etc. Below are the codes; > In views.py: > from

Re: how to change column name in many2many relations?

2012-01-12 Thread ?manu*
I have solved by defining the model of the relation with a "through" attribute. A little lenghty but effective... E. On Jan 12, 11:01 am, "?manu*" wrote: > Is it possible to change the column name in many2many relations? > > I can change in in foreignKeys with the db_column attribute. I can > ch

Re: how to change column name in many2many relations?

2012-01-12 Thread Weldan
https://docs.djangoproject.com/en/1.3/topics/db/models/#verbose-field-names set a readable name for column, or you want to refer other database table column ? sorry, but i have the urge to ask. why we should do that? thanks On 12 January 2012 18:36, ?manu* wrote: > I have solved by defining t

Re: not sure how to unpack a list within a tuple within another list inside the template

2012-01-12 Thread Daniel Roseman
On Wednesday, 11 January 2012 21:33:48 UTC, somecallitblues wrote: > > Hi Djangoers, > > I have a default dict variable final_d = defaultdict(list) that looks like > this: > > [(order1, [customer2, customer1]), (order2, [customer3, customer5, > customer6]) ] > > I've tried everything possible in

Re: not sure how to unpack a list within a tuple within another list inside the template

2012-01-12 Thread Masklinn
On 2012-01-11, at 22:33 , Mario Gudelj wrote: > Hi Djangoers, > > I have a default dict variable final_d = defaultdict(list) that looks like > this: > > [(order1, [customer2, customer1]), (order2, [customer3, customer5, > customer6]) ] DefaultDicts are dicts, when you iterate over dicts directly

Announcement: django-geoshortcuts - GeoJSON and GPX shortcuts for GeoDjango apps

2012-01-12 Thread Ivan Mincik
Hi, we have created small Django application package for serving some GIS geospatial formats from Django queryset data. Currently supported formats are GeoJSON and GPS via 'render_to_geojson' and 'render_to_gpx shortcuts'. If You are interested, please have a look here [1]. Comments, patches and w

Re: not sure how to unpack a list within a tuple within another list inside the template

2012-01-12 Thread Masklinn
On 2012-01-12, at 11:47 , Daniel Roseman wrote: > However I'm confused by your initial description. What you show is not a > dict at all, but a list of 2-tuples (each containing a string and a list). > Is that a single value of the dict, or what? I'm guessing it's the initialization vector for t

restricting choices of foreign key to objects owned by user

2012-01-12 Thread kenneth gonsalves
hi note: this is in admin. I have a model called Child. Child has foreign key to Project. There are many projects, but each user is only allowed to add a child to the projects he belongs to. I have restricted the ProjectAdmin queryset so that the user can only see his projects in the project chang

Re: A demo of django-inlinetrans and django-inplaceedit

2012-01-12 Thread J . Pablo Martín Cobos
2012/1/11 Juergen Schackmann > Hi, > this looks really great. > Thanks > I have 3 questions for which I would highly appreciate the answers: > > I hope have three answers > 1. What is the best way to include some form magic, i.e. sending the > changes not directly to the model but to a form

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Stuart Laughlin
No offense to the author, but I would advise ignoring that blog for the following reasons: # author admits he is a non-sysadmin noob # he installs everything globally rather than using virtualenv # he uses apache instead of... well... anything else # there does not appear to be anything in

Primary key for read-only models

2012-01-12 Thread Demetrio Girardi
I need to read data from an "external" database table from my django project. I am not interested in modifying the data, only reading it. Of course I would like to create a django model for the table, because it makes life so much more easier. I have already done this previously, however in this c

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Javier Guerra Giraldez
On Thu, Jan 12, 2012 at 9:54 AM, Stuart Laughlin wrote: >  # author admits he is a non-sysadmin noob ad-hominem >  # he installs everything globally rather than using virtualenv on single-purpose servers it's not so important. still good practice, but not mandatory. >  # he uses apache instead

Re: Primary key for read-only models

2012-01-12 Thread Javier Guerra Giraldez
On Thu, Jan 12, 2012 at 10:03 AM, Demetrio Girardi wrote: > I have already done this previously, however in this case the table > has a multiple field primary key, unsupported by Django. There is no > other field which is guaranteed to be unique that I can use as primary > key in the Django model.

Re: Primary key for read-only models

2012-01-12 Thread Thorsten Sanders
Had recently kinda the same just that I have 2 tables without a primary key at all and I just declared one of the fields as primary key and works fine. On 12.01.2012 16:03, Demetrio Girardi wrote: I need to read data from an "external" database table from my django project. I am not interested

Re: Removing Save functionality from Admin

2012-01-12 Thread Swaroop Shankar V
Hi All, I guess the question was not clear and am sorry for that. I have a model by the name Photos. I have enabled the admin section for this model. I don't want the admin to create any entries for this models from the admin area, so i need to remove the 'Add Photos' button on top of the Photos li

Re: Removing Save functionality from Admin

2012-01-12 Thread Denis Darii
You can rewrite the *has_add_permission* method of your admin class and return False. More info here: https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin. has_add_permission On Thu, Jan 12, 2012 at 5:51 PM, Swaroop Shankar V wrote: > Hi All, > I guess the ques

Re: Need to examine and act on old vs. new at .save() time

2012-01-12 Thread Jeff
On Jan 11, 9:23 pm, Dennis Lee Bieber wrote: > On Wed, 11 Jan 2012 17:26:44 +, Tom Evans > wrote: > > >On Wed, Jan 11, 2012 at 5:22 PM, Jeff wrote: > >> When Device.netgroups (a M2M field) changes, we need to perform > >> some python-ldap operations. > > >Have you considered simply going ba

Re: Need to examine and act on old vs. new at .save() time

2012-01-12 Thread Furbee
The only other way that I could think to do it would be to write your own M2M object. Just an object with two foreign key fields to reference X and Y. In that object you could overwrite the save method to check for which relations currently exist for a given reference to X and update accordingly. I

reverse() with keyword argument driving me batty

2012-01-12 Thread John DeRosa
Hi all, I'm running Django 1.3, and I can't get a simple reverse() with keywords to work. My urlconf has this: url(r'^results/text/(?P)/$', 'textresults', name='exporttextresults') My code does this: exporturl = reverse("exporttextresults", kwargs={"jobkey": returned_key}) And

Re: reverse() with keyword argument driving me batty

2012-01-12 Thread Andy McKay
On Thu, Jan 12, 2012 at 9:50 AM, John DeRosa wrote: >       url(r'^results/text/(?P)/$', 'textresults', > name='exporttextresults') One guess, you haven't specified what the (?P in your regex accepts. For example: (?P\w+) -- You received this message because you are subscribed to the Google Gr

Social conference website?

2012-01-12 Thread Alec Taylor
Good morning, I am building up a social-conference website in Django for a university clubs' comedy-revue. I will open-source it under the two-clause BSD license. Features I would like to implement: • User accounts automatically generated on attendance registration • Ticket, Sponsor and parapher

Re: reverse() with keyword argument driving me batty

2012-01-12 Thread John DeRosa
On Jan 12, 2012, at 10:18 AM, Andy McKay wrote: > On Thu, Jan 12, 2012 at 9:50 AM, John DeRosa wrote: >> url(r'^results/text/(?P)/$', 'textresults', >> name='exporttextresults') > > One guess, you haven't specified what the (?P in your regex accepts. > For example: > (?P\w+) > Gah! I am

Re: reverse() with keyword argument driving me batty

2012-01-12 Thread J. Cliff Dyer
Your URLconf is broken. The (?P) regex fragment gives you a keyword argument of jobkey, but it only matches a zero length string. You need to include a regex to specify what you want jobkey to match. (?P[0-9a-fA-F]*) Cheers, Cliff On Thu, 2012-01-12 at 09:50 -0800, John DeRosa wrote: > Hi all

Re: Removing Save functionality from Admin

2012-01-12 Thread Swaroop Shankar V
Thanks Denis, that fixed the issue. One more question, is it possible to display an image in the edit form? I don't want the admin to upload any image but i want to display whatever image is uploaded on the edit form, is it possible? I googled but could not find any relevant results. Thanks Regard

admin properties and short_description

2012-01-12 Thread stereoit
Hi, is there a way how to pass a short_description to a property? I have: @property def extend_types(self): return cjson.decode(self.extend_types_data) #extend_types.short_description = 'Something better' with the code uncommented I get: AttributeError: 'property' object has no attribut

Re: A demo of django-inlinetrans and django-inplaceedit

2012-01-12 Thread Juergen Schackmann
> > > >> 2. If I do not want to send field by field, but possibly a set of fields >> back to the to the server, like the row of a table. Would that be feasible? >> > > Now this is not implemented, and I think it is not trivial. But you can > try it > i am afraid my js skills are too limited f

Re: Social conference website?

2012-01-12 Thread Donald Stufft
There's https://github.com/pinax/symposion but i'm not sure what you mean by "social". On Thursday, January 12, 2012 at 1:18 PM, Alec Taylor wrote: > Good morning, > > I am building up a social-conference website in Django for a > university clubs' comedy-revue. > > I will open-source it und

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-12 Thread Juergen Schackmann
can really no one help? i am really stuck here at the moment -- 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/-/RYLQqxJE7HYJ. To post to this group, send email

Re: not sure how to unpack a list within a tuple within another list inside the template

2012-01-12 Thread Bill Freeman
Mario, While there are syntaxes for doing this sort of thing in the template language, I would expect the template to start looking messy, and be hard to maintain. May I suggest that you wrap this stuff in a class to provide attribute like access to the data that you need? This puts the access l

Re: Staging (dev,test,prod) in django

2012-01-12 Thread Mike Dewhirst
On 12/01/2012 8:55pm, Thomas Guettler wrote: Hi, How do you handle staging? - Deploy the source code and static files dev (winXP) commit to svn (linux) svn wakes up buildbot (same linux) buildbot wipes out the test site (same linux) buildbot rebuilds the test site (including collectstat

Re: not sure how to unpack a list within a tuple within another list inside the template

2012-01-12 Thread Mario Gudelj
Thanks for your help guys. I ended up creating a class for for orders and customers class and then I passed those objects to the tepmlate inside a dict. That worked. Cheers, On 12 January 2012 21:55, Masklinn wrote: > On 2012-01-12, at 11:47 , Daniel Roseman wrote: > > However I'm confused by y

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-12 Thread Andres Reyes
What are you triying to achieve? 2012/1/12 Juergen Schackmann : > can really no one help? i am really stuck here at the moment > > -- > 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.goog

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-12 Thread Juergen Schackmann
I am trying to do the same as described in previous example: I have a model with a foreign key field to User and in the view I want to populate the the field from request.user. And when doing it exactly the way as Russ proposed, I get the described error. -- You received this message because

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-12 Thread Alasdair Nicol
On 11/01/12 20:54, Juergen Schackmann wrote: if is use this code, as proposed by russ: def form_valid(self, form): self.object.user = ... (something meaningful.. e.g., self.request.user) return super(CreateCampaignView, self).form_valid(form) i get the error 'NoneType' obje

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Stuart Laughlin
On Thursday, January 12, 2012 10:09:13 AM UTC-6, Javier Guerra wrote: > > On Thu, Jan 12, 2012 at 9:54 AM, Stuart Laughlin > wrote: > > # author admits he is a non-sysadmin noob > > ad-hominem > False. I pointed out what the author clearly stipulates. "I’m a sys admin NOOB. I am also teaching

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Jeff Heard
http://kencochrane.net/blog/2011/06/django-gunicorn-nginx-supervisord-fabric-centos55/ I would go there. It's not Amazon EC2 specific, but Amazon's distribution by default is a Centos-based one, so everything should be in the same place. Plus, he very helpfully gives you code you can use to get

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Stuart Laughlin
I am partial to debian / ubuntu, so I use those rather than Amazon's default AMIs (see http://alestic.com/ ). Here are a few links that I have found particularly useful in the past, for various aspects of the deployment process... * http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtua

Re: django/Data Base Advice

2012-01-12 Thread Chris Kavanagh
On Jan 5, 6:40 pm, Petite Abeille wrote: > On Jan 6, 2012, at 12:13 AM, Chris Kavanagh wrote: > > > I believe, thanks to your (previous) post, I was confused as to the > > difference between SQL and Database in general. I had thought learning > > SQL was learning database design. When in actuali

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Mario Gudelj
http://www.synstorm.co.uk/2012/01/08/setting-up-django-on-a-free-amazon-ec2-instance/?utm_source=Python+Weekly+Newsletter&utm_campaign=337820f7f5-Python_Weekly_Issue_17_January_12_2012&utm_medium=email On 13 January 2012 10:44, Stuart Laughlin wrote: > I am partial to debian / ubuntu, so I use t

Re: Changes to default project layout?

2012-01-12 Thread Lee Hinde
Just following up on this, I don't think my question is answered, specifically, which settings.py file is intended to be used? On Wednesday, November 9, 2011 2:08:47 AM UTC-8, Russell Keith-Magee wrote: > > Hi Victor, > > All the answers you're looking for are in the draft release notes for > th

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Andres Reyes
You mean that the webserver that Django itself recommends in https://docs.djangoproject.com/en/dev/howto/deployment/ is not a good choice? 2012/1/12 Stuart Laughlin : > > On Thursday, January 12, 2012 10:09:13 AM UTC-6, Javier Guerra wrote: >> >> On Thu, Jan 12, 2012 at 9:54 AM, Stuart Laughlin >

Re: Social conference website?

2012-01-12 Thread Alec Taylor
Thanks. Social as in social-auth. Preferably FriendList as well ("Enabling user to select the set of friends to send requests to": https://developers.facebook.com/docs/reference/dialogs/requests/) On Fri, Jan 13, 2012 at 7:42 AM, Donald Stufft wrote: > There's https://github.com/pinax/symposion 

Re: change min_length in form __init__?

2012-01-12 Thread Wen 温业逵Yekui
why you use the "*" in your function argument? 2012/1/11 galgal > Is there any way, to change the field's *min_length* argument inside form > constructor? That doesn't work: > > def __init__(self, *args, **kwargs): >> super(CreateTeamForm, self).__init__(*args, **kwargs) >> self.fields['

Re: Need to examine and act on old vs. new at .save() time

2012-01-12 Thread Torsten Bronger
Hallöchen! Jeff writes: > [...] > > I found the 'm2m_changed' signal yesterday, read that you can't > determine *what* changed by using it, and also ended up directed > to some open bug reports... etc... and threw up my hands. But the "action" and "pk_set" arguments contain this information. Ts

Re: Internationalization and localization

2012-01-12 Thread Radek Valachovic
Thats what I was also thinking about to do it like that, I have couple websites in django but still beginner learning, with django_easymode I created entire website that translates itself just by switching between languages /en/ /it/ etc... so I can add unlimited...but I would like to know also you