Re: Work in memory instead of BD, how to?

2011-08-18 Thread Kejun He
May be you can try database long connection. On Fri, Aug 19, 2011 at 10:44 AM, Andre Terra wrote: > I think a better solution would be to use a store rather than cache > (protip: redis) and, if the calculations are lengthy, write a > 'publish' function that writes them to

Django admin site and DEBUG flag.

2011-08-18 Thread KC LEE
When I set DEBUG flag true, Django admin site works fine. But when I change it to false, it throws me the page not found in Django admin site (except main page of admin site, Groups page, and Users page) Anyone help? -- You received this message because you are subscribed to the Google Groups

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Andre Terra
You can't map python processes to users. It's simply not how it works. This is the web on the 21st century, rethink your concepts instead of trying to fit them on to a completely different paradigm. Change is good. Embrace it. Cheers, AT On 8/18/11, michael kapelko wrote:

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Andre Terra
I think a better solution would be to use a store rather than cache (protip: redis) and, if the calculations are lengthy, write a 'publish' function that writes them to the store and let the user choose when to see the changes in the results appear on the website. Additionally, add a 'modified

Re: Best approach to handling different types of Users

2011-08-18 Thread Andre Terra
Until you install some third party app that accesses User.objects.all() and then suddenly nothing works as it's supposed to. You can access the User object from its related UserProfile instance and do everything you say from there instead of breaking the convention. Nobody's stopping you from

how to view and add related objects on both sides of an m2m field in admin

2011-08-18 Thread br
It seems that by definition, an M2M field is basically symettrical, at least underneath. However, I'm having trouble figuring out how to access and set M2M fields in the Django Admin via the Model that doesn't declare the M2M. Here is the example I've been working with to try to figure it out:

Re: problem with a graph image in template

2011-08-18 Thread smartaz
Hi, thank you for your response It seems that there is an error when I asked for help in google translation i have a form two views: plot(request) who return an httpresponse and showgraph(request) who return a template (affichage.html) call the function plot(request) in my views and return an

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread michael kapelko
I think about 50 users, but Django for each sounds too much. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

Re: Best approach to handling different types of Users

2011-08-18 Thread Matt Schinckel
Lately, I have been looking at using subclasses of auth.User as a way of segmenting users. This appears (to me, at this stage, anyway) to have several advantages over using the UserProfile approach. * You can have extra attributes on the subclass. For instance, one set of users belong to a

Re: Django Not Populating AutoField

2011-08-18 Thread Shawn Milochik
As defined your id field doesn't differ from Django's default. Just get rid of your custom id field. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this

Re: models.py datetimefield mysql datetime problem

2011-08-18 Thread furiston
ok guys, no need any help, i have solved it. it was all about altering the database with manage.py sql ... i did the procedure from beginning, it automatically solved. thanks On Aug 19, 2:51 am, furiston wrote: > i could not recognize the problem when i add a datetimefield

Re: Anyone use mod_security with Django?

2011-08-18 Thread Reinout van Rees
On 18-08-11 22:42, Shawn Milochik wrote: This was actually discussed in a talk by Adam Baldwin at DjangoCon 2010: http://www.ngenuity-is.com/blog/2010/sep/10/pony-pwning-djangocon-2010/ Ah, that's useful! I don't believe it's a good idea at all to disregard something like mod_security just

Django Not Populating AutoField

2011-08-18 Thread Lee Hughes
In my model I have id = models.AutoField(primary_key=True) but upon saving a new record I get null value in column "id" violates not-null constraint I suspect this may be caused by my overriding save_model in admin.py to populate timestamp fields: def save_model(self, request, obj, form,

models.py datetimefield mysql datetime problem

2011-08-18 Thread furiston
i could not recognize the problem when i add a datetimefield to my model i can't get that model on admin page. i use mysql. without datetimefield it works. but when comes to add datetimefield to the model it stucks i get that error message. (ok. i didn't create 500.html, but i will :)) Traceback

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Felipe Arruda
Humm, I see, the second case I could make out of it somehow(just have some doubts in 2.5: How am I supposed to do this?) The first one I could't see how I'm not going to lose the changes, done in cache. My biggest problem is in altering some value in some models, since this operation will be done

How to display an AutoField primary key on Admin change list and edit form?

2011-08-18 Thread Lee Hughes
My existing database schema has a primary key field named "id" in every table. I want to have Django Admin automatically populate this field and display it in read-only mode in both the change list and edit form. Because the field name is "id", I understand that this will automatically be

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Gelonida N
How many different users are connected at the same time? Would it be feasable to start one django prcoess for each connected user? On 08/18/2011 11:55 AM, michael kapelko wrote: > I think I have to emulate Delphi app with a server process, and make > Django interact with the process. The

Re: Best way to show/hide the logout link in a template?

2011-08-18 Thread Andre Lopes
Thanks Kev, It was exactly what I needed. Regards, On Thu, Aug 18, 2011 at 10:45 PM, Kev Dwyer wrote: > Andre Lopes wrote: > >> Hi, >> >> I am new to Django... I have made a logout link, but now I am in doubt >> on which the best way to show/hide this template tag: >>

Re: Best way to show/hide the logout link in a template?

2011-08-18 Thread Kev Dwyer
Andre Lopes wrote: > Hi, > > I am new to Django... I have made a logout link, but now I am in doubt > on which the best way to show/hide this template tag: > > [code] > Logout > [/code] > > Which is the best way of show/hide this link? > > Sorry if it is a basic question. > > > Best

Recursive Relation in django-taggit

2011-08-18 Thread Eyad Al-Sibai
I have created the following TagBase and each category can have subcategory... Will this work? How can I override its add function in the TaggableManager? class Category(TagBase): parent = models.ForeignKey('self', blank=True, null=True,

Best way to show/hide the logout link in a template?

2011-08-18 Thread Andre Lopes
Hi, I am new to Django... I have made a logout link, but now I am in doubt on which the best way to show/hide this template tag: [code] Logout [/code] Which is the best way of show/hide this link? Sorry if it is a basic question. Best Regards, -- You received this message because you are

Django reloader fails to watch all the project files

2011-08-18 Thread rwman
Hi. I bumped into a problem with djnago autoreloader (using standard runserver command) recently - when i update my views.py file it does not reload the server automatically. (while it does, if i update my project's settings.py file) Looking at the code (django/utils/autoreload.py) - i

Re: Anyone use mod_security with Django?

2011-08-18 Thread Shawn Milochik
This was actually discussed in a talk by Adam Baldwin at DjangoCon 2010: http://www.ngenuity-is.com/blog/2010/sep/10/pony-pwning-djangocon-2010/ I don't believe it's a good idea at all to disregard something like mod_security just because we're using Django, because mod_security isn't

Re: Anyone use mod_security with Django?

2011-08-18 Thread Reinout van Rees
On 18-08-11 18:35, KC LEE wrote: Hi, I am running a website built with Django. For security, I am going to install mod_security on my web server. Anyone use mod_security with Django? Is mod_security useful? I heard that Django can defend many attacks (like csrf, XSS, SQL

Re: How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread Shawn Milochik
On 08/18/2011 04:22 PM, Mike Seidle wrote: When I started with Django, I ran into the same issue... seemed kind of silly that we had this amazing framework that did so much but it had no way to really alter tables... Enter South. South works pretty well, but if you roll your own ModelFields

Re: 'dict' object has no attribute 'META'

2011-08-18 Thread Reinout van Rees
On 18-08-11 17:44, MikeKJ wrote: 'dict' object has no attribute 'META' ... ▶ Local vars /var/www/django/eco/django/core/context_processors.py in debug if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: ... Apparently the request is now

Re: How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread Mike Seidle
On Thursday, August 18, 2011 12:03:00 pm smith jack wrote: > at last, i use command python manage.py syncdb > > but was suprised to find that the schema of url table in the database > is not changed > > so is there any method to change the shcema of table using django command? When I started

Re: problem with a grph image in template

2011-08-18 Thread Reinout van Rees
On 17-08-11 21:32, smartaz wrote: if I call this view for an url: (r $' ^plot / image.png ', 'contact ') which comes from a form where I put {% csrf_token %} the graph is correctly displayed as picture in a page html http: // 127.0.0.1:8000 / graphs / contact / image.png That url doesn't

Re: 'dict' object has no attribute 'META'

2011-08-18 Thread Daniel Roseman
On Thursday, 18 August 2011 16:44:51 UTC+1, MikeKJ wrote: > > > I have this old site that was originally pre magic and got ported up 0.96 > where it still is and now have to make some alterations, this is a clone > site to do something different but the same BUT on getting to the > subsubcategory

Re: Anyone use mod_security with Django?

2011-08-18 Thread vikas ruhil
I am also looking for the same HELP ANYONE? On Thu, Aug 18, 2011 at 10:05 PM, KC LEE wrote: > Hi, > > I am running a website built with Django. > > For security, I am going to install mod_security on my web server. > > Anyone use mod_security with Django? Is mod_security

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Doug Ballance
You probably don't want to cache changes. Or if you do, it would be better done elsewhere (like a caching raid controller/w battery on your database machine). The usual cache patterns I've seen are: 1) Fetch from database 2) Store in cache with a reasonable timeout to that changes are reflected

Re: How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread Shawn Milochik
As was mentioned previously, South is the best solution in Django at this time. south.aeracode.org The docs are good, there's a Google Group you can join, and plenty of people on this list use it all the time and can help with it. Shawn -- You received this message because you are

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Felipe Arruda
Ok, so I've read this topics(and also the django-cache-utils, although I didn't understand this one much). So I can serialize the objects and save them in cache, ok, but, when the cache timesout I'll lose the data that was changed and saved in the cache, isn't it? Is there a way to to this in the

Anyone use mod_security with Django?

2011-08-18 Thread KC LEE
Hi, I am running a website built with Django. For security, I am going to install mod_security on my web server. Anyone use mod_security with Django? Is mod_security useful? I heard that Django can defend many attacks (like csrf, XSS, SQL Injection... and so on...) -- You received this

Re: GenericIPAddressField validation error not translated

2011-08-18 Thread Andre Terra
https://docs.djangoproject.com/en/dev/internals/contributing/translations/ On Thu, Aug 18, 2011 at 12:28 PM, Federico Capoano wrote: > How can I contribute? > > > On Aug 13, 6:50 am, Karen Tracey wrote: > > On Thu, Aug 11, 2011 at 2:58 PM,

Re: Getting and modifying url parameters in template: howto?

2011-08-18 Thread Andre Terra
Assuming I understood what you're trying to do, why not write a template tag (more specifically, an inclusion tag)? Cheers, AT On Thu, Aug 18, 2011 at 11:47 AM, samuele.mattiuzzo wrote: > I'm not using haystack, since is strictly model-related. My solr > instance isnt'

Re: How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread MikeKJ
Another alternative would be to access mysql from a shell and add the column to the relevant table mysql>> alter table x add column hits int(11) null; for example thinke365 wrote: > > for example at first i have a model named url, the code is as follows: > > class url(models.Model): >

Re: RPC for python functions in a Django project

2011-08-18 Thread David
I'm the developer of rpc4django. The package does support SMD generation and it makes it available in the system.describe() method by default. However, JSONRPC is not nearly as well defined as XMLRPC and nobody seems to agree exactly how an SMD should look let alone what SMD even stands for. I

Re: How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread delegbede
What I do is remove the database and them run the syncdb command again. Some people might recommend migrations using South. Regards. Sent from my BlackBerry wireless device from MTN -Original Message- From: smith jack Sender: django-users@googlegroups.com Date:

How to change the schma of database using python manage.py syncdb?

2011-08-18 Thread smith jack
for example at first i have a model named url, the code is as follows: class url(models.Model): link=models.URLField(unique=True) then i change this class as follows: class url(models.Model): link=models.URLField(unique=True) hits=models.IntegerField() at last, i use command

'dict' object has no attribute 'META'

2011-08-18 Thread MikeKJ
I have this old site that was originally pre magic and got ported up 0.96 where it still is and now have to make some alterations, this is a clone site to do something different but the same BUT on getting to the subsubcategory level (sorry my naming conventions back then really sucked) I am

Re: GenericIPAddressField validation error not translated

2011-08-18 Thread Federico Capoano
How can I contribute? On Aug 13, 6:50 am, Karen Tracey wrote: > On Thu, Aug 11, 2011 at 2:58 PM, Federico Capoano > wrote: > > > Hi all, > > > i'm using the new GenericIPAddressField and validation errors are not > > translated to the language of my

Re: Getting and modifying url parameters in template: howto?

2011-08-18 Thread samuele.mattiuzzo
I'm not using haystack, since is strictly model-related. My solr instance isnt' bound to any model (since i don't use any backend DB to store my data) i need something like get_full_path or get_absolute_url, but not modell-related in this case... On 18 Ago, 16:37, Andre Terra

Re: Getting and modifying url parameters in template: howto?

2011-08-18 Thread Andre Terra
Searching with Django = http://haystacksearch.org/ Behold the power of pluggable apps. Cheers, AT On Thu, Aug 18, 2011 at 11:34 AM, samuele.mattiuzzo wrote: > Hi! > I'm stuck with a problem... more confused than stuck, actually. > > I have a search engine i'm working on,

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Andre Terra
You can use the cache framework for pretty much anything you want, including saving serialized results of calculations, querysets and whatnot. Please read: https://docs.djangoproject.com/en/dev/topics/cache/ https://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api

Getting and modifying url parameters in template: howto?

2011-08-18 Thread samuele.mattiuzzo
Hi! I'm stuck with a problem... more confused than stuck, actually. I have a search engine i'm working on, and we're using GET method to perform searches. In the listing page, i have my search results on the left and some filters on the right, something like google's filter. my filters are all

Re: RPC for python functions in a Django project

2011-08-18 Thread Muhammad Choudry
Thanks! This module didn't come across in my search. I just skimmed through the files and it seems as if the module doesn't support automatic SMD generation. Is this true? On Aug 17, 5:43 pm, Gelonida N wrote: > Hi Muhammad, > > On 08/17/2011 08:18 PM,

Re: m2m assignments lost when saving in admin but not shell

2011-08-18 Thread Shawn Milochik
On 08/18/2011 09:24 AM, Andre Terra wrote: Your instance is probably not yet saved to the database, so the m2m-related objects don't know which instance to connect to. There's problem something wrong in your save() method. I often use "assert False, some_var" to check if at some point the

Re: help error in form usage

2011-08-18 Thread Derek
The Django Book is a useful general introduction; but now more than 2 years old. In a framework like Django, which is under constant development, such old information gets out-of-date very fast. Tom correctly pointed you to the docs; and that is really the best place to work from now that you

Work in memory instead of BD, how to?

2011-08-18 Thread Felipe Arruda
Hi there, I was doing some project recently and faced a problem of performance. I need to be able to do a lot of access to some information on the DB, almost all the time, and doing so seams to be taking too long. Is it possible do do something like this: Get the infos from the BD and put them in

Re: m2m assignments lost when saving in admin but not shell

2011-08-18 Thread Andre Terra
Your instance is probably not yet saved to the database, so the m2m-related objects don't know which instance to connect to. There's problem something wrong in your save() method. I often use "assert False, some_var" to check if at some point the variable is already set or not. And I get the same

Re: Best approach to handling different types of Users

2011-08-18 Thread Andre Terra
Do create a UserProfile with an FK to user, but add an FK to Group as well. This way you can take advantage of the existing Permissions application which would allow/deny users access to various parts of your application. Just make sure your views take those permissions into consideration!

Re: Best approach to handling different types of Users

2011-08-18 Thread dfolland
Try using "Groups" that is part of the Django user authentication. https://docs.djangoproject.com/en/dev/topics/auth/ On Aug 18, 6:56 am, Cameron wrote: > Hi, I'm wondering if anyone can help shed some light on the best > approach is too creating different Users. I'm

Best approach to handling different types of Users

2011-08-18 Thread Cameron
Hi, I'm wondering if anyone can help shed some light on the best approach is too creating different Users. I'm trying to make a online shop, that features two types of Users, "Customers" and "Merchants". The power of each Users vary greatly, Customers can buy items from Merchants and Merchants can

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Fabrizio Mancini
On 18 August 2011 11:55, michael kapelko wrote: > I think I have to emulate Delphi app with a server process, and make > Django interact with the process. The process can login to DB > directly. That's not so easy, but I guess that's the only option here > - move Delphi app

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread michael kapelko
I think I have to emulate Delphi app with a server process, and make Django interact with the process. The process can login to DB directly. That's not so easy, but I guess that's the only option here - move Delphi app from client machine to server one. -- You received this message because you

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread bruno desthuilliers
On 18 août, 08:15, Jirka Vejrazka wrote: > I can't see how you could change Django easily. You could experiment > with creating settings dynamically and closing DB connection just > before user logs in (Django can open it again when it needs it) to use > your "dynamic"

Re: m2m assignments lost when saving in admin but not shell

2011-08-18 Thread Tom Evans
On Thu, Aug 18, 2011 at 4:44 AM, Shawn Milochik wrote: > I have some code that modifies related items when a model is saved. I've > tried this by both using a post_save signal and by putting the code directly > in a save() override. > > When I save an instance in the Django

Re: How to load data from local static path in templates (security error)

2011-08-18 Thread Tom Evans
On Wed, Aug 17, 2011 at 8:39 PM, Daniel Roseman wrote: > On Wednesday, 17 August 2011 19:00:13 UTC+1, Adam Zedan wrote: >> >> Hi it seems I cant access data from local static paths such as >> c:\\somefolder\somefile.gif in my templates when I enter the url >> the code for

Re: Performance of process_template_response for corporate branding

2011-08-18 Thread Nathan Hoad
To answer my own question; I performed some tests with the Apache benchmarking tool. I performed 5000 requests over 10 threads to a local server running lighttpd with FastCGI, multiple passes over a few hours, with my middleware disabled for one pass and disabled for another. The passes were

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Kejun He
hi, I had a same problem as you before, and I spent much of time on it, but could not get it goal. And the DATAVASES in settings.py is loaded when the server running. If you can let the project reload the settings, you may resolve the problem. Or you can use MySQLdb to do it. Sometimes we can

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Jirka Vejrazka
> I.e. I want to set up database connection after Django app has started > *when I want it*. > Is there a way to do it? No. At least not easily. Django is a web framework and is expected to run on a web/application server with a single-user connection to a target database. That's typical for web