Re: Error
Greetings Bruxo, I do not speak Portuguese but being Italian I understood more or less your post. It seems you included "django.contrib.blog" in settings.py, but there is no "blog" module inside django.contrib. If "blog" is the name of the module you are developing, just add 'blog' (not django.contrib.blog) inside the INSTALLED_APPS tuple in settings.py. I try in Italian too. Salve Bruxo, non parlo portogese ma essendo italiano ho più o meno capito il tuo post. Sembra che tu abbia incluso "django.contrib.blog" in settings.py, ma non esiste un modulo "blog" all'interno di django.contrib. Se "blog" è il nome del modulo che stai sviluppando, aggiungi "blog" (e non "django.contrib.blog) nella tupla INSTALLED_APPS in settings.py. 2010/5/31 Bruxo_Mor Juca : > Senhores, > > Preciso de ajuda no que se diz respeito a configuração do MANAGE.PY > estou com o seguinte erro: > > Error execute_manage.py(settings) > > Estou criando uma pagina, criei no arquivo de Setting.py a seguinte > definição: > > > 'django.contrib.blog'; inclui esta linha logo abaixo da linha > 'django.contrib.admin'; > > Sem a minha linha o site local funciona, quando coloco a minha linha > aparece o erro que citei acima. > > Se alguem puder me ajudar..agradeço. > > -- > 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. > > -- 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.
Is there a way to add operations to an entity admin form?
I would like to add my own custom operations in addition to standard "save and add another", "save" etc' Is it supported? -- 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: delete file or image after deleting model item
Thank you, Shawn. I just wander, why auto-deleting files was not included in django as well? Just your opinion? On May 30, 6:32 am, Shawn Milochik wrote: > You can override thedeletefunction of your model to take care of this. > > Alternatively, if you want to do this for a bunch of different models, it > might be cleaner to use signals. > > Shawn -- 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: Is there a way to add operations to an entity admin form?
well you can do it with a minimal overhead... copy the django/contrib/admin/templates/change_form.html file to your project/templates/admin/ folder. The line with {% submit_row %} is what your are searching for: add whatever you need. Unisng the context parameter, pass to render_change_form whatever you want to find in the change_form template. Remember to use mark_safe() Then in your model admin.py you can do also some dirty (well I advised you they are dirty) hacks like (in my case they works easily because I know that my app will run in Italian only: class ABCAdmin(admin.modelAdmin): def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None): ret = super(ABCAdmin, self).render_change_form(request, context, add, change, form_url, obj) # remove "add another" ret.content = ret.content.replace('', '') # remove "add and continue" ret.content = ret.content.replace('', '') # change the save button text to "send" ret.content = ret.content.replace('Salva', 'Invia') # add a link to import data using a csv (the link will point to a url that is mapped to a custom view) ret.content = ret.content.replace('Aggiungi messaggio inviato', 'Invia messaggio') return ret On Tue, Jun 1, 2010 at 11:07, gderazon wrote: > I would like to add my own custom operations in addition to standard > "save and add another", "save" etc' > Is it supported? > > -- > 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. > > -- 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: don't work Flatpages
I decided this problem. The matter of it was SITE_ID in settings.py. The facto of the matter that Flatpages from box has default site example.com as default. If you create new your site before deleting example.com you get SITE_ID: 2 and etc for your site. After that you can delete example.com but your site will be still with ID:2 and more. However in settings.py you get as default SITE_ID:1. You have to be carefully with SITE_ID if you are going to work with Flatpages. Regards, George. -- 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.
DJango Deployment
Hi , I am new to Django. I have developed a tool using Python CGI. I have been successfully deploying it using Apache Tomcat 5.5, from cgi/bin directory. After knowing the benefits of Django I have planned to complete the remaining modules using Django. I successfully configured deploying Django using Apache 2.2 web server using mod_python.so file. Now the tool is running on two different servers, the older Python CGI scripts are executed perfectly at port 8080 by Tomcat, but at port 80 ( Apache webserver) whenever a Django project is requested through ajax without loading the page again, the server times out showing 301 Moved Permanently error. What could be the reason and remedy for the problem ?. On keeping a href link that points to a Django project successfully reloads the page and shows the response as a new page. Should I be using Jython to deploy Django in Tomcat ? -- 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.
Control Center - own app or cross references?
Cheers, I have the following question regarding layout conventions. Let's assume I have: - app "Foo" - app "Bar" - app "usermanager" Now I'd like to create some kind of Control Center for the users, where they can manage their preferences of "Foo" and "Bar". The user accounts are managed by "usermanager" (login / register / password change / ...) . Question: What would be the preferred way? 1) Create an own app "control center" 2) Create a "control center" section within the apps "Foo" and "Bar" Or maybe I should go a completely different way? Thanks for any help, R3dFox -- 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.
Raw sql bug? Or am I doing something wrong?
Hi, I love the new raw() function to write custom sql and get back ORM objects. However, when using joins, things get weird. As long as you use "select *", everything works fine: for r in Model.objects.raw('SELECT * FROM model INNER JOIN othermodel ON othermodel.model_id = model.id'): print r However, this can result in a LOT of columns that you don't need, and possible duplicate column names. Solution would seem to be this: for r in Model.objects.raw('SELECT model.id, model.name FROM model INNER JOIN othermodel ON othermodel.model_id = model.id'): print r Sadly, this doesn't work. I get an "type() argument 1 must be string, not unicode" error from django/db/models/query_utils.py in deferred_class_factory, line 274. Is there another way to get this to work? The "id" column is required for the raw() function to work, but just using "id" doesn't work because othermodel also has an "id" column. Using "model.id" gives the error. I also tried "model.id AS id", but same error. Or is this a bug that I should put in trac? Thanks, Kevin -- 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: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?
On May 31, 5:35 pm, AD wrote: > I went ahead and downloaded the Django 1.2.1 tarball, untarred it and > ran > > sudo python setup.py install in the directory. > > I needed to make one small change in my Apache httpd.conf file, but > otherwise it all seems to be working smoothly! Before I go for the same solution: what changes did you need to make to your http.conf ? I guess it depends on your django install. I'm using apache + mod_python. -- 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: Is there a way to add operations to an entity admin form?
here is how I added the action to create new items in the Addressbook (Rubrica) to the normal change list existing admin page: in admin.py class RubricaAdmin(admin.ModelAdmin): list_display = ('cognome', 'nome', 'numero_cellulare',) list_filter = ('cognome', 'nome', 'numero_cellulare',) search_fields = ('cognome', 'nome',) @csrf_protect_m def changelist_view(self, request, extra_context=None): import re ret = super(RubricaAdmin, self).changelist_view(request, extra_context) ret.content = re.sub('(?<=\d )rubrìca', 'voci', ret.content) #note it is "importa_csv/" and not "/importa_csv/" ret.content = ret.content.replace('', 'Importa csv') return ret def importa_csv(self, request, queryset): pass class Media: css = {'all': ('habble-admin.css',)} in view.py # -*- coding: utf-8 -*- from django.http import HttpResponse from django.shortcuts import render_to_response from cruscotto.sms.models import Rubrica from cruscotto.sms.forms import * from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe from django.utils.encoding import force_unicode from django import template # Create your views here. def importa_csv(request): opts = Rubrica._meta app_label = opts.app_label queryset = Rubrica.objects.all() form = FormCSV_0() #modifiable_objects = [] #perms_needed = set() #i = 0 #for obj in queryset: #if request.user.has_perm('sms.change_rubrica'): #modifiable_objects.append(obj) #else: #perms_needed += 'sms.change_rubrica' context = { "title": _("Importa CSV"), "object_name": force_unicode(opts.verbose_name), #"deletable_objects": modifiable_objects, 'queryset': queryset, #"perms_lacking": perms_needed, 'has_change_permission': request.user.has_perm('sms.change_rubrica'), "opts": opts, #"root_path": self.admin_site.root_path, "app_label": app_label, #'action_checkbox_name': admin.ACTION_CHECKBOX_NAME, 'form': form.as_table(), 'form_url': '{url_scheme}://{h_p}/chpwd/'.format(url_scheme=request.META['wsgi.url_scheme'], h_p=request.META['HTTP_HOST']), } return render_to_response('importa_csv.html', context, context_instance=template.RequestContext(request)) in urls.py before the admin row: (r'^admin/sms/rubrica/importa_csv/', 'sms.views.importa_csv'), # nest inside admin interface! this is important for the ../ links in the template to work the template: {% extends "admin/base_site.html" %} {% load i18n admin_modify adminmedia %} {% block extrahead %}{{ block.super }} {{ media }} {% endblock %} {% block extrastyle %}{{ block.super }}{% endblock %} {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} {% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} {% block breadcrumbs %}{% if not is_popup %} {% trans "Home" %} › {{ app_label|capfirst|escape }} › {% if has_change_permission %}{{ opts.verbose_name_plural|capfirst }}{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} {% endif %}{% endblock %} {% block content %} {{ form }} {% endblock %} On Tue, Jun 1, 2010 at 11:07, gderazon wrote: > I would like to add my own custom operations in addition to standard > "save and add another", "save" etc' > Is it supported? > > -- > 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. > > -- 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.
Open source project looking for developer
Hi, http://www.myjobseek.net/ is a tool for job seekers to organise their job hunt, storing details of jobs applied for and applications, making it easy to reuse covering letters and so on. However, as I only develop it when I' -- 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: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?
here is a getting started (good practices) guide to configuring a django production server. A little old now, but the fundamentals still apply. http://lethain.com/entry/2009/feb/13/the-django-and-ubuntu-intrepid-almanac/ On Tue, Jun 1, 2010 at 12:09, Patrice wrote: > On May 31, 5:35 pm, AD wrote: >> I went ahead and downloaded the Django 1.2.1 tarball, untarred it and >> ran >> >> sudo python setup.py install in the directory. >> >> I needed to make one small change in my Apache httpd.conf file, but >> otherwise it all seems to be working smoothly! > > Before I go for the same solution: what changes did you need to make > to your http.conf ? > I guess it depends on your django install. I'm using apache + > mod_python. > > -- > 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. > > -- 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: Open source project looking for developer
Pressed the wrong button and posted prematurely ... :-/ Hi, http://www.myjobseek.net/ is a tool for job seekers to organise their job hunt, storing details of jobs applied for and applications, making it easy to re-use covering letters and so on. To-do lists and reminders are included to. However, as I only develop it when I'm job hunting, it's in a early state. (Thankfully I haven't been job-hunting much recently) If I open sourced it, would people be intrested in picking this up and working on in? (It's in Django, of course) Reply off list if you want. Sorry if this is off-topic (& for my stupidity in posting twice!) James -- 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: Open source project looking for developer
Thumbs up from me! On Jun 1, 4:31 pm, James wrote: > Pressed the wrong button and posted prematurely ... :-/ > > Hi, > > http://www.myjobseek.net/is a tool for job seekers to organise their > job hunt, storing details of jobs applied for and applications, making > it easy to re-use covering letters and so on. To-do lists and > reminders are included to. However, as I only develop it when I'm job > hunting, it's in a early state. (Thankfully I haven't been job-hunting > much recently) > > If I open sourced it, would people be intrested in picking this up and > working on in? (It's in Django, of course) Reply off list if you > want. > > Sorry if this is off-topic (& for my stupidity in posting twice!) > James -- 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: Raw sql bug? Or am I doing something wrong?
Update: weirdly enough, this does work: for r in Model.objects.raw('SELECT model.* FROM model INNER JOIN othermodel ON othermodel.model_id = model.id'): print r But model.id does not. -- 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: DJango Deployment
Hi, why do you use tomcat or mod_python? Please try mod_wsgi, if you use apache. Thomas PM wrote: > Hi , >I am new to Django. > >I have developed a tool using > Python CGI. I have been successfully deploying it using Apache Tomcat > 5.5, from cgi/bin directory. After knowing the benefits of Django I > have planned to complete the remaining modules using Django. I > successfully configured deploying Django using Apache 2.2 web server > using mod_python.so file. Now the tool is running on two different > servers, the older Python CGI scripts are executed perfectly at port > 8080 by Tomcat, but at port 80 ( Apache webserver) whenever a Django > project is requested through ajax without loading the page again, the > server times out showing 301 Moved Permanently error. What could be > the reason and remedy for the problem ?. On keeping a href link that > points to a Django project successfully reloads the page and shows the > response as a new page. > > Should I be using Jython to deploy Django in Tomcat ? > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- 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: Is there a way to add operations to an entity admin form?
Thank you very much! On Jun 1, 1:32 pm, Massimiliano della Rovere wrote: > here is how I added the action to create new items in the Addressbook > (Rubrica) to the normal change list existing admin page: > > in admin.py > > class RubricaAdmin(admin.ModelAdmin): > list_display = ('cognome', 'nome', 'numero_cellulare',) > list_filter = ('cognome', 'nome', 'numero_cellulare',) > search_fields = ('cognome', 'nome',) > > @csrf_protect_m > def changelist_view(self, request, extra_context=None): > import re > ret = super(RubricaAdmin, self).changelist_view(request, > extra_context) > ret.content = re.sub('(?<=\d )rubrìca', 'voci', ret.content) > > #note it is "importa_csv/" and not "/importa_csv/" > ret.content = ret.content.replace(' class="addlink">', > 'Importa csv href="add/" class="addlink">') > return ret > > def importa_csv(self, request, queryset): > pass > > class Media: > css = {'all': ('habble-admin.css',)} > > in view.py > > # -*- coding: utf-8 -*- > > from django.http import HttpResponse > from django.shortcuts import render_to_response > from cruscotto.sms.models import Rubrica > from cruscotto.sms.forms import * > > from django.utils.translation import ugettext_lazy as _ > from django.utils.safestring import mark_safe > from django.utils.encoding import force_unicode > from django import template > > # Create your views here. > > def importa_csv(request): > opts = Rubrica._meta > app_label = opts.app_label > queryset = Rubrica.objects.all() > form = FormCSV_0() > > #modifiable_objects = [] > #perms_needed = set() > #i = 0 > #for obj in queryset: > #if request.user.has_perm('sms.change_rubrica'): > #modifiable_objects.append(obj) > #else: > #perms_needed += 'sms.change_rubrica' > > context = { > "title": _("Importa CSV"), > "object_name": force_unicode(opts.verbose_name), > #"deletable_objects": modifiable_objects, > 'queryset': queryset, > #"perms_lacking": perms_needed, > 'has_change_permission': > request.user.has_perm('sms.change_rubrica'), > "opts": opts, > #"root_path": self.admin_site.root_path, > "app_label": app_label, > #'action_checkbox_name': admin.ACTION_CHECKBOX_NAME, > 'form': form.as_table(), > 'form_url': > '{url_scheme}://{h_p}/chpwd/'.format(url_scheme=request.META['wsgi.url_sche > me'], > h_p=request.META['HTTP_HOST']), > } > > return render_to_response('importa_csv.html', context, > context_instance=template.RequestContext(request)) > > in urls.py before the admin row: > (r'^admin/sms/rubrica/importa_csv/', 'sms.views.importa_csv'), # > nest inside admin interface! this is important for the ../ links in > the template to work > > the template: > {% extends "admin/base_site.html" %} > {% load i18n admin_modify adminmedia %} > > {% block extrahead %}{{ block.super }} > > {{ media }} > {% endblock %} > > {% block extrastyle %}{{ block.super }} type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% > endblock %} > > {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif > %}{% endblock %} > > {% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} > change-form{% endblock %} > > {% block breadcrumbs %}{% if not is_popup %} > > {% trans "Home" %} › > {{ app_label|capfirst|escape }} › > {% if has_change_permission %}{{ > opts.verbose_name_plural|capfirst }}{% else %}{{ > opts.verbose_name_plural|capfirst }}{% endif %} > > {% endif %}{% endblock %} > > {% block content %} > > {{ form }} > > {% endblock %} > > > > On Tue, Jun 1, 2010 at 11:07, gderazon wrote: > > I would like to add my own custom operations in addition to standard > > "save and add another", "save" etc' > > Is it supported? > > > -- > > 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 > > athttp://groups.google.com/group/django-users?hl=en. -- 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: django-admin-tools
Hi, As I said in my previous mail, you should bring this to the django- admin-tools mailing list: http://groups.google.com/group/django-admin-tools/ > My guess is documentation is wrong.I think admin_tools media folder > should be inside django.contrib.admin. No, the documentation is ok, please re-read this section carefully: http://packages.python.org/django-admin-tools/0.2.0/configuration.html#setting-up-the-django-admin-tools-media-files What you need is to symlink or copy the "admin_tools" media directory in your MEDIA_ROOT and setup your MEDIA_URL accordingly. Regards, -- David -- 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: How can I test the correctness of my models against the schema of a database?
Its been a while since I worked with a live db and unit tests for this sort of thing, but I think this is how we did it: Put the tests in a tests.py file in an app like normal, but for the db test, inherit from the python test framework's UnitTest. That test will not get a special test db, so be very, very careful. Alex On May 31, 8:16 am, David Horat wrote: > Thanks for the info Jani. > > One question: How did you manage to make the tests in Django? > Because it forces you to create a test database and the idea of our > tests is to do them on an already full test database. > My idea if I can't skip it is to try and make them with the Python > Unit Testing Framework. But I would prefer all tests to be together in > Django. > > Regards, > David > > On May 31, 8:34 am, Jani Tiainen wrote: > > > Not really. > > > If you're specially working with legacy databases trying to figure out that > > do > > Django models match underlying schema is PITA. > > > We resolved this partially by doing few simple tests, namely running through > > all models and doing empty query. Since Django ORM queries for every field > > it > > revealed most of the problems right away. Of course we didn't checked > > lenghts > > or types of field. > > > Also this could be useful in development phase when you add new fields. > > > In django-command-extensions exists dbdiff command which produces somekind > > of > > diff against underlying database but it's in very early stages. > > > > Sorry. I haven't use other methods for that. > > > But isn't it enough to test it using loremiser or something like that > > > and like an addition debug toolbar? > > > > On May 31, 12:53 am, David Horat wrote: > > > > Dear group, > > > > > How can I test the correctness of my models against the schema of a > > > > database? > > > > > To solve this question, I have tried unsuccessfully several options: > > > > - Using ./manage.py test triggers the creation and destruction of a > > > > database, but I want to check the correctness of the model against a > > > > production database, since I just want to check the schema, not the > > > > content. > > > > - Creating my own test runner as specified > > > > herehttp://stackoverflow.com/questions/138851whichbasically hacks the > > > > Django stack and gives you other problems. In any case this seems not to > > > > be the correct way. > > > > > Has anyone of you faced this situation before? Any clues? > > > > > Thank you in advance. > > > > > Best Regards, > > > > David Horat > > > -- > > > Jani Tiainen -- 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.
Proabably a simple python question but ...
If I put at the end of my settings.py file, the following code : if (DEBUG): print "Project name : " + PRJ_NAME print "Root directory : " + ROOT_DIR The lines are printed twice : Project name : XXX Root directory : /Users/tsmets/Documents/python/XXX/site/ Project name : XXX Root directory : /Users/tsmets/Documents/python/XXX/site/ -- Thomas SMETS 1050 Brussels W : http://genealogy.tsmets.lautre.net skype : tsmets -- 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: Twisty Little Passages... widgets, fields, forms
On Jun 1, 1:24 am, Michael Davis wrote: > I'm trying to implement a simple grade book application using a > modelformset where the students' names are READONLY and the grades are > the only thing the teacher can edit. I've been looking for sample code > to implement the readonly portion and one fellow (on another site) > suggests I use his, but he never posts sample usage code along with > it. > > He suggests I use a custom widget: > class ReadOnlyWidget(forms.Widget): > def __init__(self, original_value, display_value=None): > self.original_value = original_value > if display_value: > self.display_value = display_value > super(ReadOnlyWidget, self).__init__() > def _has_changed(self, initial, data): > return False > def render(self, name, value, attrs=None): > if self.display_value is not None: > return unicode(self.display_value) > return unicode(self.original_value) > def value_from_datadict(self, data, files, name): > return self.original_value > > But I can't figure out how to set the original_value in my > application. > The "obvious" choice like: > class GradeForm(ModelForm): > student = forms.CharField(max_length=50, > widget=ReadOnlyWidget(instance)) > doesn't work as I'm fairly sure instance isn't set here or if it is > how I can invoke it so it does the right thing in a modelformset. > > The less obvious choice of setting it from within the form's __init__ > function is currently beyond my ability as I do not understand the > code flow through here and am not sure how to instantiate the widget > from within the form's __init__ function. > > Can someone point me to a good source of documentation at this level > of detail? I know this is not answering your question directly, so please just sigh and ignore it if not relevant... If this is a simple application", as you mention above, maybe consider (or reconsider) using the Admin application, which has built-in support for readonly fields. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields -- 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: Importing ImageField from file or - better - generating it from another ImageField
Perhaps see the django-filebrowser product. It may have things that you don't need, but makes thumbnails, and associates them with an image field, so it is at least a sample of what's involved. Bill 2010/5/31 Ricardo Bánffy : > Hi folks > > I am having huge problems wrapping my head around the ImageField field > type. I am trying to generate default thumbnails for uploaded images, > both stored as ImageField attributes. It's done this way because the > user must be able to manually edit the thumbnail if needed. > > I am failing miserably at that. I went as far as to generate the > thumbnail and saving it to a specific location, but I have so far been > unable to attribute the contents of that file to the ImageField that > corresponds to the thumbnail. > > Has anyone solved this problem in a simple way? > > -- > Ricardo Bánffy > http://www.dieblinkenlights.com > http://twitter.com/rbanffy > > -- > 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. > > -- 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: django-registration custom fields
I'm following the praveen tutorial as well but I'm receiving the error: "SiteProfileNotAvailable at /accounts/register/" What am I missing here. On May 31, 1:32 pm, Pankaj Singh wrote: > Thanks my problem has been resolved :) -- 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: Importing ImageField from file or - better - generating it from another ImageField
Thanks, Bill. I really had a hard time wrapping my head around the ImageField object model. I guess I am now OK, but I had to do more seek(0)'s than I wanted. It's sort of working and properly deduplicating images and thumbnails. I'll check the django-filebrowser product, tidy up what I have done and post it somewhere. On Tue, Jun 1, 2010 at 11:46 AM, Bill Freeman wrote: > Perhaps see the django-filebrowser product. It may have things that > you don't need, but > makes thumbnails, and associates them with an image field, so it is at > least a sample > of what's involved. > > Bill > > 2010/5/31 Ricardo Bánffy : >> Hi folks >> >> I am having huge problems wrapping my head around the ImageField field >> type. I am trying to generate default thumbnails for uploaded images, >> both stored as ImageField attributes. It's done this way because the >> user must be able to manually edit the thumbnail if needed. >> >> I am failing miserably at that. I went as far as to generate the >> thumbnail and saving it to a specific location, but I have so far been >> unable to attribute the contents of that file to the ImageField that >> corresponds to the thumbnail. >> >> Has anyone solved this problem in a simple way? >> >> -- >> Ricardo Bánffy >> http://www.dieblinkenlights.com >> http://twitter.com/rbanffy >> >> -- >> 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. >> >> > > -- > 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. > > -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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: Django serving multiple subdomain sites -- okay to use thread-locals?
Thanks, Graham. We'll keep using this method and I'll continue this thread if we run into problems. I appreciate the insight re: Python's implementation of thread locals. I tend to agree re: security -- thread locals only appears to be a security threat if a system has already been seriously compromised, at which point there'd be easier attacks to execute. Kieran On May 31, 9:17 pm, Graham Dumpleton wrote: > On Jun 1, 1:04 pm, Kieran Farr wrote: > > > > > > > We're adapting our Django powered video site to be an open video > > platform for any user to create their own "site" using subdomains (eg > > mysite.vidplatform.com) on one Django server instance. Each "site" > > would obviously have content associated with only that site in > > addition to template and navigation customizations. > > > Adapting the ``django-multisite`` app seems best and is working well > > on our dev server:http://github.com/shestera/django-multisite > > > However, a number of Django developers have expressed concerns using > > thread-locals:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > > I don't see any other option besides using thread-locals to > > dynamically update SITE_ID per request. > > > What would be another way of accomplishing this goal without thread- > > locals if indeed this is not best practice? > > Irrespective of whether you use thread locals, in a multithreaded > system you are going to have that risk of one thread in your web > server potentially accessing or modifying the current state of another > thread in the system. That is simply the nature of multithreaded > systems and more so with Python where one can access just about > anything of the environment of the executing Python process, including > the stack frames of other executing threads. > > If anything I would say that thread locals if used correctly are going > to be more secure than you having your own global dictionary which is > caching information keyed on the request or thread ID. This is because > in modern Python versions it would be much harder to actually get > access to the thread local instance for another thread. This is > because the thread local object is actually kept in C data structures > for the current thread and you only get given back the object instance > relevant to variable for your specific thread. To get access to that > for another thread you may require a C extension module which > traverses all the C thread state objects for other threads. > > So, not sure why that warning has been given. I could understand it > for older Python versions where one may have been using Python > implementation of threading locals, ie., the threading_locals module, > as in that case data for other threads was exposed, but for latest > Python versions believe it is a bit harder to get at thread locals for > another thread. If this is not the case and it is easy to get at > thread locals for another thread, can someone post Python code as to > how. > > Note that someone can take advantage of this presupposes that someone > has managed to inject code into your application from outside and have > it executed. If they can do that you probably have bigger problems to > contend with than this. What for example is there to stop someone > looking at DJANGO_SETTINGS_MODULE to work out name of settings module > and then getting that module and working out what your database > password is. They could even simply access the database using active > database handle and make arbitrary queries/changes to the database, > including stuff related to users personal details. > > So, I would say that if someone has got as far as to being able to > even attempt to take advantage of it, ie., compromised your system and > can perform code injection, you are already stuffed in many many ways > and this is going to be the least of your concerns and that there is > likely much easier ways of stealing data. > > Graham -- 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: Is the Django book written in ReST/Sphinx?
On Mon, May 17, 2010 at 2:00 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > On Mon, May 17, 2010 at 7:06 AM, cool-RR wrote: > > I'm just working on a book for my own project, and I was wondering: Is > > the Django book written in ReST/Sphinx? I am considering whether I > > should write my book with that. > > This is slightly off topic for this list, but I would advise that this > is something you need to take up with your publisher. Ultimately, > whatever your personal preferences, your publisher will control the > formats that you can use to submit a final manuscript. > > As for the specific question; I can't speak specifically for the > Django Book, but I do know that Practical Django Projects was > originally drafted in ReST, but had to be converted to Word format for > final submission. Given that the Django Book published by the same > publisher, I'm going to guess the same rules applied. > > Yours, > Russ Magee %-) Thanks for your help! Ram. -- 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: Proabably a simple python question but ...
This post from Graham Dumpleton (wrote mod_wsgi) goes into detail of why that happens. Extremely useful reading... http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html Thanks, Richard Shebora On Tue, Jun 1, 2010 at 10:15 AM, Thomas Lionel Smets wrote: > > If I put at the end of my settings.py file, the following code : > > > if (DEBUG): > print "Project name : " + PRJ_NAME > print "Root directory : " + ROOT_DIR > > > The lines are printed twice : > > Project name : XXX > Root directory : /Users/tsmets/Documents/python/XXX/site/ > Project name : XXX > Root directory : /Users/tsmets/Documents/python/XXX/site/ > > > > > -- > Thomas SMETS > 1050 Brussels > W : http://genealogy.tsmets.lautre.net > skype : tsmets > > -- > 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. > -- 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.
Looping through models
Hello everybody, using GeoDjango I need to do a spatial intersections through a lot of different model (polygon): output1 = model1.objects.filter(geom__intersects=fs[0].geom) output2 = model2.objects.filter(geom__intersects=fs[0].geom) ... Where fs is a QuerySet output. Is there a way to create a loop changing only the model name? Thank you very much Luca -- 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: Looping through models
On Tue, Jun 1, 2010 at 12:57 PM, Luca Casagrande wrote: > Is there a way to create a loop changing only the model name? geo_models = [model1, model2, model3, ...] for m in geo_models: m.objects.filter(geom__intersects=fs[0].geom) -- 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.
Serving media files with Django/Apache/Nginx
I am a Django newbie and Im using Django to build an application. Im using Apache/mod_wsgi and Nginx as a proxy server to serve static files.I am running Nginx on port 80 and have all the Django pages forwarded to Apache. I have my media folder in the application root folder named media1. I cannot get Nginx to find and serve up my media files. Here is the different pieces i have. Nginx config: server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP$remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0; client_max_body_size 10m; client_body_buffer_size128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size64k; proxy_temp_file_write_size 64k; } location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls| exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { root /media1/; } Django SETTINGS config: MEDIA_ROOT = 'C:/Python26/Lib/site-packages/django/bin/blazinsports/ media1/' MEDIA_URL = 'http://localhost/media1/' ADMIN_MEDIA_PREFIX = '/media/' What do I need to change to get Nginx to serve up my media files?? Thanks for your help!! -- 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.
file upload failed in Tomcat using Django framework
I use jython-django to develop web application. The file upload (mutlipart/form-data) works in django development server. But when I deployed the war file to tomcat, the file upload function failed and the request.FILES['file'] field showed "empty". Please help and provide solution. Many Thanks! -- 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: db autoclobbering with automated tests
thanks, guys On Mon, May 31, 2010 at 5:23 AM, Russell Keith-Magee wrote: > On Fri, May 28, 2010 at 12:59 PM, Rolando Espinoza La Fuente > wrote: >> I'd added a patch that adds the --noinput option to testserver command: >> http://code.djangoproject.com/ticket/12619 > > I've just marked that ticket Ready For Checkin; once we branch for 1.3 > development, I'll check this in. -- 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.
Any Experiences with Sphinx Search and Django-sphinx?
I am looking to provide search. All content is in MYSQL DB in innodb tables. That rules out Mysql full text search option, which would have been my first choice. Other option I am looking at it is Sphinx search with django-sphinx. Any experiences with it good and bad? Other thing I looked at is Haystack, but I do not want to run and maintain Solr. Xapien or Whoosh with Haystack is second choce after Sphinx. Any pros or cons I need to consider before making a decision? I am looking for 1) Full Text search over MYSQL innodb tables ( which are all available as Django Models) 2) Reasonably good performance 3) Low Maintenance 4) Low memory usage 5) Very reliable solution. -- 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: Serving media files with Django/Apache/Nginx
On Jun 1, 10:40 pm, Corey wrote: > I am a Django newbie and Im using Django to build an application. Im > using Apache/mod_wsgi and Nginx as a proxy server to serve static > files.I am running Nginx on port 80 and have all the Django pages > forwarded to Apache. I have my media folder in the application root > folder named media1. I cannot get Nginx to find and serve up my media > files. Here is the different pieces i have. > > Nginx config: > > server { > listen 80; > server_name localhost; > > #charset koi8-r; > > #access_log logs/host.access.log main; > > location / { > proxy_pass http://127.0.0.1:8080/; > proxy_redirect off; > > proxy_set_header Host $host; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For > $proxy_add_x_forwarded_for; > proxy_max_temp_file_size 0; > > client_max_body_size 10m; > client_body_buffer_size 128k; > > proxy_connect_timeout 90; > proxy_send_timeout 90; > proxy_read_timeout 90; > > proxy_buffer_size 4k; > proxy_buffers 4 32k; > proxy_busy_buffers_size 64k; > proxy_temp_file_write_size 64k; > } > location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls| > exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { > root /media1/; > } > > Django SETTINGS config: > > MEDIA_ROOT = 'C:/Python26/Lib/site-packages/django/bin/blazinsports/ > media1/' > MEDIA_URL = 'http://localhost/media1/' > ADMIN_MEDIA_PREFIX = '/media/' > > What do I need to change to get Nginx to serve up my media files?? > Thanks for your help!! This isn't a Django question at all, but purely an nginx one. I don't know nginx at all, but it's clear from the config file above that you have never told it where to look for the files to serve from /media1/ - ie where is the actual physical location on the server. (Not related, but it is an extremely bad idea to put your own Django project - and its media files - within the site-packages directory.) -- DR. -- 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: Serving media files with Django/Apache/Nginx
Using the alias directive is much more easier and straighforward, for me at least. Here's an example configuration upstream django-backend { server testsite.local:4080; } server { listen 80; server_name testsite.com; location /{ proxy_redirect http://testsite.local:4080/ http://$host/; proxy_set_header X-REAL-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 5; proxy_send_timeout 15; proxy_read_timeout 60; proxy_set_header Host "testsite.local:4080"; proxy_pass http://django-backend; } location /static { alias /home/vasil/Projects/django-test/djangoproject/static; } } On Tue, Jun 1, 2010 at 11:40 PM, Corey wrote: > I am a Django newbie and Im using Django to build an application. Im > using Apache/mod_wsgi and Nginx as a proxy server to serve static > files.I am running Nginx on port 80 and have all the Django pages > forwarded to Apache. I have my media folder in the application root > folder named media1. I cannot get Nginx to find and serve up my media > files. Here is the different pieces i have. > > Nginx config: > > server { > listen 80; > server_name localhost; > > #charset koi8-r; > > #access_log logs/host.access.log main; > > location / { > proxy_pass http://127.0.0.1:8080/; > proxy_redirect off; > > proxy_set_header Host $host; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For > $proxy_add_x_forwarded_for; > proxy_max_temp_file_size 0; > > client_max_body_size 10m; > client_body_buffer_size 128k; > > proxy_connect_timeout 90; > proxy_send_timeout 90; > proxy_read_timeout 90; > > proxy_buffer_size 4k; > proxy_buffers 4 32k; > proxy_busy_buffers_size 64k; > proxy_temp_file_write_size 64k; > } > location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls| > exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { > root /media1/; > } > > > Django SETTINGS config: > > MEDIA_ROOT = 'C:/Python26/Lib/site-packages/django/bin/blazinsports/ > media1/' > MEDIA_URL = 'http://localhost/media1/' > ADMIN_MEDIA_PREFIX = '/media/' > > What do I need to change to get Nginx to serve up my media files?? > Thanks for your help!! > > -- > 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. > > -- 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.
Django Job in Austin and Seattle (Multiple positions available)
Tippr.com is a fast growing venture funded internet company that provides technology that helps local merchants acquire new customers. Think of Groupon.com, livingsocial.com or buywithme.com on steroids and not sucking. We are hiring passionate, dedicated and brilliant engineers to join the core engineering team. As part of the core engineering team you will work closely with the product team in a fast paced, challenging environment to help shape the technology landscape and culture of the core product. Requirements - Knowledge of Django - 2-3+ years of software engineering experience in Linux/Unix - Extensive knowledge of open source technologies - Experience writing software that communicates directly with 3rd party software (payment gateways, automation scripts, API’s) - Ability to work with technical and non-technical teams, in an extremely fast-paced environment - Self-motivated and reliable - Strong UI design sense with the ability to adapt, take critical feedback, and execute quickly on tasks Pluses - Experience or familiarity with cloud services (Amazon EC2 and S3, Rackspace, Linode) - Database experience a plus - Previous start-up experience Please send resume or questions to j...@tippr.com -- 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.
Multiple user types
Picking up the thread started by itsnotvalid on 21OCT08 ... Like him (her), I have three groups of users. They self-register centrally (at project level) and assign themselves to group A, B or C. Once logged on. data input should be managed by one of three corresponding applications. All in one database. The User Profile feature depends on a setting AUTH_PROFILE_MODULE to enable user.get_profile(). This is a single value in a central settings file. Is there a way to have application-specific settings? So that each group can have a specific Profile? Alternatively, I could find the instance that matches the logged in user in the what-would-have-been-a-profile model of the application that corresponds to the group... :-) It seems a very long way round. Is there an easy way? Thanks -- 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.
Need help
Can someone give me a developed Online Calendar application using Django? I have a project in my Master's. I have no idea in Django. It will be really helpful if someone really helps me. -- 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.
media files
Hello Django has a really useful API for associated media files with Forms, Widgets, etc. http://docs.djangoproject.com/en/dev/topics/forms/media/#paths-in-media-definitions This is very good when dealing with just one app. However, many apps I write are a collection of multiple apps. These apps may be written by multiple people. This raises some issues: * If you are writing an app that is designed to be reusable, and comes with say a JavaScript file, what path should you use to reference the file? Different people seem to have different directory structures for media files, and the code is hardly reusable if you have to customize it for each project. You could make every media file a configurable setting, if you have lots of settings that starts getting messy. Or maybe you could have every app use its own x_MEDIA_URL settings. * How do you serve media files from multiple apps? The solution to this last point I have seen so far is that the media files should be included in under the same app that has ROOT_URLCONF. This fits in with sample Django code I often see: if settings.DEBUG: urlpatterns += patterns('', (r'^something_media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) However this can be messy as the media files may be closely tied to the html templates in another app. I don't think it is a good idea to artificially split files into different apps like this. Another idea I have had is to write a script that combines files from $dir/media for every app into one global media directory, and configure apache or django to serve files from this directory. That way you get to keep small URLs, and can have one app override the media files. In fact you could replace the "copy" operation with something that compresses Javascript/css code making download times faster. I can't help but think that requiring every project come up with their own solution is bad for code re-usability. As much as I like D Comments? Suggestions? Thanks! Brian May -- 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.
select multiple without using foreignkey
I have a models that represents an event. I want it to have a field that represents the days of the week that the event occurs. This is easy if all you need to be able to do is be able to select one day, but if you want to select multiple, the right way seems to be to create a DayOfWeek object, create 7 instances in your db, the use ManyToMany relations. To me that just seems wrong. I'd rather store it as a string like "WFS" or "MWF". Is there an easy way to do this in django? -- 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.
Django 1.2.1 doesn't work with South but 1.2 works? How to find the previous version Django 1.2?
I am having some trouble with South database migration using Fabric. I tried several machines, one works and the other 3 doesn't work. The only difference is that the machine that's working is using Django 1.2, and the others are using Django 1.2.1. Somehow I couldn't find the Django 1.2 tarball on the website, any idea why it was pulled? Does anybody else have trouble using Django 1.2.1 with South 0.7.1? Thanks! -- 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: Django 1.2.1 doesn't work with South but 1.2 works? How to find the previous version Django 1.2?
Why don't you try to fix this incompatibility? You can help South project by doing this. It isn't recommended to use the 1.2 since 1.2.1 is the same with bugfixes. But you can grab the 1.2 code using SVN. Just checkout this URL: http://code.djangoproject.com/svn/django/tags/releases/1.2/ Atenciosamente, Vinicius Mendes Solucione Sistemas vinic...@solucione.info On Tue, Jun 1, 2010 at 10:29 PM, flyinglegs wrote: > I am having some trouble with South database migration using Fabric. I > tried several machines, one works and the other 3 doesn't work. The > only difference is that the machine that's working is using Django > 1.2, and the others are using Django 1.2.1. > > Somehow I couldn't find the Django 1.2 tarball on the website, any > idea why it was pulled? Does anybody else have trouble using Django > 1.2.1 with South 0.7.1? > > Thanks! > > -- > 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. > > -- 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.
design question - forms as meta-data to a model
Hi, I've a situation where the following functionality is desirable.. - one central model is used and interacted with by users - forms (multiple on multiple sites, pick a number for each.. 5 or 50, doesn't matter) are submitted by anonymous users and associated with this central model.. so these forms are sort of meta-data.. - it would be nice to be able to define a new form via the admin panel and allow this to be picked up more or less dynamically by the rest of the application - so once defined, a site could then start submitting forms and have them associated with and displayed as part of other instances of this model, no other code or (manual) db updates would really be necessary I'm an intermediate django user, and are pretty well-rooted in various aspects of django development, though I haven't really wrapped my head around the best way to implement these forms, the model, and the connection between the two. Thoughts? thanks! ~Jason -- 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.
AJAX request does not seem to have request.user
I have modified my admin site so that a state/province will be loaded through an AJAX call when the country is chosen. I had @login_required(redirect_field_name='/login/') called just before the view so I could prevent unauthorized AJAX requests. This no longer works after I upgraded from 1.1 to 1.2.1. It seems the user objects is no longer on the request object. Is there a work around for this? -- 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.
admin recipe: sort on "computed fields", and a question?
I have had some complex pages for managers on my site that always had problems. Now I'm trying to replace them with admin forms. I have discovered that you can sort based on "follow" notation, and this can include aggregates. I thought I'd post this undocumented feature: is it a "real" feature -- should it be documented? Or is it a side-effect of the current implementation? Note that it doesn't seem to work for "computed fields" -- tacked onto the query set using extra()... I wonder if this is a bug? To clarify what I'm talking about by example: suppose I have the following models: from django.contrib.auth.models import User class Profile( User ): ... class Account( models.Model ): profile = models.OneToOneField( Profile ) class Order( models.Model ): needs_confirm = models.BooleanField( default = True ) sub_total = models.DecimalField( ) tax = models.DecimalField() Now, to make the admin list of profiles sortable by whether needs confirm, the following works: class AdminProfileManager( models.Manager ): def get_query_set( self ): q = super( AdminProfileManager, self ).get_query_set() q = q.annotate( needs_confirmation = BoolOr( 'account__orders__needs_confirm' ) ) return q class AdminProfile( Profile ): objects = AdminProfileManager() class Meta: proxy = True def confirmed( self ): return not self.needs_confirmation confirm.admin_order_field = '-needs_confirmation' confirm.boolean = True class ProfileAdmin( admin.ModelAdmin ): list_display = ( 'first_name', 'last_name', 'email', 'is_active', 'confirmed' ) Now it will sort by whether we need confirmation (btw, the aggregate BoolOr is defined following the recipe in http://groups.google.com/group/django-users/browse_thread/thread/bd5a6b329b009cfa ) However, I can't get it to accept sorting by an field added to the queryset with extra(), eg. (in AdminProfileManager.queryset ) q = q.annotate( subtotal = Sum( 'account__orders__sub_total' ) q = q.annotate( tax = Sum( 'account__orders__tax' ) ) q = q.extra( select = dict( revenue = 'subtotal + tax' ) ) If I refer to "revenue" in an "admin_order_field" attribute... even if I replace the complex expression with a dummy select that merely renames some existing field. Is there some other way to do this? Is this a good candidate for enhancement (should I move over to "developers" or open a ticket?)? Thanks! -- Shaunc -- 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: Need help
The following may help you http://www.3captus.com/download/django_calendar http://code.google.com/p/django-gencal/ http://www.ohloh.net/p/django-calendar http://www.simonharrison.info/django-calendar/ Thanks & Regards, Jiffin Joy Akkarappatty. On Wed, Jun 2, 2010 at 4:56 AM, Dinesh Babu wrote: > Can someone give me a developed Online Calendar application using > Django? I have a project in my Master's. I have no idea in Django. It > will be really helpful if someone really helps me. > > -- > 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. > > -- 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.
django python pi-charts/graphs
Hi Django, I would like to represent my db/model content in the form of pi-charts/graphs. Is there any django python module that already exists ? --RJ -- 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.
Manager.Raw() + Pagination
Hi all, I'm trying to use Djangos new Raw feature to run a custom SQL and return back a list of objects. This works fine however I then want to paginate to present the results as a list. The RawQuerySet has no length value it seems to be able to paginate. Is there a recognised way of achieving this? Do I also need to run a "SELECT COUNT(*)" or should I look at writing my own pagination? Many thanks -- 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.
admin modifications
Hi Django, I am not sure how this could be done, so on the admin display, on one of the columns I would like to provide select tab. If i select one of the options, it should update some other column on the display. Firstly, whats the clean way for adding select boxes on the admin display, it could be one of the columns Secondly, if i select one of those options, could I do it without hitting any server, the ajax way. --RJ -- 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.