my first (public) app: django-requires_js_css

2010-10-20 Thread Jason Persampieri
http://github.com/pappy74/django-requires_js_css Howdy folks, I was hoping to get some feedback on my first public app, django- requires_js_css. The app's purpose is to allow 'sane' JavaScript and CSS requirements. That is, require from within templates, but still load using 'best practices'.

Re: /admin list help ASAP

2010-10-20 Thread Steve Holden
On 10/20/2010 11:55 PM, Mike Dewhirst wrote: > On 21/10/2010 1:24pm, Bobby Roberts wrote: >> hi all. I have two models setup let's call them >> >> Gallery >> Photos >> >> photos has a field as such: >> >> GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery Id'), >> related_name='Galle

Re: /admin list help ASAP

2010-10-20 Thread Mike Dewhirst
On 21/10/2010 1:24pm, Bobby Roberts wrote: hi all. I have two models setup let's call them Gallery Photos photos has a field as such: GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery Id'), related_name='Gallery_Id',blank=False, null=False, help_text=_("Please choose the galler

/admin list help ASAP

2010-10-20 Thread Bobby Roberts
hi all. I have two models setup let's call them Gallery Photos photos has a field as such: GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery Id'), related_name='Gallery_Id',blank=False, null=False, help_text=_("Please choose the gallery to which you wish to associate this photo."

Re: dump sqlite to file when testing

2010-10-20 Thread Russell Keith-Magee
On Wed, Oct 20, 2010 at 10:33 PM, Miguel Araujo wrote: > Hi everyone, > Is there any way to force sqlite3 to use a file instead of RAM when running > tests? I would like to access the DB somehow to check some fields. This is > the only DB engine I have in this machine. Yes - set the TEST_NAME (or

call more than one view action from an uri path?

2010-10-20 Thread Phlip
Djangoistas: We want to call this URL: http://www.server.com/nest/5/pest/6/rest/7 We want each handler to call, with its argument, in order: def nest(request, x): ... def pest(request, y): ... def rest(request, z): ... (Internally, at rest() time, we want x and y to

checkboxes disappearing in the admin panel?

2010-10-20 Thread Yo'av Moshe
Hey, I'm seeing some very odd behavior in Django's admin panel. I'm using the admin panel to list about 3500 objects of "people". The list view shows about 17 fields. I'm using the checkboxes to perform certain admin actions I wrote. This all works great, usually. Sometimes, when I'm looking at

Re: about site price

2010-10-20 Thread Steve Holden
On 10/20/2010 4:17 PM, Lic. José M. Rodriguez Bacallao wrote: > hi folks, I have a client that need to develop a bet site like this: > http://www.webapuestas.com/ > the problem is that I am new in the business and I don't know how much > money can I ask for a > this work, can someone help me and ta

Re: Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-20 Thread werefr0g
Hello, I think you should use something like alt="{{ object.title }}" /> in your template: you want to output images' url in your template, not the "object" itself. You'll find explanations in [1] and [2]. Regards [1] http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.

about site price

2010-10-20 Thread Lic . José M . Rodriguez Bacallao
hi folks, I have a client that need to develop a bet site like this: http://www.webapuestas.com/ the problem is that I am new in the business and I don't know how much money can I ask for a this work, can someone help me and take a look to the site and give me an approximate cost for a site like th

Re: Heriter charField

2010-10-20 Thread abdou diagne
merci beaucoup , mais mon probleme est le mot de passe ne doit pas etre en claire dans la base .Aussi je peux pas utiliser les hash parceque ya une autre application , java meme , qui accéde a la base de donnee -- You received this message because you are subscribed to the Google Groups "Djang

Re: call shell script from Django web service

2010-10-20 Thread Elie Zedeck RANDRIAMIANDRIRAY
If I were you, I would first investigate why is the script failing. Then, when you know why it's failing, you could make a workaround. It is normally possible to run external apps from Django, because it's just Python. You simply need to give your script the correct set of environment for it to wo

call shell script from Django web service

2010-10-20 Thread jintao
Hi all, I implemented some web service with Django framework. I need this service to execute some shell script on the server. I have already tried os.system(), which works in python terminal, but doesn't work in Django framework. Anyone could show some guidance here? Thanks tons! jintao --

Re: Oracle Database Other User Tables/Views

2010-10-20 Thread Ian
On Oct 20, 8:20 am, "Christopher Conover" wrote: > Hello, > > I am using Django's multiple database support to connect to an existing > Oracle database (10g). I do not have control of the schema nor do I have any > other privileges beyond SELECT. Further, the tables and views that I have > acce

Re: Heriter charField

2010-10-20 Thread Elie Zedeck RANDRIAMIANDRIRAY
Je suis un débutant en Django, mais je pense que tu doit utiliser un autre widget pour ton mot de passe. Par exemple: password = CharField(widget=PasswordInput) D'autres widget ici: http://docs.djangoproject.com/en/dev/ref/forms/widgets/ 2010/10/20 updo > Bonjour à tout le monde > Je voudrai c

Re: Heriter charField

2010-10-20 Thread Daniel Roseman
On Oct 20, 6:40 pm, updo wrote: > Bonjour à tout le monde > Je voudrai creer une classe passwordField qui va heriter de la classe > charField afin de crypter les mots dans la base de donnée , je > voudrai  savoir quelles sont les méthodes de la classe faudra > redéfinir pour que quand je cree une

Heriter charField

2010-10-20 Thread updo
Bonjour à tout le monde Je voudrai creer une classe passwordField qui va heriter de la classe charField afin de crypter les mots dans la base de donnée , je voudrai savoir quelles sont les méthodes de la classe faudra redéfinir pour que quand je cree une instance de la classe passwordField , il pr

Re: "No module named copycompat" error

2010-10-20 Thread mathphreak
That worked. Thanks! On Oct 19, 4:05 pm, timc3 wrote: > From a python prompt can you do: > > from django.utils import copycompat > > If not, Django might not be imported properly. Also check your > PYTHONPATH. > > On Oct 18, 10:57 pm, mathphreak wrote: > > > > > I just upgraded my computer to U

What is the difference between MEDIA_ROOT and STATICFILES_ROOT in Django1.3?

2010-10-20 Thread P.R.
.. and why staticfiles doesn't work? :-) # django.contrib.staticfiles ... if settings.DEBUG: raise ImproperlyConfigured("The view to serve static files can only " "be used if the DEBUG setting is True") It should be "if not settings.DEBUG" I think.

Re: Manual ordering

2010-10-20 Thread Nick
Worked like a charm. This was a limited case so I won't be needing any checks to ensure that the ID's are all in the queryset since there are only 5 or 6. Thanks again. On Oct 20, 10:44 am, Shawn Milochik wrote: > Given a tuple/list of primary keys named ordered_ids and a queryset named > record

Re: Newbie question: How should I structure my very simple project / app?

2010-10-20 Thread wawa wawawa
Just a quick response to thank everyone for the suggestions. I'll let you all know how I get on. ;-) (Actually, you'll probably guess from the quality or absurdity of my questions that may come up over the coming days / weeks) WZ On 20 October 2010 00:01, timc3 wrote: > Take a look at: > > h

Re: Manual ordering

2010-10-20 Thread Shawn Milochik
Given a tuple/list of primary keys named ordered_ids and a queryset named records: results = [records.get(pk = x) for x in ordered_ids] This is a naive example, as it assumes that ordered_ids will never have IDs which don't exist in the queryset, but it gives a simple way to do what you're ask

Re: Multi-user environment where users can add/edit/delete only their own posts

2010-10-20 Thread Shawn Milochik
Your post model should have a foreign key to user, perhaps named "creator" or "owner." Then ensure that the edit and delete views in your application can only modify or delete posts where the owner is request.user. Shawn -- You received this message because you are subscribed to the Google G

Manual ordering

2010-10-20 Thread Nick
I am working on the output for some data and I would like to manually assign the order as there is no field that I can order by that will give me the desired output. Is there a way to manually declare the order of output based on the PKs of an entry? -- You received this message because you are s

Multi-user environment where users can add/edit/delete only their own posts

2010-10-20 Thread piousbox
hello all, I'm considering Django for one of my projects but I run into an issue. Suppose I have a multi-user environment (like craigslist) where users can register and, let's say, write posts and create photo galleries. I want a user to be able to edit his or her own posts and galleries. I want a

Re: login_required and new class based views

2010-10-20 Thread Harro
Let me add that the decorator_from_middleware call all the middleware process_* functions if available but these will ofcourse be called at a whole different point in time then the actual middleware. Normally middleware is woven through the whole dispatch process, as a decorator it's wrapped around

django.contrib.auth password reset reveals the user id

2010-10-20 Thread Yaniv Aknin
Hi, I'd like to use contrib.auth's password reset feature, but wouldn't like to expose my user id. Since user ids (even if they start at an arbitrary number) can be used to deduce the size of the userbase and growth rate, I think it's easy enough to justify this at least as an option. To fix this

Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-20 Thread tricks...@googlemail.com
I have the following code that fails to display object images. But displays normal images fine. My Model class News(models.Model): title--- image = models.ImageField(upload_to='images') body Template tag coding from django import template register = template.Library() from -

dump sqlite to file when testing

2010-10-20 Thread Miguel Araujo
Hi everyone, Is there any way to force sqlite3 to use a file instead of RAM when running tests? I would like to access the DB somehow to check some fields. This is the only DB engine I have in this machine. Thanks, Best regards Miguel Araujo -- You received this message because you are subscrib

Oracle Database Other User Tables/Views

2010-10-20 Thread Christopher Conover
Hello, I am using Django's multiple database support to connect to an existing Oracle database (10g). I do not have control of the schema nor do I have any other privileges beyond SELECT. Further, the tables and views that I have access to are owned by a different user. Because of this I'm havi

Re: Updating a video rating using AJAX

2010-10-20 Thread Nicolas R
When you change data on your database ALWAYS use the http POST method. So your view should check if request.method == 'POST' and then proceed to change the rating. It should also check if the user is authenticated and if she already voted. As for the ajax part have a look at the jQuery javascript

Re: Expense of django query

2010-10-20 Thread Ed
Brilliant. Thanks! On Oct 20, 9:41 am, Javier Guerra Giraldez wrote: > On Wed, Oct 20, 2010 at 7:59 AM, Ed wrote: > > what is the purpose of ifchanged? > > since the images are sorted by film, if you just show the film for > every image it would be repeated.  with {% ifchanged %} it's only > sh

Re: rake routes

2010-10-20 Thread esatterwh...@wi.rr.com
There is also a very useful project out there called django-command- extensions http://code.google.com/p/django-command-extensions/ you can install that. Along with a gaggle of things you will have a show_urls command python manage.py show_urls will print out all of the urls from all of the apps

Re: Updating a video rating using AJAX

2010-10-20 Thread brad
Also, if you DO choose to pass JSON back to your client, you should serialize it first. See this: http://docs.djangoproject.com/en/dev/topics/serialization/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Updating a video rating using AJAX

2010-10-20 Thread Brian Neal
On Oct 20, 8:23 am, Sithembewena Lloyd Dube wrote: > Hi all, > > I have a page where users can rate a video, and in models.py I have a video > model with a 'rating' property. I wish to find out how I can AJAXify the > rating button on the page, so that if a user clicks on it, the button can > call

Re: Updating a video rating using AJAX

2010-10-20 Thread brad
> I would like to do this without using a view or doing a form POST or GET of > any kind. Any pointers? Why? If you're building a web app, you should use HTTP to for the client to communicate with the app (AJAX is just another form of that communication). You're almost there, though, because yo

Re: Expense of django query

2010-10-20 Thread Javier Guerra Giraldez
On Wed, Oct 20, 2010 at 7:59 AM, Ed wrote: > what is the purpose of ifchanged? since the images are sorted by film, if you just show the film for every image it would be repeated. with {% ifchanged %} it's only shown before all the images for this film, so the result is like this: film A image

Re: DRY forms

2010-10-20 Thread skyjur
Does your form look like: MyForm (ModelForm): Meta: fields: ['one', 'second'] it updates only those fields listed in meta tag. Other fields aren't touched. On Oct 20, 9:16 am, simonty wrote: > Hello, > I have a database table with about 100 fields. > I have a number of f

Registering a ModelAdmin, but with a different URL

2010-10-20 Thread Elie
Hey guys, This is my first post in here, and I'm also rather new to Django and a lot of things are still new to me. I'm also very confused going around the documentation, so I'd like to ask directly what should I do. Basically, what I want to do is very very simple really, but I can't exactly fin

Updating a video rating using AJAX

2010-10-20 Thread Sithembewena Lloyd Dube
Hi all, I have a page where users can rate a video, and in models.py I have a video model with a 'rating' property. I wish to find out how I can AJAXify the rating button on the page, so that if a user clicks on it, the button can call a custom function and pass the video id (cannot call a view as

Re: Displaying a template table using a query set

2010-10-20 Thread Casey S. Greene
Hi Pranav, I think what Steve was saying is that if you go back to your original template and view: {% for row in table_data %} {% for value in row %} {{ row }} {% endfor %} {% endfor %} and you know, for instance, what fields you want to display and how (like your id field) that you d

Re: Displaying a template table using a query set

2010-10-20 Thread Pranav
On Oct 20, 5:24 pm, Steve Holden wrote: > On 10/20/2010 7:58 AM, Pranav wrote: > > > > > > > On Oct 20, 4:13 pm, Daniel Roseman wrote: > >> On Oct 20, 8:29 am, Pranav wrote: > > >>> I'm trying to display a table in template using the result retrieved > >>> from a query set, but i get problem w

Re: Expense of django query

2010-10-20 Thread Ed
Thanks for the suggestion. Javier's was exactly what I needed. The one question I have is why what is the purpose of ifchanged? I'm aware of the command but I don't see the purpose of it within a loop. On Oct 20, 5:18 am, Daniel Roseman wrote: > On Oct 19, 9:46 pm, Ed wrote: > > > > > > > Th

Re: DRY forms

2010-10-20 Thread S Basl
Apologies, I seem to have misunderstood the situation in my haste to be of assistance. I admit I'm no Django/Python whiz, more of a talented(?) dabbler. Maybe someone else can correct me, but it seems that save() will always hit the entire row if you use a single model. Does save(f It seems a bi

Re: Displaying a template table using a query set

2010-10-20 Thread Steve Holden
On 10/20/2010 7:58 AM, Pranav wrote: > > > On Oct 20, 4:13 pm, Daniel Roseman wrote: >> On Oct 20, 8:29 am, Pranav wrote: >> >> >> >> >> >>> I'm trying to display a table in template using the result retrieved >>> from a query set, but i get problem when i try to display the table >>> iterating

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
> > > It shouldn't happen, but it could. It's an office or it's a warehouse, > > people could work with the same user and/or (above all) people may > > work on the same machine...so they should pay attention on what they > > do...but even no. > > > Just an example when the problem can occurs: > >

Re: Displaying a template table using a query set

2010-10-20 Thread Pranav
On Oct 20, 4:13 pm, Daniel Roseman wrote: > On Oct 20, 8:29 am, Pranav wrote: > > > > > > > I'm trying to display a table in template using the result retrieved > > from a query set, but i get problem when i try to display the table > > iterating through each row'' and column'' > > > view file:

Re: Different logins in same browser session and login_required

2010-10-20 Thread Steve Holden
On 10/20/2010 5:20 AM, PyMan wrote: > > > On 20 Ott, 10:28, Daniel Roseman wrote: >> On Oct 20, 8:11 am, PyMan wrote: >> Firefox has long had its "profile" functionality. >> firefox -no-remote -ProfileManager >> You can create multiple firefox profiles, then run multiple instance

Re: Displaying a template table using a query set

2010-10-20 Thread Daniel Roseman
On Oct 20, 8:29 am, Pranav wrote: > I'm trying to display a table in template using the result retrieved > from a query set, but i get problem when i try to display the table > iterating through each row'' and column'' > > view file: > from django.shortcuts import get_object_or_404, render_to_resp

Re: login_required and new class based views

2010-10-20 Thread Russell Keith-Magee
2010/10/20 Łukasz Rekucki : > On 19 October 2010 19:06, Valentin Golev wrote: >> Hello, >> > 2) decorate the dispatch method. You need to turn login_required into > a method decorator first (Django should probably provide a tool for > this). Django does :-) It's called method_decorator. from dja

BrightonPy event: The Why and How of Automated Testing with Python and Django

2010-10-20 Thread Jamie Matthews
Hi all, I thought our next BrightonPy meeting might be of interest to this list: The Why and How of Automated Testing with Python and Django Jim Purbrick, Tuesday October 26, 2010, 19:30 at The Skiff http://brightonpy.org/meetings/2010-10-26/ Why do we write tests? How do we write them? What ki

Displaying a template table using a query set

2010-10-20 Thread Pranav
I'm trying to display a table in template using the result retrieved from a query set, but i get problem when i try to display the table iterating through each row'' and column'' view file: from django.shortcuts import get_object_or_404, render_to_response from models import Organization def star

distinct in autocomplete

2010-10-20 Thread alecx
Hello, how do I get only distinct values of that query in the autocomplete field: def autocomplete_techlastname(request): if request.GET.has_key('q'): tags = Item.objects.filter(techlastname__icontains=request.GET['q']) [:5] return HttpResponse('\n'.join(t

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
On 20 Ott, 10:28, Daniel Roseman wrote: > On Oct 20, 8:11 am, PyMan wrote: > > > > Firefox has long had its "profile" functionality. > > > > firefox -no-remote -ProfileManager > > > > You can create multiple firefox profiles, then run multiple instances of > > > firefox at once - so long as you

Re: Expense of django query

2010-10-20 Thread Daniel Roseman
On Oct 19, 9:46 pm, Ed wrote: > Thanks for the answers.  I thought that the view was already pulling > the data.  I didn't realize it gets pulled when called in the > template.  I was able to rewrite the view to provide the data more > efficiently. > > I have another related question on the topic

Re: Different logins in same browser session and login_required

2010-10-20 Thread Daniel Roseman
On Oct 20, 8:11 am, PyMan wrote: > > Firefox has long had its "profile" functionality. > > > firefox -no-remote -ProfileManager > > > You can create multiple firefox profiles, then run multiple instances of > > firefox at once - so long as you use different profiles for them.  A bit > > fiddly, bu

Re: DRY forms

2010-10-20 Thread simonty
I can't change the database design. Even if I could, that would still mean I would have to define a model and a modelform for each table, no? On Oct 20, 6:13 pm, srb...@gmail.com wrote: > Can you just break the table up into several tables connected with one-to-one > relations? Maybe look at the

Re: DRY forms

2010-10-20 Thread srbasl
Can you just break the table up into several tables connected with one-to-one relations? Maybe look at the model forms you're using the most as a guide for which fields to include in the new tables? Sent from my Verizon Wireless BlackBerry -Original Message- From: simonty Sender: django

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
> > Firefox has long had its "profile" functionality. > > firefox -no-remote -ProfileManager > > You can create multiple firefox profiles, then run multiple instances of > firefox at once - so long as you use different profiles for them.  A bit > fiddly, but obviously useful for development/testing