Re: ModelForm validation of foreign keys - extra database queries and performance bottleneck
I've already tried the select_related in my queryset. No change at all. >>Also keep in mind that Django (or any other framework) has no idea whether or not fields have "changed" in a form submission without pulling the original set of values to compare against, so expect the object to be pulled at least once on every request. The first query already retrieves the primary key of the original object, or the complete object if selected_related is added. Using select_related can keep things to a single query, and we should be good - it's the number of db queries that is executed which is drastically reducing the performance. I believe I'll need a custom version of the ModelChoiceField class. Op dinsdag 25 juli 2017 10:48:41 UTC+2 schreef James Schneider: > > > > On Jul 24, 2017 4:09 AM, "johan de taeye" > wrote: > > > I have a model that has a foreign key relation to a number of other > objects. > When saving an instance of this model from the admin (or a ModelForm), I > see plenty of extra and redundant database calls. > For a single record it wouldn't make much of a difference, but when using > the same ModeForm to do some batch upload these become the bottleneck in > the process. > > Has anyone bumped into the same performance bottleneck? > Has anyone developed some solution for this? > > By logging all database queries and some digging in the code, here's my > analysis of what is happening: > >1. Open the admin editing screen for a single record. >I leave all fields to the original value, except for a field (not one >of the foreign key fields) >2. When saving the record, the first query reads the existing record: > select field1, field2, field3, from mytable; >3. During the form/model validation, I get an extra database query for >each of the foreign key fields. >It is generated from the to_python method >of django.forms.models.ModelChoiceField: > select field_a, field_b, field_c, field, ... from related_table >where pk = 'id_from_first_query'; >4. During the form/model validation, I get another database query for >each of the foreign key fields. >It verifies that the values actually exists in the database: > select (1) from related_table where pk = 'value from form'; > > The queries in step 3 and 4 are redundant if the field hasn't changed. The > first query gives enough data to allow us to verify that the new form value > and the foreign key field on the existing instance are equal. I am using > django 1.11. > > The same queries, except 2, are executed when I create a new record. The > queries in step 4 are redundant then - we just retrieved the values from > the database. > > Looking forward to any insights and hints... > > > You should look at modifying the query set that your view is using to pull > the main object to include select_related() calls. I don't know if you're > using function -based views or class-based views, so I can't comment > further on implementation. > > https://docs.djangoproject.com/en/1.11/ref/models/querysets/#select-related > > The extra calls are likely occurring when the related fields are being > accessed during validation, etc. > > Also keep in mind that Django (or any other framework) has no idea whether > or not fields have "changed" in a form submission without pulling the > original set of values to compare against, so expect the object to be > pulled at least once on every request. > > -James > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5cc0b017-2759-4026-ab6e-41f5a6cb3dd3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ModelForm validation of foreign keys - extra database queries and performance bottleneck
I have a model that has a foreign key relation to a number of other objects. When saving an instance of this model from the admin (or a ModelForm), I see plenty of extra and redundant database calls. For a single record it wouldn't make much of a difference, but when using the same ModeForm to do some batch upload these become the bottleneck in the process. Has anyone bumped into the same performance bottleneck? Has anyone developed some solution for this? By logging all database queries and some digging in the code, here's my analysis of what is happening: 1. Open the admin editing screen for a single record. I leave all fields to the original value, except for a field (not one of the foreign key fields) 2. When saving the record, the first query reads the existing record: select field1, field2, field3, from mytable; 3. During the form/model validation, I get an extra database query for each of the foreign key fields. It is generated from the to_python method of django.forms.models.ModelChoiceField: select field_a, field_b, field_c, field, ... from related_table where pk = 'id_from_first_query'; 4. During the form/model validation, I get another database query for each of the foreign key fields. It verifies that the values actually exists in the database: select (1) from related_table where pk = 'value from form'; The queries in step 3 and 4 are redundant if the field hasn't changed. The first query gives enough data to allow us to verify that the new form value and the foreign key field on the existing instance are equal. I am using django 1.11. The same queries, except 2, are executed when I create a new record. The queries in step 4 are redundant then - we just retrieved the values from the database. Looking forward to any insights and hints... Johan -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/48bfca91-8750-4ad0-9c50-1ffc3c2fdb5f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
RE: py2exe + Django 1.6
Here’s a revised patch. The previous patch addresses the issue with commands, but I needed some additional things to get things up and running with py2exe. If it helps, you can download the installer of my application at http://sourceforge.net/projects/frepple/files/ and browse all source code at https://github.com/jdetaeye/frePPLe Johan From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Antonio Francisco Martín Romero Sent: Thursday, April 10, 2014 5:46 PM To: django-users@googlegroups.com Subject: Re: py2exe + Django 1.6 Thank you very much. I can see the commands but I get an error when I try to run one. I have attached my manage.py file. See below the errors >manage.exe shell Traceback (most recent call last): File "manage.py", line 28, in File "django\core\management\__init__.pyc", line 365, in execute_from_command_ line File "django\core\management\__init__.pyc", line 358, in execute File "django\core\management\base.pyc", line 242, in run_from_argv File "django\core\management\base.pyc", line 280, in execute File "django\utils\translation\__init__.pyc", line 130, in activate File "django\utils\translation\trans_real.pyc", line 188, in activate File "django\utils\translation\trans_real.pyc", line 178, in translation File "django\utils\translation\trans_real.pyc", line 146, in _fetch AttributeError: 'NoneType' object has no attribute '_info' Cheers On Thursday, April 10, 2014 2:29:38 PM UTC+1, johan de taeye wrote: This is very old issue in Django: see ticket https://code.djangoproject.com/ticket/8280 I've attached the patch I'm already using for years to package my django application with py2exe. I don't understand why the core team continues to use the current un-pythonic code to discover commands and fails to merge any of the fixes that have been proposed. Johan Op donderdag 10 april 2014 14:19:19 UTC+2 schreef Antonio Francisco Martín Romero: Hi everyone, I was using py2exe + Django 1.3 without problems. From Django 1.4 the way to find the commands changed and it tries to find .py files as you can see in the find_commands() function in the file core/management/__init__.py . When you compile Django using py2exe, your don't have .py files, just .pyc and manage.exe won't have any command. I have tried to modify the find_command() function but the result was negative. Also, I have tried to run commands manually but the functions try to find .py files as well. Did anyone manage to do it? Cheers -- You received this message because you are subscribed to a topic in the Google Groups "Django users" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/dRQ8owj0myU/unsubscribe. To unsubscribe from this group and all its topics, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/22a72b73-76a0-4730-bbf8-2c1e0d79bee8%40googlegroups.com <https://groups.google.com/d/msgid/django-users/22a72b73-76a0-4730-bbf8-2c1e0d79bee8%40googlegroups.com?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00c101cf54dc%24686dd340%24394979c0%24%40gmail.com. For more options, visit https://groups.google.com/d/optout. django_py2exe.patch Description: Binary data
Re: py2exe + Django 1.6
This is very old issue in Django: see ticket https://code.djangoproject.com/ticket/8280 I've attached the patch I'm already using for years to package my django application with py2exe. I don't understand why the core team continues to use the current un-pythonic code to discover commands and fails to merge any of the fixes that have been proposed. Johan Op donderdag 10 april 2014 14:19:19 UTC+2 schreef Antonio Francisco Martín Romero: > > Hi everyone, > > I was using py2exe + Django 1.3 without problems. From Django 1.4 the way > to find the commands changed and it tries to find .py files as you can see > in the find_commands() function in the file core/management/__init__.py . > When you compile Django using py2exe, your don't have .py files, just .pyc > and manage.exe won't have any command. I have tried to modify the > find_command() function but the result was negative. Also, I have tried to > run commands manually but the functions try to find .py files as well. > > Did anyone manage to do it? > > Cheers > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/71e4944c-0b0c-4939-8514-10da0a4d667e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. django/core/management/__init__.py | 62 +- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 5b0ad6c..62f0796 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -3,11 +3,14 @@ import os import sys from optparse import OptionParser, NO_DEFAULT import imp +import warnings +from pkgutil import iter_modules from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError, handle_default_options from django.core.management.color import color_style from django.utils.importlib import import_module +from django.utils._os import upath from django.utils import six # For backwards compatibility: get_version() used to be in this module. @@ -17,54 +20,18 @@ from django import get_version # doesn't have to reload every time it's called. _commands = None -def find_commands(management_dir): +def find_commands(app_name): """ -Given a path to a management directory, returns a list of all the command -names that are available. +Given an application name, returns a list of all the commands found. -Returns an empty list if no commands are defined. +Raises ImportError if no commands are defined. """ -command_dir = os.path.join(management_dir, 'commands') -try: -return [f[:-3] for f in os.listdir(command_dir) -if not f.startswith('_') and f.endswith('.py')] -except OSError: -return [] - -def find_management_module(app_name): -""" -Determines the path to the management module for the given app_name, -without actually importing the application or the management module. - -Raises ImportError if the management module cannot be found for any reason. -""" -parts = app_name.split('.') -parts.append('management') -parts.reverse() -part = parts.pop() -path = None - -# When using manage.py, the project module is added to the path, -# loaded, then removed from the path. This means that -# testproject.testapp.models can be loaded in future, even if -# testproject isn't in the path. When looking for the management -# module, we need look for the case where the project name is part -# of the app_name but the project directory itself isn't on the path. -try: -f, path, descr = imp.find_module(part, path) -except ImportError as e: -if os.path.basename(os.getcwd()) != part: -raise e -else: -if f: -f.close() - -while parts: -part = parts.pop() -f, path, descr = imp.find_module(part, [path] if path else None) -if f: -f.close() -return path +packages = {} +mgmt_package = "%s.management.commands" % app_name +# The next line imports the *package*, not all modules in the package +__import__(mgmt_package) +path = getattr(sys.modules[mgmt_package], '__path__', None) +return [i[1] for i in iter_modules(path)] def load_command_class(app_name, name): """ @@ -99,7 +66,7 @@ def get_commands(): """ global _commands if _commands is None: -_commands = dict([(name, 'django.core') for name in find_commands(__path__[0])]) +_commands = dict([(
Re: Multi-db: is database routing per request possible?
Russ, Your gut feeling confirms my suspicion. Changing the lines to the following fixes my problem: db = model_instance._state.db if db is None: db = router.db_for_write(model_instance.__class__, instance=model_instance) qs = self.rel.to._default_manager.using(db).filter(**{self.rel.field_name:value}) The validation of many2many fields (further down in the same file) has a similar issue and would need fixing too. I'll file a bug on the topic. I somehow feel a bit uncomfortable with this approach: the formfield constructor accepts the "using" argument to direct the queries to a database, but since the validation is model-based (not form-based) that info is not used in validation. You rely on guess-work like the above or on the fact that the routing logic is in sync with the "using" argument you provided. This can't be DRY... Regards, Johan On Jun 16, 2:25 am, Russell Keith-Magee wrote: > On Tue, Jun 15, 2010 at 9:11 PM, johan de taeye > > > > wrote: > > >> You can't do this with a router; as you've noted, the router doesn't > >> have any information about the request in which it is being used. > > >> However, you could do it by manually requesting your database > >> connection whenever you use the database. For example: > > >> Author.objects.using('otherdb').filter(...) > > >> will perform a query that is guaranteed to operate on the 'otherdb', > >> regardless of what the router says. > > > I was able to get this part working fine. Since most views are based > > on a reuable generic one this was pretty easy to do anyway. > > > Getting ModelForms (or ModelAdmin) to work with foreign keys is a > > different story: When the form/model is validated, the field value is > > searched in the source table to verify the key exists. This lookup > > uses the _default_manager (see code below), which isn't aware of the > > request any more and always checks on the default database (unless I > > can route it). As a result I always get a validation error on the > > form. > > > Looks like I need a patched/smarter RelatedField that is aware of the > > database to look in? > > You're in somewhat uncharted territory here, so I can't give you a > simple prepared answer. However, you certainly appear to be on the > right track. > > It's also possible that you've discovered an edge case bug -- looking > at the code, my gut tells me that the _default_manager call should be > forced onto the same database as model_instance - i.e., the query > should be: > > db = router.db_for_read(self.rel.to, instance=model_instance) > qs = > self.re.to._default_manager.using(db).filter(**self.rel.field_name:value}) > > or similar. I'd need to do more tests to confirm this, though. Feel > free to log a bug if you can reduce this to a test case that > demonstrates that this is indeed a bug. > > Yours, > Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Multi-db: is database routing per request possible?
> You can't do this with a router; as you've noted, the router doesn't > have any information about the request in which it is being used. > > However, you could do it by manually requesting your database > connection whenever you use the database. For example: > > Author.objects.using('otherdb').filter(...) > > will perform a query that is guaranteed to operate on the 'otherdb', > regardless of what the router says. I was able to get this part working fine. Since most views are based on a reuable generic one this was pretty easy to do anyway. Getting ModelForms (or ModelAdmin) to work with foreign keys is a different story: When the form/model is validated, the field value is searched in the source table to verify the key exists. This lookup uses the _default_manager (see code below), which isn't aware of the request any more and always checks on the default database (unless I can route it). As a result I always get a validation error on the form. Looks like I need a patched/smarter RelatedField that is aware of the database to look in? Regards, Johan Snippet from django/db/models/fields/related.py: class ForeignKey(RelatedField, Field): ... def validate(self, value, model_instance): if self.rel.parent_link: return super(ForeignKey, self).validate(value, model_instance) if value is None: return qs = self.rel.to._default_manager.filter(**{self.rel.field_name:value}) ALWAYS CHECKS IN DEFAULT DATABASE qs = qs.complex_filter(self.rel.limit_choices_to) if not qs.exists(): raise exceptions.ValidationError(self.error_messages['invalid'] % { 'model': self.rel.to._meta.verbose_name, 'pk': value}) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Multi-db: is database routing per request possible?
Hello, In my application a number of databases are configured with identical schemas. >From a dropdown box on the screen, the user selects the database he/ she wants to work with. The selected database is stored on the cookie. An object with the same primary key can be created in each schema by the user. The above means objects can't be routed to the correct database based on their primary key. Only by looking at the request I know what database is required. >From the documentation (and after digging a bit in the code) I think the database router concept doesn't support this type of usage. Is this possible somehow? Is it feasible to pass the request as a hint to the router somehow? All feedback appreciated... Johan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Queryset filtering based on user supplied callable??
Typo... The correct syntax is : obj_list = [ i for i in MyObject.objects.all() if my_filter(i) ] On Jun 5, 4:29 pm, johan de taeye wrote: > Possible through basic Python: > > obj_list = [ i for i in MyObject.objects.all() where my_filter(i) ] > > Note that this filtering is happening on the Python side of things, > whereas a queryset filter is executed in SQL on the database. The > filtering on the database is normally much, much faster, so be careful > with the python-style filtering... > > Johan > > On Jun 5, 12:32 pm, Joakim Hove wrote: > > > > > Hello, > > > I have a query list which I want to filter based on a computation > > which I supply: > > > # Create a query set containing everything: > > obj_list = MyObject.objects.all() > > > # Now - select only the element which pass some test: > > obj_list = obj_list.filter( my_filter ) > > > def my_filter( obj ): > > # Does a computation based on obj values, and returns true or > > false > > > > return true|false > > > Is something like this doable? > > > Joakim- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Queryset filtering based on user supplied callable??
Possible through basic Python: obj_list = [ i for i in MyObject.objects.all() where my_filter(i) ] Note that this filtering is happening on the Python side of things, whereas a queryset filter is executed in SQL on the database. The filtering on the database is normally much, much faster, so be careful with the python-style filtering... Johan On Jun 5, 12:32 pm, Joakim Hove wrote: > Hello, > > I have a query list which I want to filter based on a computation > which I supply: > > # Create a query set containing everything: > obj_list = MyObject.objects.all() > > # Now - select only the element which pass some test: > obj_list = obj_list.filter( my_filter ) > > def my_filter( obj ): > # Does a computation based on obj values, and returns true or > false > > return true|false > > Is something like this doable? > > Joakim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: CSS not working in exe
For my frePPle project, I have been using py2exe to package a standalone django application. See here for my manage.py script: http://frepple.svn.sourceforge.net/viewvc/frepple/trunk/contrib/installer/manage.py?revision=640&view=markup Here's a patch for the django code to make also the django commands work with the zip-file created by py2exe: http://code.djangoproject.com/ticket/5825 unfortunately not marked for the 1.0 release :-( Johan On 20 jun, 19:10, Molly <[EMAIL PROTECTED]> wrote: > Thanks for that tip, Chris! I have been wondering about that actually. > > I think I am going to switch to Apache, because I have been having a > lot of trouble with the exe. > > Thanks for the help, I aprreciate it :) > > Molly > > On Jun 20, 10:56 am, chris vigelius <[EMAIL PROTECTED]> > wrote: > > > > > Hi Molly, > > > please consider using dpaste.com or similar for posting long code examples. > > Not only does this reduce list traffic, but you'll get syntax coloring and > > readable formatting, too... > > > On to your question: > > I must admit I never used py2exe, so my advice may be misguided, but > > shouldn't > > this list > > > > data_files = [(".", [r"C:\dev\incidents\db.sqlite3"]), > > > (r".\templates\admin", > > > glob.glob(r"C:\Python25\Lib\site-packages > > > \django\contrib\admin\templates\admin\*.*")), > > > (r".\templates\admin\auth\user", > > > glob.glob(r"C:\Python25\Libsite- > > > packages\django\contrib\admin\templates\admin\auth\user\*.*")), > > > -~--~~~~--~~--~--~--- > > > somehow refer to C:\dev\incidents\media\, where you seem to store your > > actual > > media files? If this "data_files" property does what I think it does, then > > you import admin media from site-packages, but not your own media files. And > > btw, there's a backslash missing in the third line, too. > > > hth, > > chris- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to compare between two attributes of the model?
An extra clause allows you to do this: Project.objects.extra(where=['expected_start_date > actual_start_date']) On Feb 23, 8:16 am, shabda <[EMAIL PROTECTED]> wrote: > I have a model like, > > class Project(models.Model): > name = models.CharField() > expected_start_date = models.DateField() > actual_start_date = models.DateField() > > I want to translate the SQL query, > SELECT * FROM project WHERE expected_start_date > actual_start_date, > > I cant do something like > Project.objects.filter( expected_start_date__gt = > actual_start_date), so how can I translate the above sql query? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to speed up objects saving
Alex, For this kind of "bulky transfer" the overhead created by the ORM will always be a performance bottleneck: you continuously create and destroy complex python objects. Where/if possible, resort to raw SQL: you could eg use an execute_many statement. Expect a performance improvement of x5 - x10... My 2 cents, Johan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: py2app & py2exe
Marcio, >>What is the status of this issue now? Anyone found a solution? Yes, using py2exe for packaging a django application sure is possible. Based on my py2exe+django experience with frePPLe [1]: 1) py2exe is an excellent way to package a django application in a simple and straightforward way: With no database, no web server and no python to install, it is very simple for a user to install and testdrive the software. 2) For production use, I would not recommend deploying such a django py2exe application. Django is designed to be a web application framework, not a desktop application framework. For desktop applications in python, use a gui toolkit instead: http://wiki.python.org/moin/GuiProgramming >>I tried a very simple py2app setup but stoped at the question of >>calling "python manage.py runserver" from my starting script. >>execfile() doesn't allow arguments ("runserver"). Any suggestion? Django's development server is single threaded, and not a good choice for your app. Have a look at cherrypy or DjangoCerise. And here's the 'runserver' script I use for the frePPLe py2exe application: http://frepple.svn.sourceforge.net/viewvc/frepple/trunk/contrib/installer/runserver.py?revision=511&view=markup Regards, Johan [1] www.frepple.com On Oct 19, 3:43 pm, ArqEco <[EMAIL PROTECTED]> wrote: > Hello friends, > > "The Story That Won't Go Away" comes back! > > I am a newcomer to Django and just read some posts from one year ago > about creating standalone programs with Django and py2app or py2exe. > > What is the status of this issue now? Anyone found a solution? > > I need to develop a very simple issue tracker and (non-software) > project management application to be used for a small team of up to > five members. > > The application is being designed to be installed on desktop and > notebook computers (where it will be used out of the office > [offline]), and will have a synchronization feature. > > I think that even the built in Django development server would be fine > to me. > > I tried a very simple py2app setup but stoped at the question of > calling "python manage.py runserver" from my starting script. > execfile() doesn't allow arguments ("runserver"). Any suggestion? > > These are newcomer questions but I am not a professional developer. > > Thank you for your patience :-) > > Márcio --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: OT: How did you handle asynchronous tasks?
David, It's a very common requirement, and some people have run into this before. Have a look at this: http://code.google.com/p/django-queue-service/ I doubt if this 'll be as robust and reliable as a real messaging product, but for simple setups it'ld do the trick. Johan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: something I really don't know in using manage.py shell
I suspect you get this error because "level" is a reserved keyword in many databases. Try renaming the field. Johan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How can I re-use the filtering and sorting from the admin pages in my view?
Ben, Vince, Thanks for the input! It confirms what I suspected after a brief scan through the admin doc and the code. Johan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How can I re-use the filtering and sorting from the admin pages in my view?
Folks, Any thoughts on how I can implement the following elegantly in Django? A first table contains let's say "product" records, which have a bunch of attributes on which the admin pages provide filtering and sorting. A second table contains "sales" records, which have a field referring to the "product". Now I want to create a page "product sales per month" which shows a table with the sales of a product, bucketized per month. My first-pass implementation is a raw SQL query in a custom view and template. It works fine but it doesn't have the same sorting and filtering capabilities as the "product" list in the admin ui. Is there a way to achieve the same in better django-style, and re- using the admin capabilities in my custom view and template? All feedback highly appreciated! Johan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---