Re: Django structure

2015-03-08 Thread Ilya Kazakevich
There are 2 types of Apps in Django: 1) reusable one with clear, documented interface 2) not reusable one, because it depends on current project heavily. Ideally, project consists of several reusable-apps, and project-specific data is stored in project-specific places like URLConf or filesystem

Re: [Choose Database based on geolocalization]

2015-03-08 Thread Russell Keith-Magee
On Sun, Mar 8, 2015 at 9:15 PM, 'Petros Moisiadis' via Django users < django-users@googlegroups.com> wrote: > On 03/08/2015 01:42 AM, Russell Keith-Magee wrote: > > Hi Xina, > > > > The short answer is "not easily, and not within Django". > > > > Django's DB Routers don't contain any detail about

Re: Detecting modifications in ManyToMany field

2015-03-08 Thread Vijay Khemlani
Haven't tested it, but the "pre_add" and "pre_remove" actions in the m2m_changed signal should be triggered before the change, and they include a pk_set arg with the id's of the related M2M model being added / removed. You could also link to the post_save and post_remove which contain the same

Re: Detecting modifications in ManyToMany field

2015-03-08 Thread Fabien Schwob
With the m2m changed signal I can only have the state of the object after it has been saved. Not the difference between before and after the change. On sam. 7 mars 2015 at 16:53 Vijay Khemlani wrote: > You might find the m2m_changed signal useful > >

Django server serving cached template pages

2015-03-08 Thread Bryan Arguello
I am on the second page of the blog tutorial and am trying to change the base-site.html template. I make a few small changes, set the permissions to 755, put it in a subdirectory named 'admin' within a directory called 'template' inside of the project directory. I also add the template

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2015-03-08 Thread Bryan Arguello
Have you solved this problem, Andreas? I am having the same issue and have done everything that the tutorial described as well as everything that people on this thread have suggested. On Sunday, November 16, 2014 at 12:15:59 PM UTC-6, Andreas Ka wrote: > > I am working through >

Re: FORM: How to specify current user as value for a form ForeignKey referencing logged on user

2015-03-08 Thread Vijay Khemlani
If you are using a modelform then you don't need to re-define the original model fields, in this case Class AccountForm(forms.ModelForm): class Meta: model = Accounts fields = ['authid', 'authtoken', 'provider'] You leave the "user" field out as it is not part of the form

Django structure

2015-03-08 Thread Gabriel Klein
Hi there, I'm going to start a big project using Django. It will have 3 main sections: - A "Frontend" section: Where the user will consult the data. - A "Backend" section: Where the ETL and Admins will organize the data - A User Management section: Where I'll manage user permission, Oauth for

FORM: How to specify current user as value for a form ForeignKey referencing logged on user

2015-03-08 Thread Ryan Alexander
Hey there, This seems like something that should be simple to do but I'm having a heck of a time with it and google searches don't reference anything that's helping me out. I have a form that a user fills out, and it creates a db row based on the input. Model as below: class

Re: Generic Relation in Legacy Database?

2015-03-08 Thread Avraham Serour
use inspectdb to start On Sun, Mar 8, 2015 at 5:31 PM, Nan wrote: > > Hi folks -- > > I'm building out Django models to represent a legacy PHP app's database in > order to throw together a quick admin panel. Everything's working great > except that the ORM of the other

Generic Relation in Legacy Database?

2015-03-08 Thread Nan
Hi folks -- I'm building out Django models to represent a legacy PHP app's database in order to throw together a quick admin panel. Everything's working great except that the ORM of the other application represents generic relations slightly differently than Django's does. I can't modify

Re: Django 1.6.4 debug-toolbar confusing error

2015-03-08 Thread Martin Torre Castro
I fixed it by following this http://django-debug-toolbar.readthedocs.org/en/1.2.2/installation.html In my case, I had the wrong name in INSTALLED_APPS and I lacked this piece of code in urls: if settings.DEBUG: import debug_toolbar urlpatterns += patterns('',

Re: [Choose Database based on geolocalization]

2015-03-08 Thread senav103
Yes, it should be quite straightforward to implement. Setup the appropriate databases, say, db_asia, db_euro, etc. Create separate apps asia, euro, etc. Create a db_router that makes asia models sticky to db_asia, etc. Create a handler that returns the appropriate model to use based on

Re: [Choose Database based on geolocalization]

2015-03-08 Thread 'Petros Moisiadis' via Django users
On 03/08/2015 01:42 AM, Russell Keith-Magee wrote: > Hi Xina, > > The short answer is "not easily, and not within Django". > > Django's DB Routers don't contain any detail about the request, so > there's no ability to geolocated the requesting IP for routing > purposes. For the record, this is

Accessing Django models using DJANGO_SETTINGS_MODULE

2015-03-08 Thread Dheerendra Rathor
I've a django project and I've few models like ChatRoom and Chat etc I'm accessing the ChatRooms from commandline using ipython as follow In [1]: import os In [2]: os.environ['DJANGO_SETTINGS_MODULE'] = 'chat_project.settings' In [3]: from chat.models import Chat, ChatRoom In [4]:

Re: getting tuples from http request.GET

2015-03-08 Thread Jonathan Querubina
You could use the same variable name on the querystring and call: request.GET.getlist For example, on a select multiple field ou checkbox  John Mobile & Web developer +55(12)98864-1594 > On Mar 8, 2015, at 00:01, Sunil Sawant wrote: > > Thanks Collin, you cut out

Re: Django 1.6.4 debug-toolbar confusing error

2015-03-08 Thread Martin Torre Castro
I have same problem. May it be related to urlconf? On Friday, 23 May 2014 12:06:19 UTC+2, Florian Auer wrote: > > Hi > > I am running 2 django 1.6.4 projects, both with debug toolbar enabled. > > The first one ist a simple project, following the a cookbook tutorial and > the toolbar works fine