Hiding auto-generated Django form fields

2012-07-11 Thread DF
I'm attempting to hide an auto-generated form field in a Django form using CSS. Unfortunately, to remove the entire field, the "control group" class requires an ID. The other IDs just use remove the form but leave the label. Is there any way to achieve this? I need the form to remain there invis

Re: Django 1.3 to 1.4

2012-07-11 Thread JJ Zolper
Or I thought it would be okay until I saw these errors when trying to run my server: Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager

Django 1.3 to 1.4

2012-07-11 Thread JJ Zolper
I made the mistake of not deleting the previous django files before I installed django 1.4 When I run: >>> import django >>> print(django.get_version()) 1.4 I see that. I'm sure I'm going beyond naive here but I just didn't want to assume that my django would be fine if I didn't uninstall 1.3

Re: App authoring: setup

2012-07-11 Thread Demian Brecht
Perhaps I wasn't clear.. When I mentioned installing, I meant installing the Django app in a virtualenv through a setup script so that the project has visibility to it (not installing the example project itself). Was just curious if there was another method I was unaware of is all really. Thanks

Re: App authoring: setup

2012-07-11 Thread Russell Keith-Magee
On Thu, Jul 12, 2012 at 9:00 AM, Demian Brecht wrote: > Only a couple small problems with that: > > * No sample code for people utilizing the app in their own projects Really? You can't do what every other popular Django app on github does, and put an examples directory in your repository that is

Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work! from django.core.context_processors import csrf from django.template import RequestContext from django.http import HttpResponseRedirect from django.http import HttpResponse from django.shortcuts import render_to_response from MadTrak.manageabout.models import AboutMadtr

Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work! from django.core.context_processors import csrf from django.template import RequestContext from django.http import HttpResponseRedirect from django.http import HttpResponse from django.shortcuts import render_to_response from MadTrak.manageabout.models import AboutMadtr

Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work! from django.core.context_processors import csrf from django.template import RequestContext from django.http import HttpResponseRedirect from django.http import HttpResponse from django.shortcuts import render_to_response from MadTrak.manageabout.models import AboutMadtr

Re: App authoring: setup

2012-07-11 Thread Demian Brecht
Only a couple small problems with that: * No sample code for people utilizing the app in their own projects * Unit testing environment is a little more unorthodox to set up - rather than just using the example project's settings (and manage.py test app_name), I'd have to do the configuration manua

Re: Django Chuck - Your powerful project punch button

2012-07-11 Thread William Deegan
Bastian, What's the advantage of this over using buildout? -Bill On Jun 11, 2012, at 2:44 AM, Bastian Ballmann wrote: > Hi Django lovers out there, > > for all who didnt attend DjangoCon Europe virtually or physically we > want to announce our project Django Chuck. > > Here's what's all about:

Re: Django connection pooling using sqlalchemy connection pool

2012-07-11 Thread Russell Keith-Magee
On Thu, Jul 12, 2012 at 3:37 AM, Anand Agarwal wrote: > As you know, Django uses new database connection for each request. This > works well initially. However as the load on the server increases, > creating/destroying connections to database starts taking significant amount > of time. You will f

Re: App authoring: setup

2012-07-11 Thread Russell Keith-Magee
On Wed, Jul 11, 2012 at 10:39 PM, Demian Brecht wrote: > Hi all, > > Is there a preferred method to create an app such that the app is the focal > point and not the project? The app root is SCM root and it intended to be > published on PyPI. I see one of two way to go about this: > > First method

Re: JSONField: which app to choose ?

2012-07-11 Thread Michael Palumbo
Hi Matt, Correct, using either null=True or blank=True on the field works. However, I don't get it since I didn't click on "save", I just wanted to display the add page containing it. Why does it attempt to validate the field at this time and not wait for the form to be sent ? Maybe this is how

Re: Catching Oracle Errors

2012-07-11 Thread Dan Gentry
Thanks Ian. I'll see what I can do. > > -- 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/-/EYbdNNR4bS8J. To post to this group, send email to django-users@g

Re: getting variable from __init__ into clean_xxx function

2012-07-11 Thread Leandro Alves
Thanks for sharing, Tomas!! It's in my todo list now... =) Leandro On Wednesday, July 11, 2012 6:11:03 PM UTC+2, Tomas Neme wrote: > > also this: > http://docs.python.org/tutorial/classes.html > > On Wed, Jul 11, 2012 at 12:58 PM, Nikolas Stevenson-Molnar > wrote: > > Change nbi_patch to

Re: getting variable from __init__ into clean_xxx function

2012-07-11 Thread Leandro Alves
Ahhh... okay... I got it... it worked like a charm now!!! =) Super thanks!!! Leandro On Wednesday, July 11, 2012 5:58:20 PM UTC+2, Nikolas Stevenson-Molnar wrote: > > Change nbi_patch to self.nbi_patch, and you should be set. I.e: > > class PatchForm1(forms.Form): > def __init__(self, *a

Django connection pooling using sqlalchemy connection pool

2012-07-11 Thread Anand Agarwal
As you know, Django uses new database connection for each request. This works well initially. However as the load on the server increases, creating/destroying connections to database starts taking significant amount of time. You will find many questions about using

Re: Form 'POST' to a database

2012-07-11 Thread Jani Tiainen
Django makes always (at least currently) full record update (iow: there is no dirty flag for fields). Example given is "poor" in the sense that it uses directly POST data. I strongly would suggest leveraging modelforms when ever possible - it saves time and nerves. You get all the validation and o

Re: Catch or raise exception designissue

2012-07-11 Thread Jani Tiainen
It all depends what is "natural" for end user point of view. If parameter is something like start or end value I think that the most convenient thing is to provide some reasonable default if variable is missing or is incorrect type. Then you may use logging facility to log to some logger (debug, w

Re: feeds and get_object()

2012-07-11 Thread geaden
Hello, Eric! I got an error: get_object() got an unexpected keyword argument 'url', when running the cod which is similiar to your code. Do you know what the problem is? By the way, I do in on Django 1.4. Sorry, for not reply but asking a question insted. On Tuesday, 24 June 2008 06:24:21 UTC+

Re: Catching Oracle Errors

2012-07-11 Thread Ian
On Tuesday, July 10, 2012 7:45:58 AM UTC-6, Dan Gentry wrote: > > My Django app runs on an Oracle database. > > A few times a year, the database is unavailable because of a scheduled > process or unplanned downtime. However, I can't see how to catch the error > and give a useful message back to t

Django Date formats - Please help

2012-07-11 Thread Houmie
Hi everyone, class CallsForm(ModelForm): class Meta: model = Conversation widgets = { 'contact_date': forms.DateInput(), } With a date input like this, my form shows the date like '2012-07-11', which seems international to me. I live in U

Re: model sends two requests

2012-07-11 Thread Jani Tiainen
In one public site we ended up doing both, server side re-submission checks and client side javascript with timeout re-enable "hack". We just store magic key to cache which is checked on every submission. If magic key is missing submission is valid (first one) and key is set if form was valid: if

Re: getting variable from __init__ into clean_xxx function

2012-07-11 Thread Tomas Neme
also this: http://docs.python.org/tutorial/classes.html On Wed, Jul 11, 2012 at 12:58 PM, Nikolas Stevenson-Molnar wrote: > Change nbi_patch to self.nbi_patch, and you should be set. I.e: > > > class PatchForm1(forms.Form): > def __init__(self, *args, **kwargs): > self.nbi_patch = kwa

Static File - help, for a question

2012-07-11 Thread Dott. Tegagni Alessandro
Hi! I do see the static files (images and pdf), I added STATIC_DIRS, the directories when I upload that files: STATICFILES_DIRS = ( '/home/alessandro/Scrivania/progetto/media/photos/custodia/', '/home/alessandro/Scrivania/progetto/media/definitiva/', '/home/alessandro/Scrivania/proge

Re: getting variable from __init__ into clean_xxx function

2012-07-11 Thread Nikolas Stevenson-Molnar
Change nbi_patch to self.nbi_patch, and you should be set. I.e: class PatchForm1(forms.Form): def __init__(self, *args, **kwargs): self.nbi_patch = kwargs.pop('nbi_patch', None) ... def clean_release_number(self): self.nbi_patch #use however you want here _Nik On

Re: Form 'POST' to a database

2012-07-11 Thread Andre Schemschat
> > Hey, >> > yeah, it basicly is. Just a very, very basic example (And sorry if i could highlight this as code, i didnt find something in the format-menu :/ ). Of course you should validate your input first. And if you just want to edit a Model within a form, you should check on the ModelForm-C

Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I guess on Part 4 is what I need... So hmmm. def vote(request, poll_id): p = get_object_or_404(Poll, pk=poll_id) try: selected_choice = p.choice_set.get(pk=request.POST['choice']) except (KeyError, Choice.DoesNotExist): # Redisplay the poll voting form. return

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread JJ Zolper
Thanks so much for the tip! I had part of the solution there from our other friend but I will add that extra protection when I can! Are you familiar with CSRF? And your solution what the issue you fix is? Any other insight into the reason for the code would be great! Thanks again, JJ On Wedn

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread JJ Zolper
1. I don't think I set my id field just name title bio and website. 2. I don't set those two values. 3. not sure.. 4. not sure... I believe you corrected yourself as this post doesn't seem relevant. Not a problem! On Wednesday, July 11, 2012 8:11:46 AM UTC-4, Sergey Fursov wrote: > > Some notes

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread JJ Zolper
Yep it's a problem with my views.py and my template or html page. My html page needed the csrf token tag: {% csrf_token %} and my view needed: return render_to_response('about.html', context_instance=RequestContext(request)) so thanks for the help!!! On Wednesday, July 11, 2012 7:58:5

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread JJ Zolper
I apologize for not responding sooner! This line: return render_to_response('about.html', context_instance=RequestContext(request)) helped immensely! so in order for the render response method to work it has to have some sort of data/context of data passed along with it? I'm still tr

getting variable from __init__ into clean_xxx function

2012-07-11 Thread Leandro Alves
Hi, I'm sending a variable from my views.py and getting it in my forms.py. My form looks like this now: class PatchForm1(forms.Form): def __init__(self, *args, **kwargs): nbi_patch = kwargs.pop('nbi_patch', None) super(PatchForm1, self).__init__(*args, **kwargs) releas

Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
That's great and everything except I've done all that already. I've generated my URLconf, template, and model. Registered the model with the admin site. Created the table from the model in my postgresql database and set up the settings file and used syncdb to connect and make sure I have access

App authoring: setup

2012-07-11 Thread Demian Brecht
Hi all, Is there a preferred method to create an app such that the app is the focal point and not the project? The app root is SCM root and it intended to be published on PyPI. I see one of two way to go about this: First method (my preferred): * Create an app at the root level of a project, us

Re: map in django

2012-07-11 Thread j_syk
This Gist https://gist.github.com/1027898 is an example of a location Model which calls on a helper function when saved to find the lat & long of the address when it is saved. The original snippet of the function is here- http://djangosnippets.org/snippets/2399/ On Wednesday, July 11, 2012 2:

Re: "Cannot convert

2012-07-11 Thread mapapage
> > You were completely right in the first place. It worked! It seemed more > complex to me as I'm newbie in django :) Sorry for the inconvenience.. > You really saved me, thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view thi

Catch or raise exception designissue

2012-07-11 Thread Andre Schemschat
Hi everybody, i'm currently working on my first django-application and stumbled upon a design issue, which i cant quite decide how to handle and i thought i may ask here, if there are any guidelines as to how to handle this :) In my view i have, naturally, some code to process the request and ret

Re: "Cannot convert

2012-07-11 Thread Сергей Фурсов
I think that you can replace if request.method == 'POST': form = WebrequestsForm(request.POST) with: if request.method == 'POST': form = WebrequestsForm(data=request.POST, own_id=own_id) as I said in first answer 2012/7/11 mapapage > I have a legacy db so I have many restric

django-easy-maps not rendering map when using ajax

2012-07-11 Thread Dhiraj Thakur
The error is this "A call to document.write() from an asynchronously-loaded external script was ignored." but i haven't used document.write() anywhere in my jQuery code my template code is this {{address}} {% load easy_maps_tags %} {% easy_map address 725 400 %} This comment

Re: "Cannot convert

2012-07-11 Thread mapapage
> > I have a legacy db so I have many restrictions and conventions. Anyway, > the associated part of views looks like: > def Webrequests(request, user_id): try: owner = Owners.objects.get(id=user_id) except owner.DoesNotExist: print "There isnt an owner with

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Sergiy Khohlov
problem in view also : def about(request): if request.method == 'POST': return HttpResponseRedirect('/about/') elif request.method == 'GET': return render_to_response('about.html', context_instance=RequestContext(request)) else: raise Http404() this one should

Re: "Cannot convert

2012-07-11 Thread Сергей Фурсов
Ok, I tried your code, just added in models.py fake owners model to correct foreign key class Owners(models.Model): num = models.IntegerField() def __unicode__(self): return unicode(self.num) and create views.py with three lines of code: def page(request): form = Webrequests

Re: configure apache and mod_python

2012-07-11 Thread Timothy Makobu
Also, If you can, try Ngix + Gunicorn On Wed, Jul 11, 2012 at 2:38 PM, kenneth gonsalves wrote: > On Wed, 2012-07-11 at 01:03 -0300, Carlos Andre wrote: > > Hi, i'm with a hard problem. also, my apache have a problem he not > > want be stated, i try use the xamppy and now be sure that problem! As

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
oops) 2012/7/11 Сергей Фурсов > Some notes about your models: > 1. why do you create id field manually? Django will do it for you ;) > 2. why do you explicitly set db_table and db_column? Do you have some > legacy database? If not, django will do it for you ;) > 3. move your vision from tables t

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
Some notes about your models: 1. why do you create id field manually? Django will do it for you ;) 2. why do you explicitly set db_table and db_column? Do you have some legacy database? If not, django will do it for you ;) 3. move your vision from tables to objects 4. call your models in CamelCase

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
Ok, I tried your code, just added in models.py fake owners model to correct foreign key class Owners(models.Model): num = models.IntegerField() def __unicode__(self): return unicode(self.num) and create views.py with three lines of code: def page(request): form = Webrequests

Re: configure apache and mod_python

2012-07-11 Thread kenneth gonsalves
On Wed, 2012-07-11 at 01:03 -0300, Carlos Andre wrote: > Hi, i'm with a hard problem. also, my apache have a problem he not > want be stated, i try use the xamppy and now be sure that problem! As > I put apache and mod_python to work? mod_python is deprecated - please do not use it. Use apache an

Re: "Cannot convert

2012-07-11 Thread mapapage
> > part of models.py with the related fields: > class Vehicles(models.Model): id = models.DecimalField(primary_key=True, unique=True, max_digits=127, decimal_places=0) plate = models.CharField(max_length=80, unique=True) own_id1 = models.ForeignKey('Owners', null=True, db_column='o

configure apache and mod_python

2012-07-11 Thread Carlos Andre
Hi, i'm with a hard problem. also, my apache have a problem he not want be stated, i try use the xamppy and now be sure that problem! As I put apache and mod_python to work? Please help i need this! I've tried a lot for tutorials that do not explain, those who have used it wrong! thanks! -- You r

Re: "Cannot convert

2012-07-11 Thread Сергей Фурсов
can you provide your models.py, views.py and forms.py code relative to this problem, I'll try to help, but I need more info 2012/7/11 mapapage > I do it like this: form = WebrequestsForm(own_id=own_id, initial = {...}) >> > but I think that the prob is not there. Somehow it has to do with what i

Re: "Cannot convert

2012-07-11 Thread mapapage
> > I do it like this: form = WebrequestsForm(own_id=own_id, initial = {...}) > but I think that the prob is not there. Somehow it has to do with what it is being returned (and tries to be saved in a decimal field of the form) by these: self.fields['veh_id1'].queryset = Vehicles.objects.filter(o

Re: "Cannot convert

2012-07-11 Thread Сергей Фурсов
I can suppose that you call your modelForm's initialization like form = MyForm(request.POST, own_instance.id) but it should looks like form = MyForm(data=request.POST, own_id= own_instance.id), because there distinction between positional and keyword arguments 2012/7/11 Marilena Papageorgiou >

"Cannot convert

2012-07-11 Thread Marilena Papageorgiou
I have a django modelForm that it was being submitted successfully until I added this code in my forms.py: def __init__(self, own_id=None, **kwargs): super(WebrequestsForm, self).__init__(**kwargs) if own_id: self.fields['veh_id1'].queryset = Vehicles.objects.filter(own

Recommended middleware /tools.tips for profiling a django server

2012-07-11 Thread Gelonida N
Hi, I'm having a nginx / uwsgi / django server and wanted to get some profiling data to identify bottle necks learn more about where time is consumed (80% dynamic difficult to cache contents, so don't worry too much about serving static contents) In this question I'm mostly interested in dja

Re: map in django

2012-07-11 Thread Satvir Toor
On Wed, Jul 4, 2012 at 9:23 PM, yak-man wrote: > You might try browsing these: > The code from Zain's US PyCon2012 tutorial on making interaxtive maps is also > in his github repositories - you might find that interesting. What is link for that??? -- Satvir Kaur satveerkaur.blogspot.in -- Yo

Re: JSONField: which app to choose ?

2012-07-11 Thread Matt Schinckel
Michael, I've been able to reproduce it: I'm not quite sure of the best way to deal with it. One solution is to set either null=True, or blank=True on the field, or set a default. The trick is, an empty string isn't valid JSON. I guess I've always been using a default (usually of {} or [], de