Re: Connecting to external databases from Views.py

2012-10-24 Thread Russell Keith-Magee
On Thu, Oct 25, 2012 at 12:43 PM, Gregg Branquinho wrote: > Hi Russel, > > First off thank you for the suggestion, I am going to give it a whirl and > see how it works out.. I have a couple of concerns about the pricing > database it the > * it is on mssql and the data is spread accross 3 databas

Re: Append only tables/models

2012-10-24 Thread Christophe Pettus
On Oct 25, 2012, at 8:26 AM, Mike Burr wrote: > I know there are DBMS-specific ways of doing this. I know that there > are Django ways of making fields read-only. What I cannot find is a > way to make a table/model append-only. You can always override the .save() method to check to see if the pk

Re: environment variable DJANGO_SETTINGS_MODULE is undefined.

2012-10-24 Thread Mike Dewhirst
On 23/10/2012 2:10pm, Mike Dewhirst wrote: On 23/10/2012 8:37am, DjgoNy wrote: I have problem importing from django_tables import tables and when i do it on manage.py shell i get this error. >>> import django_tables2 Traceback (most recent call last): File "", line 1, in File "build\bd

Append only tables/models

2012-10-24 Thread Mike Burr
I know there are DBMS-specific ways of doing this. I know that there are Django ways of making fields read-only. What I cannot find is a way to make a table/model append-only. It'd be great if this were at the DB level, so I don't have to rely on my code not having any holes that allow edits. I do

Re: Connecting to external databases from Views.py

2012-10-24 Thread jirka . vejrazka
Hi Gregg, I've done something similar in the past - had several external databases (MS SQL and Oracle) attached to my Django project. These were backends of enterprise tools, hundreds of tables each. I used the "manage.py inspectdb" command to reverse engineer each "external" DB, manually

Re: "calculated" filed in model

2012-10-24 Thread Mike Burr
On Oct 25, 12:26 pm, Russell Keith-Magee wrote: > Hi Mike, > > Easily done Just as you said. Works like a charm. And as an added benefit, I understand what the code's doing. Caveats noted. Thanks a bunch. -Mike. > , and no need to use signals or raw SQL: just override the save > method on you

Re: implement of view

2012-10-24 Thread Markus Christen
> > Thank you for this page. I take my time today, to learn on it. :) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/a9kvWj-zSjAJ. To post to this group

Re: Connecting to external databases from Views.py

2012-10-24 Thread Gregg Branquinho
Hi Russel, First off thank you for the suggestion, I am going to give it a whirl and see how it works out.. I have a couple of concerns about the pricing database it the * it is on mssql and the data is spread accross 3 database on the same server so the query would have to be cross database..

RE: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread lacrymol...@gmail.com
The short of it is that you should probably subclass the picklefield to add some new validation (basically is_integer_two_tuple_list), and write a custom widget for it that does what you want on the html side. The long of it needs not being written from a phone -Mensaje original- De: A

Re: "calculated" filed in model

2012-10-24 Thread Russell Keith-Magee
Hi Mike, Easily done, and no need to use signals or raw SQL: just override the save method on your model so that every time you call save, the value in the baz column is updated. class Foo(models.Model): bar = models.CharField() baz = models.CharField() def save(self, *args, **kwargs

"calculated" filed in model

2012-10-24 Thread Mike Burr
I would like to accomplish the following: class Foo(models.Model): bar = models.CharField() baz = function(self.bar) Of course this doesn't work (at least as I want it to), but I'm guessing that most humans will know what I'm trying to do. What I want is: 1) User supplies value for 'ba

Re: Python-requests seems to 404 with Django/Tasty-pie?

2012-10-24 Thread Alex
I just discovered that the requests library honors HTTP_PROXY, but does not honor NO_PROXY. Based on what you say below, I'm betting this is your problem, or at least a part of it. One solution is for you to explicitly unset HTTP_PROXY when you don't want it. Another is for you to specify a

Re: Connecting to external databases from Views.py

2012-10-24 Thread Russell Keith-Magee
Hi Gregg, Is there any reason you can't treat this as a mutliple-database configuration? https://docs.djangoproject.com/en/dev/topics/db/multi-db/ Django allows you to specify more than one database, and then direct queries at specific databases. So, you have your "main" django database for your

RE: Best way to detect if a user has changed password

2012-10-24 Thread lacrymol...@gmail.com
If you hook into pre_save, you can compare agaist the DB with MyModel.objects.get(id=object.id) I think there might be a way of checking directly on the instance if a field's been changed in 1.4 -Mensaje original- De: Roarster Enviados: 24/10/2012 18:23:15 Asunto: Best way to detect

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Alphydan
Hi Tomas & John, Thank you for your reply. Basically I'm trying to save curves which I chose to format as: [[0,0],[1,0],[2,1],[3,1], ... ,[40,0]] To see what I tried before (models, etc) you can see the stackoverflow question

Re: Only one profile type of multiple user profiles types gets created.

2012-10-24 Thread Nicolas Emiliani
> The thing is that now the only profile that ever gets created when > creating a user > is AgentProfile. I can't get it to create an AuditorProfile not even by > setting the agency > field on the form. > > > Ok, just for the record, I did it the shameless way. Only one profile class with an profi

Re: Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Nikolas Stevenson-Molnar
Correct. I've found proxying to an HTTP WSGI server to be eaisier as you don't need to configure passing of FastCGI params. I use Gunicorn with nginx, and it requires very little all around configuration. I would expect Gunicorn with lighttpd to be similar. _Nik On 10/24/2012 3:11 PM, Fred wrote:

a way to display a model formset in a ModelAdmin ?

2012-10-24 Thread Nicolas Emiliani
Hi, As the subject states, is there a way to display a model formset in a ModelForm? The thing is that I have a Verification model with its ModelAdmin, and then I have an ImageModel that has no ForeignKey to the Verification model (and I intend to keep it that way) so I can not inline it into the

Re: Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Fred
Thanks guys for the infos. It makes a lot more sense now. So it looks like Lighttpd does not support the equivalent of mod_wsgi, so requires a second server that speaks either FastCGI or HTTP/WSGI. On Wednesday, October 24, 2012 5:58:21 PM UTC+2, Fred wrote: > > Hello > > I'm trying to find how

Re: Best way to detect if a user has changed password

2012-10-24 Thread Brad Pitcher
You could use a "pre_save" signal. kwargs['instance'] will contain the updated record and you can get the old record with "User.objects.get(id= user.id) if user.pk else None". I've done this in the past to check for a changed email address. On Wed, Oct 24, 2012 at 2:23 PM, Roarster wrote: > I'm

Why does BaseHandler::handle_uncaught_exception() not always log?

2012-10-24 Thread Roy Smith
In core/handlers/base.py, handle_uncaught_exception() does: if settings.DEBUG: from django.views import debug return debug.technical_500_response(request, *exc_info) logger.error('Internal Server Error: %s' % request.path, exc_info=exc_info,

Best way to detect if a user has changed password

2012-10-24 Thread Roarster
I'm running a Django 1.4 site and I have some operations I want to perform if a user changes their password. I'm using the standard contrib.auth user accounts with the normal password_change view and I'm not sure if I should somehow hook into this view or if I should use a signal on post_save f

Re: django ajax Post returns empty message

2012-10-24 Thread psychok7
got it, the problem was that i had to change this request.GET.get('type','') to thisrequest.POST.get('type','') On Wednesday, October 24, 2012 9:56:15 PM UTC+1, psychok7 wrote: > > using django 1.4, I can Post but the Post response comes (undefined) empty > but GET works fine. i am using the csr

Re: django ajax Post returns empty message

2012-10-24 Thread psychok7
it seems like its not posting propely, irequest.GET.get('type','') but it prints empty string and the Post response comes (undefined) empty but GET works fine. On Wednesday, October 24, 2012 9:56:15 PM UTC+1, psychok7 wrote: > > using django 1.4, I can Post but the Post response comes (undefine

Re: tree.io installation with django

2012-10-24 Thread Nick Apostolakos
Just use pip and virtualenv. You don have to lock yourself in your distro packaged django Fabian Weiss wrote: >I would like to do, but my Debian Distribution just offers 1.4! Maybe I >can >install another one, but than I probably get Version missmatch.. :/ > >Am Samstag, 15. September 2012 23:

Connecting to external databases from Views.py

2012-10-24 Thread Gregg Branquinho
Hi guys I am new to django and have built my first application that is being used to track and compare pricelists from vendors and it is working awesomly, I have had a request for a new feature and I am alittle boggled at to how I am going to do it.. Basically I wasnt to create a view which ret

django ajax Post returns empty message

2012-10-24 Thread psychok7
using django 1.4, I can Post but the Post response comes (undefined) empty but GET works fine. i am using the csrf checks not sure if the problem also comes from there my django view: @csrf_protect def edit_city(request,username): conditions = dict() #if request.is_ajax(): if req

Re: Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Javier Guerra Giraldez
On Wed, Oct 24, 2012 at 10:58 AM, Fred wrote: > This article says: >> >> Although WSGI is the preferred deployment platform for Django, many people >> use shared hosting, on which protocols such as FastCGI, SCGI or AJP are the >> only viable options. > > > I'm puzzled, because I seemed to understa

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
Just by the way, I'm looking at django-picklefield code and README https://github.com/gintas/django-picklefield and it says NOTHING about a widget, or an admin representation, so.. maybe it's not DESIGNED to be shown on the admin? it'd make sense, too, since it's.. well, it can be ANYTHING On

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
maybe restate the problem, give some more code, show your models, and your admin files, and someone may be able to help a little -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy

virtualenvwrapper dies while mkproject & mkvirtualenv

2012-10-24 Thread Ashkan Roshanayi
Hi I've installed pip using easy_install on my mac and later installed virtualenv and virtualenvwrapper both successfully. wrapper doesn't work at all and when I invoke it by mkproject or mkvirtualenv it go on till this line: > Setting project for test to $PROJECT_HOME/test > and from her

Date widget not HTML5

2012-10-24 Thread Juan Pablo Tamayo
Is there any reason not to have the date widget input tag have the attribute type="date" instead of just type="text"? I mean, most browser do not treat it differently, but it tells them that they should; besides it would mean that Django tries to support the full range of HTML5. Is there a

Internationalization: trans with object property

2012-10-24 Thread Ma Ba
Hi, I have a question about the internationalization feature ... I have a country model: class Country(models.Model): nameKey = models.CharField(max_length=50) shortNameKey = models.CharField(max_length=30) The properties 'nameKey' and 'shortNameKey' contain resource keys like '_country

Re: [Q: Basic] Strange behaviour after pressing on button

2012-10-24 Thread Nikolas Stevenson-Molnar
It's possible that the CSRF token isn't being sent correctly. As a test, try adding the @csrf_exempt decorator to your view. If you no longer get the 403, then it's a CSRF problem. _Nik On 10/24/2012 6:31 AM, Stone wrote: > My Django application is running on real server (apache2-2.2.22). > In ur

Re: Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Nikolas Stevenson-Molnar
The easiest way would probably be to run Gunicorn (http://gunicorn.org/) or some other WSGI HTTP server, and then configure lighttpd as a proxy, e.g: https://gist.github.com/514252 _Nik On 10/24/2012 8:58 AM, Fred wrote: > Hello > > I'm trying to find how to install Python on a Lighttpd server th

Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Fred
Hello I'm trying to find how to install Python on a Lighttpd server that currently runs PHP scripts. This articlesays: > Although WSGI is the preferred deployment platform for Django, many people > use shared hosting, on which p

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread John DeRosa
Nope, I didn't find a solution. I moved on to another issue and never got back to this. We just learned to work around this, I'm semi-ashamed to say. John On Oct 23, 2012, at 2:29 PM, Alphydan wrote: > I have the same problem (on ubuntu, python 2.7, django 1.4, > django-picklefield 0.2.1) ...

Re: implement of view

2012-10-24 Thread Tomas Neme
>> Thank you for your answer. i have chapter 1-4 of >> http://www.djangobook.com/en/2.0/index.html done, but not much time to go >> throught the hole book atm. i will try it with your code. :) the django book is somewhat outdated, and long. https://docs.djangoproject.com/en/dev/intro/tutorial01/

Re: implement of view

2012-10-24 Thread Markus Christen
> > Thank you for your answer. i have chapter 1-4 of > http://www.djangobook.com/en/2.0/index.html done, but not much time to go > throught the hole book atm. i will try it with your code. :) > -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: implement of view

2012-10-24 Thread Tomas Neme
> > how can i implements now these "def sql(request):" into my html code? pls > help me... > you're saying next to nothing, but I *guess* you could do something like return render_to_response("sql.html", { 'row': row }) at the bottom of your sql view, and write an sql.html template that shows it

Re: implement of view

2012-10-24 Thread Markus Christen
> > I forgot, sql is now hardcodet and i have to change it. on first page i > have to give the filter and the username... > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/m

implement of view

2012-10-24 Thread Markus Christen
Hi all i have there a little problem and my knowhow with django is not existent. ^^ What i have... --- urls.py - from django.conf.urls import patterns, include, url from klasse.views import portal, sql urlpatterns = patterns('', (r'^portal/$', portal), (r'^sql/$', sql)

[Q: Basic] Strange behaviour after pressing on button

2012-10-24 Thread Stone
My Django application is running on real server (apache2-2.2.22). In urls.py is mentioned: (r'^configSave/$', configSave), My HTML is bellow. After pressing on configSave I am receiving HTTP 403 error page. In view.py is mentioned: def configSave(request): configFile={} if os.

Re: Django setup with elsatic beanstalk

2012-10-24 Thread Stefano Tranquillini
thx. later i try both yr suggestions. i haven;t been notified of the previous reply. thx On Wednesday, October 24, 2012 12:06:13 AM UTC+2, Andrzej Winnicki wrote: > > Try also to change settings in .elasticbeanstalk/optionsettings. > > > [aws:elasticbeanstalk:application:environment] > DJANGO_SE

Re: Send data back to a table from template or send back to a view

2012-10-24 Thread Thomas Rega
Am 24.10.12 11:26, schrieb Coulson Thabo Kgathi: i used django template language to access value from my models in the database which are coordinates the using javascript i wrote a function that give a list of coordinates that are within a polygon in a map. now i want to send that list back to a

Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work

2012-10-24 Thread Russell Keith-Magee
On Wed, Oct 24, 2012 at 5:51 PM, Stephen Anto wrote: > Hi, > > You can extend Default Django User model without breaking its > architecture. Just visit http://www.f2finterview.com/web/Django/21/ It > will explain you in detail. If you're going to give advice, it's probably a good idea to check t

Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work

2012-10-24 Thread Stephen Anto
Hi, You can extend Default Django User model without breaking its architecture. Just visit http://www.f2finterview.com/web/Django/21/ It will explain you in detail. On Wed, Oct 24, 2012 at 9:32 AM, Surya Mukherjee wrote: > Django's standard User class isn't sufficient for my needs so I am making

Re: Send data back to a table from template or send back to a view

2012-10-24 Thread Coulson Thabo Kgathi
i used django template language to access value from my models in the database which are coordinates the using javascript i wrote a function that give a list of coordinates that are within a polygon in a map. now i want to send that list back to a view or view then database table thanks -- Yo

Re: Send data back to a table from template or send back to a view

2012-10-24 Thread Coulson Thabo Kgathi
i had an array of coordinated tht i got from a dictionary via a view in views.py now i used a javascript function in the template called index.html to find coordinates that are in a polygon and i want to send the list of those coordinates back to the view so that i ca save them into a table.

Re: Billing and invoicing app?

2012-10-24 Thread Stephen Anto
Hi, Why can't you try it yourself, It is very easy only On Wed, Oct 24, 2012 at 7:38 AM, Jesramz wrote: > Quick question, is there a good billing and invoicing app, that anyone can > point me to? > > Thanks all! > > -- > You received this message because you are subscribed to the Google Grou

Re: Send data back to a table from template or send back to a view

2012-10-24 Thread Stephen Anto
Hi, Are you meant form submission? if Yes... Submit your form and get all submitted values in view method using request.POST/GET.copy() Thank you for visiting http://www.f2finterview.com/web/Django/ On Wed, Oct 24, 2012 at 11:35 AM, Coulson Thabo Kgathi wrote: > Please help i have send a dicti

Re: Send data back to a table from template or send back to a view

2012-10-24 Thread Daniel Roseman
On Wednesday, 24 October 2012 07:05:56 UTC+1, Coulson Thabo Kgathi wrote: > Please help i have send a dictionary to a template now i want to send the > processed data back to the database how do i do that in template language > or javascript > Templates don't process data. Do you mean to use a