Re: ModelForms

2012-03-23 Thread Mario Gudelj
It doesn't matter how you generate your form, your CSS should be applied from inside the template. You need to add a CSS file link to a template to which you're passing the form to inside your context from within a view, or you can embed it into your template using

Re: filtered admin change-list

2012-03-23 Thread omerd
thank you. I will try it On 19 מרץ, 19:26, Rajeesh Nair wrote: > Add a field on your model to identify the user who created each instance & > then extend your model_admin's queryset method to filter queryset by the > user. > > > > > > > > On Sunday, March 18, 2012 4:37:43 AM UTC+5:30, omerd wrote

Re: filtered admin change-list

2012-03-23 Thread Marc Aymerich
On Sun, Mar 18, 2012 at 12:07 AM, omerd wrote: > Hi, > > I want to be able to show parts of the change list, by the user that > view it. > The case is that every super-user can create instances of a certain > model. I wan't that in the change-list page of that model in the admin > site, every user

Automatic indexes on foreign keys

2012-03-23 Thread Aryeh Leib Taurog
With the following models: class Group(models.Model): group_name = models.CharField(max_length=10, primary_key=True) class Item(models.Model): item_name = models.CharField(max_length=10) group = models.ForeignKey(Group) class Meta: unique_together = [('item_name','group')]

Loading Of Tweets

2012-03-23 Thread coded kid
Hi guys, I;ve been facing some problem with loading of tweets in my django project. The question now is; how can I load users tweets in my django site. I'm using omab/django social auth to authenticate users. Anyone have the idea? Thanks! -- You received this message because you are subscribed t

Is it secure to have IDs show up in URLs?

2012-03-23 Thread Bastien
I am concerned about seeing the IDs of objects appearing in the URL and in a totally predictable manner. It is very convenient and clean to do all sorts of things but can be abused very easily to retrieve all the content of the site, ie: photos... Is it a good idea to try to change this behavio

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Vovk Donets
Hello, why not use _slug_ then?? You can show in URLs whatever you want. 2012/3/23 Bastien > I am concerned about seeing the IDs of objects appearing in the URL and in > a totally predictable manner. It is very convenient and clean to do all > sorts of things but can be abused very easily to ret

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Bastian Ballmann
Hi Bastien, it's the task of the backend to manage the authorization including users and permissions. If the view and permission system allows all users to see everything and you dont want it that way than you have to check permission in your views. See https://docs.djangoproject.com/en/1.3/topi

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Bastien
Sorry maybe my post was not very clear, I am talking about public content here, that should be accessed by anyone, even anonymous users not logged in. For instance if we talk about photos, publicly available, the url would look something like /photos/1, /photos/2 1 and 2 being the pk of the

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Brett Parker
On 23 Mar 04:38, Bastien wrote: > Sorry maybe my post was not very clear, I am talking about public content > here, that should be accessed by anyone, even anonymous users not logged in. > For instance if we talk about photos, publicly available, the url would > look something like /photos/1, /ph

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 11:38 AM, Bastien wrote: > Sorry maybe my post was not very clear, I am talking about public content > here, that should be accessed by anyone, even anonymous users not logged in. > For instance if we talk about photos, publicly available, the url would look > something lik

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 12:00 PM, Brett Parker wrote: > On 23 Mar 04:38, Bastien wrote: >> Sorry maybe my post was not very clear, I am talking about public content >> here, that should be accessed by anyone, even anonymous users not logged in. >> For instance if we talk about photos, publicly ava

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Brett Parker
On 23 Mar 12:04, Tom Evans wrote: > On Fri, Mar 23, 2012 at 12:00 PM, Brett Parker > wrote: > > On 23 Mar 04:38, Bastien wrote: > >> Sorry maybe my post was not very clear, I am talking about public content > >> here, that should be accessed by anyone, even anonymous users not logged > >> in. > >

Broken INTERNAL link error emails on flat pages.

2012-03-23 Thread Arek
This is my first post here so hello everybody. when SEND_BROKEN_LINK_EMAILS=True, every time flat page is visited django-1.3.1 sends emails like this: Referrer: http://example.com/ Requested URL: /contact/ User agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.5

Re: Using _set.all in template when ForiegnKey is linked to Self

2012-03-23 Thread Jam
I actually managed to find a way to do this. instead of using {% for fieldname_set.all %} I used {% for RelatedName.all %} That worked perfectly. On Thursday, March 22, 2012 11:52:19 PM UTC+2, Daniel Roseman wrote: > > On Thursday, 22 March 2012 01:12:21 UTC-7, Jam wrote: >> >> Hi All, >> >> I

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 12:11 PM, Brett Parker wrote: > *if* they wanted all the photos, then spidering the site isn't exactly > difficult, see wget -m. You assume that all the content is indexed on the website. Consider a press release model; you may have a 'published' flag on the PressRelease m

Re: Abridged summary of django-users@googlegroups.com - 27 Messages in 14 Topics

2012-03-23 Thread William Slippey
On Fri, Mar 23, 2012 at 9:18 AM, wrote: > Today's Topic Summary > > Group: http://groups.google.com/group/django-users/topics > >- Is it secure to have IDs show up in > URLs?<#1363fb5b1f3e4a26_group_thread_0>[9 Updates] >- Using _set.all in template when ForiegnKey is linked to > Self

Django log lines spamming syslog

2012-03-23 Thread Scott Gould
Hi folks, Our syslog has been filling up for some time with this stuff and we only just noticed due to logrotate breaking on us. For what appears to be every django request across all virtual hosts, we are getting a pair of lines, like so (blank lines inserted by me): Jan 27 14:48:52 cloweb01 apa

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Bastian Ballmann
I dont get it. You want to make all your stuff publicly available, but complain about the matter that everyone can access everything? Anyway for on any reason you want not so easy guessable links why not use md5 or sha1 checksum in hex of the photo as link? Greets Basti Am Fri, 23 Mar 2012 04

Re: Automatic indexes on foreign keys

2012-03-23 Thread Javier Guerra Giraldez
On Fri, Mar 23, 2012 at 4:37 AM, Aryeh Leib Taurog wrote: > My understanding is that one usually > wants an index on the *referenced* field, not the *referencing* > field. it's for the back-reference link. so that you can do group.item_set.all() and get all the items that share a group. yes, th

Customizie admin views

2012-03-23 Thread jsdey
I have a project photos that has a model Album. Admin (/admin/photos/ album/ page has a button "Add Album". I want to write a custom page for that action but can't find the view that does the processing. Any guidance would be appreciated. Thanks. John -- You received this message because y

Re: Weird stacktrace coming from manage.py test

2012-03-23 Thread Reinout van Rees
On 22-03-12 17:34, Jeff Heard wrote: Has anyone seen this before? Am I missing something? This hasn't even gotten to my code yet. I'm using this in my settings.py: TEST_RUNNER = 'django.contrib.gis.tests.GeoDjangoTestSuiteRunner' I have a template PostGIS database setup properly. And I'm ru

Re: Django-1.4c2 logging issue on Snow Leopard

2012-03-23 Thread Reinout van Rees
On 22-03-12 21:09, Jeff Heard wrote: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 562, in configure 'filter %r: %s' % (name, e)) ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireD

Re: Weird stacktrace coming from manage.py test

2012-03-23 Thread Jeff Heard
No, it turned out that my django-startproject.py was still the one for 1.3... On Fri, Mar 23, 2012 at 10:47 AM, Reinout van Rees wrote: > On 22-03-12 17:34, Jeff Heard wrote: >> >> Has anyone seen this before?  Am I missing something?  This hasn't even >> gotten to my code yet.  I'm using this in

Pip install matplotlib error with virtualenv

2012-03-23 Thread darwin_tech
I am trying to install matplotlib in a new virtualenv. When I do: pip install matplotlib or pip install http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.tar.gz I get this error: building 'matplotlib._png' extension gcc -pthread -fno-strict-alia

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 3:06 PM, darwin_tech wrote: > I am trying to install matplotlib in a new virtualenv. > > When I do: > > pip install matplotlib > > or > > pip install > http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.tar.gz > > I get this error:

reverse urls on admin

2012-03-23 Thread Marc Aymerich
Hi, I've overrided the get_urls() of one of my ModelAdmin in order to provide some extra views. what I did is: def get_urls(self): """Returns the additional urls used by the Contact admin.""" select_urls = patterns("", url("^contract_pack/(?P\d+)/", inc

Re: Django log lines spamming syslog

2012-03-23 Thread Reinout van Rees
On 23-03-12 14:49, Scott Gould wrote: Our syslog has been filling up for some time with this stuff and we only just noticed due to logrotate breaking on us. For what appears to be every django request across all virtual hosts, we are getting a pair of lines, like so (blank lines inserted by me):

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread darwin_tech
Thanks for the reply. I guess not directly related to Django, though this virtualenv is very much for the purpose of a Django project and I hoped other Django users had come across this particular problem. Thankyou for the response though - do I need to install libpng in the virtualenv (sorr

Re: Django log lines spamming syslog

2012-03-23 Thread Scott Gould
Nail, meet head. Thanks! I was thinking along similar lines but stupidly checked everywhere (my code, apache confs, etc.) except the django source on the server itself. On Mar 23, 11:36 am, Reinout van Rees wrote: > On 23-03-12 14:49, Scott Gould wrote: > > > > > Our syslog has been filling up f

Re: Django deployment practices -- do people use setup.py?

2012-03-23 Thread John Griessen
On 03/14/2012 09:13 PM, Matt Schinckel wrote: For project deployment, I use a fabfile that does the following: * installs public keys onto the server (if necessary) * creates the directory structure required (if necessary) * copies the project onto the server * installs requirements from REQUIRE

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 3:45 PM, darwin_tech wrote: > Thanks for the reply. > > I guess not directly related to Django, though this virtualenv is very much > for the purpose of a Django project and I hoped other Django users had come > across this particular problem. > > Thankyou for the response

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Reinout van Rees
On 23-03-12 16:59, Tom Evans wrote: * Do Linux distros still do this? I use FreeBSD, so am not affected by this madness. Why would an OS install a binary library and not install the headers, the very thing that allow you to use the library yourself. Madness. At least ubuntu still does this. On

Re: ModelForms

2012-03-23 Thread Tim Ney
I think the best thing for you do is to create the css outside the template. Like this - create the css file, separately, then reference the file in the template. Or, better yet, add the css you need for your form in you main css file that is referenced in your base template and just inherit it by

Re: ModelForms

2012-03-23 Thread Kurtis Mullins
If you're worried about stylizing specific fields, it'll be setup as a table, ul, or paragraph based upon how you "render the form" (paragraph by default I think). The individual fields are named with the following convention (if I recall correctly) . So for a field named "password" in a paragraph

Re: ModelForms

2012-03-23 Thread Tim Ney
Not to gild the lilly, but, you could also do this, and it would work: either as part of the css you are inheriting from the "base" or, separately, you could create a whole slew of named css styles in one file, then apply each file to the template tags, table tags you use to call the data into the

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Daniel Sokolowski
Rather then obscuring the urls, in my mind per object level permission, or even a simple status fields with a live(...) objects manager would do the trick better. One can attempt guess and access the next sequence but it won't show. I personally use status field on almost all my models and pe

ANNOUNCE: Django 1.4 released

2012-03-23 Thread James Bennett
Django 1.4 is finally here! For details, checkout the weblog: https://www.djangoproject.com/weblog/2012/mar/23/14/ And the release notes: https://docs.djangoproject.com/en/dev/releases/1.4/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread darwin_tech
Hi Tom, the weird thing is that matplotlib works fine on my system. If I have a Django project running outside of virtualenv, there is no problem and matplotlib is on the pythonpath. Sam On Friday, 23 March 2012 09:59:25 UTC-6, Tom Evans wrote: > > On Fri, Mar 23, 2012 at 3:45 PM, darwin_tech

Accessing objects from a dictionary in templates

2012-03-23 Thread gowtham
Hi Everyone, I am trying to pass a dictionary with numerical as key and a object as value to my template... i construct it like this: reslibdic[res.result_id]=Library.objects.get(libraryresult__result__result_id=res.result_id) But, in template, rather than iterating over the dictionary (using for

Re: ANNOUNCE: Django 1.4 released

2012-03-23 Thread Mário Neto
Great! \,,/_ 2012/3/23 James Bennett > Django 1.4 is finally here! > > For details, checkout the weblog: > > https://www.djangoproject.com/weblog/2012/mar/23/14/ > > And the release notes: > > https://docs.djangoproject.com/en/dev/releases/1.4/ > > -- > You received this message because you are

Re: ANNOUNCE: Django 1.4 released

2012-03-23 Thread Jeff Heard
Do the PyCharm devs read this list? Will 1.4 work inside pycharm 2.5? On Mar 23, 2012, at 3:58 PM, Mário Neto wrote: > Great! \,,/_ > > 2012/3/23 James Bennett > Django 1.4 is finally here! > > For details, checkout the weblog: > > https://www.djangoproject.com/weblog/2012/mar/23/14/ > >

Re: ANNOUNCE: Django 1.4 released

2012-03-23 Thread Andre Terra
Hooray! Congrats to everyone involved, especially all that worked on bringing timezone support to this increasingly amazing web framework. I don't mean to nitpick but a minor detail in the release notes requires some attention: "Django does not support Python 3.x at this time. At some point befo

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Reinout van Rees
On 23-03-12 18:51, darwin_tech wrote: the weird thing is that matplotlib works fine on my system. If I have a Django project running outside of virtualenv, there is no problem and matplotlib is on the pythonpath. One of virtualenv's options is to isolate you *completely* from the system python

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Reinout van Rees
On 23-03-12 21:37, Reinout van Rees wrote: On 23-03-12 18:51, darwin_tech wrote: the weird thing is that matplotlib works fine on my system. If I have a Django project running outside of virtualenv, there is no problem and matplotlib is on the pythonpath. One of virtualenv's options is to isol

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread Reinout van Rees
On 23-03-12 20:56, gowtham wrote: But, in template, rather than iterating over the dictionary (using for and items) i would like to access them using keys. You can, can't you? {{ my_dict.some_key }}. You're using numerical keys, which might not work as well. But you can try something like {

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread gowtham
Hi Reinout, Thanks. But, i could not get it. It prints the primary key of the stored object rather than the object itself. Gowthaman On Fri, Mar 23, 2012 at 1:41 PM, Reinout van Rees wrote: > On 23-03-12 20:56, gowtham wrote: > >> >> But, in template, rather than iterating over the dictionary

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread Reinout van Rees
On 23-03-12 22:00, gowtham wrote: But, i could not get it. It prints the primary key of the stored object rather than the object itself. Well, I don't know what's in the stored object. How are you supposed to print it? Something like {{ my_object.name }}{{ my_object.description }} or so?

Re: Multiple Choice Quiz

2012-03-23 Thread jbr3
Hi again, I've been trying to figure this out for awhile, but to no avail. I'll try to list the problems I've had in understanding it. 1. I'm not sure what the forms.py file should look like. Going by Shawn's model, would it be something like: " class GuessForm(ModelForm): class Meta:

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread gowtham
Yes, That is correct. Let me step back a bit and explain you what i am trying. It's quite possible i am doing the right thing. I have two models (Library and Result) linked by a third linking model (libraryresult (has id, library_id and result_id fields FKeyed to respective tables). A many to man

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread gowtham
sorry, I meant to say "It's quite possible i am NOT doing the right thing." On Fri, Mar 23, 2012 at 3:24 PM, gowtham wrote: > Yes, That is correct. > > Let me step back a bit and explain you what i am trying. It's quite > possible i am doing the right thing. > > I have two models (Lib

Re: Accessing objects from a dictionary in templates

2012-03-23 Thread gowtham
Template tag filters like this (made one for each field in the library object) helps me to get what i wanted But, that seems too silly to do... in template {{ reslibdic|hash2libcode:res.result_id }} in template tag file: def hash2libcode(h,key): if key in h: return h[key].librar

serialize queryset metadata - what's the best approach?

2012-03-23 Thread mikeS
I'm looking at letting my users implement reports via a web interface where they can essentially define the report. I need to store that report definition in the db, so they can re-run it whenever. The problem I have is serialize all that to and from a QuerySet. I've hacked something that builds

Django FOrms

2012-03-23 Thread prem
I'm using Django forms and need to create a list box. What would be the equivalent of listbox in Django form fields? Here is my code snippet, Models.py class Volunteer(models.Model): NO_OF_HRS = (('1','1') ('2','2')) datecreated = models.DateTimeField() volp

Re: Django FOrms

2012-03-23 Thread dummyman dummyman
Hi, u ve not inserted comma after a first entry in the tuple NO_OF_HRS On Sat, Mar 24, 2012 at 3:11 AM, prem wrote: > I'm using Django forms and need to create a list box. > > What would be the equivalent of listbox in Django form fields? > > Here is my code snippet, > > Models.py > > class Volu

Filtering a second admin dropdown's contents based on the first dropdown's selection

2012-03-23 Thread Sithembewena Lloyd Dube
Hi everyone, I have two dropdowns on the create/ edit pages of an object in the admin site. I need to filter the second dropdown's contents based on the selection in the first (as a user-friendliness measure). I have tried the recommended use of formfield_or_foreignkey with no progress. The differ