Search Results

Search found 7702 results on 309 pages for 'django validation'.

Page 68/309 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Catching Oracle Errors in Django

    - by Dashdrum
    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 a give a useful message back to the requester. Instead, a 500 error is triggered, and I get an email (or hundreds) showing the exception. One example is: File "/opt/UDO/env/events/lib/python2.6/site-packages/django/db/backends/oracle/base.py", line 447, in _cursor self.connection = Database.connect(conn_string, **conn_params) DatabaseError: ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege I see a similar error with a different ORA number when the DB is down. Because the exception is thrown deep within the Django libraries, and can be triggered by any of my views or the built in admin views, I don't know where any exception trapping code would go. Any suggestions?

    Read the article

  • Import Error when use templatetags in Django

    - by zmfantasy
    Well, when I'm trying to use 'inclusion' in Django, I met some confused problems that I can't solve it by myself. There is the structures for my project. MyProject--- App1--- __init__.py models.py test.py urls.py views.py App2--- ... template--- App1--- some htmls App2--- ... templatetags--- __init__.py inclusion_test.py manage.py urls.py __init__.py settings.py I have registered templatetags folder in the settings.py (Both in Installed APPS & TEMPLATE_DIRS). But when I want to use {% load inclusion_test %} in my html, it raise an exception like this: 'inclusion_cld_tags' is not a valid tag library: Could not load template library from django.templatetags.inclusion_cld_tags, No module named inclusion_cld_tags I think there is nothing wrong with my import work, how can I do with that? Thanks for help! My django version: 1.0+ My Python version: 2.6.4

    Read the article

  • django (under mod_wsgi) and php

    - by Hellnar
    Hello Under my debian copy, I run a django site runs via apache2 and mod_wsgi. Now I want to include a wordpress to it, for that I need to install php - apache bindings. I am curious what library is recommended for this, aswell as how shall I be doing the apache2 config file ? Here is my current apache 2 000-default file: <VirtualHost *:80> Alias /media /home/myuser/myproject/statics Alias /favicon.ico /home/myuser/myproject/statics/pic/favicon.ico Alias /robots.txt /home/myuser/myproject/templates/robots.txt Alias /admin_media /usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/contrib/admin/media WSGIScriptAlias / /home/myuser/myproject/myproject_wsgi.py WSGIDaemonProcess myproject user=myuser group=myuser threads=25 WSGIProcessGroup myproject </VirtualHost> I want to add Wordpress to my www.mysite.com/blog

    Read the article

  • Migrate a Django project from MySQL to Oracle

    - by pablo
    Hi, I have a Django1.1 project that works with a legacy MySQL db. I'm trying to migrate this project to Oracle (xe and 11g). We have two options for the migration: - Use SQL developer to create a migration sql script. - Use Django fixtures. The schema created with the sql script from sql developer doesn't match the schema created from syncdb. For example, Django expects TIMESTAMP columns while sql developer creates DATE columns. Using syncdb with Django fixtures could be great but when trying to load the MySQL fixtures into Oracle, after using syncdb, I'm getting: IntegrityError: ORA-00001: unique constraint (USER.SYS_C004253) violated How can I find what part create the integrity error? Thanks

    Read the article

  • Django + Pydev/Eclipse + Google App Engine - possible?

    - by Lee Tang
    Has anyone been able to get Google App Engine/Django working in Pydev/Eclipse? I tried this but had difficulty getting Pydev to recognize all of the externally linked folders (django plugins) that I was referencing. I ended up copying all of those folders into the project en masse, rather than referencing them, resulting in a massively bloated project folder - it was really an unworkable solution that eventually made me give up the whole project. So, I'm wondering if anyone has tried this or has any idea what I might have been doing wrong. (Keep in mind this was my first attempt at using Pydev, Django, App Engine and Python!!)

    Read the article

  • Ajax foreign key filter in Django admin interface

    - by Googol
    http://blog.philippmetzler.com/?p=52 Just tried django-ajax-filtered-fields and like it very much. I’m looking for a solution for this problem: My model looks like this: class Song(models.Model): Album = models.ForeignKey(Album) class Artist(models.Model): album = models.ForeignKey(Album) song = models.ForeignKey(Song, blank=True, null=True) So the user has to define a topic. He can also define a subtopic but doesn’t have to. The subtopic belongs to a topic. In the admin interface I’d like to limit the choices for subtopic based upon what he selects in topics. That should change dynamically with AJAX. I will have a closer look to django-ajax-filtered-fields but didn’t find a solution to that specific problem. Perhaps it’s another usecase for django-ajax-filtered-fields in general? Or do you know another solution to my specific requirements?

    Read the article

  • Django and mod_python intermittent error?

    - by Peter
    I have a Django site at http://sm.rutgers.edu/relive/af_api/index/. It is supposed to display "Home of the relive APIs". If you refresh this page many times, you can see different renderings. 1) The expected page. 2) Django "It worked!" page. 3) "ImportError at /index/" page. If you scroll down enough to ROOT_URLCONF part, you will see it says 'relive.urls'. But apparently, it should be 'af_api.urls', which is in my settings.py file. Since these results happen randomly, is it possible that either Django or mod_python is working unstably?

    Read the article

  • use qt and django to create desktop apps

    - by sandra
    Hi guys, I had this idea of creating desktop apps using django. The principe being: - Write the django app, and use something like cherrypy to serve it. - Write a Qt app in C++ to access it and this by using QtWebview (webkit) I'd like to "bundle" this in a single app. The lighter, the better :) So here are my questions and if you have better ideas and suggestions, please share them :) Is it possible to serve a django app with a c++ one? (a c++ server embedding python)? anyone did this before? Do you have some articles, blog posts? Thanks a lot!

    Read the article

  • Django nose to run only project tests

    - by patroqueeet
    I added nose, django-nose, nose-exclude, coverage to my buildout.cfg and ran buildout. Furthermore I added the TEST_RUNNER and the NOSE_ARGS to my settings.py. In the last step I created a exclude_dirs.txt and included it into the NOSE_ARGS. That worked so far. Finally I ran bin/django testto run the tests of my project. I found out that every app inside INSTALLED_APP is run and that even parts of the django core models are run. How can I limit this to my project only without exernal packages?

    Read the article

  • Autocomplete with Django, jQuery and google app engine

    - by Ron
    Hey guys, I'm new to Django and jQuery, but I have a lot of python experience. I'm basically trying to write an HTML form, with one text box for now, that as you type in it, shows you auto completion options. this will be used for finding restaurants, and I intend to use the Yelp API for that. can someone please point me out in a direction of a tutorial on how to do this - specifically with regards to the Django / HTML / jQuery rather than how to work with the Yelp API? Are there any tutorials I should read? All tutorials I have found are very basic ones that build forms from the Django data models.. Thanks!

    Read the article

  • Including a Django app's url.py is resulting in a 404

    - by 828
    I have the following code in the urls.py in mysite project. /mysite/urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^gallery/$', include('mysite.gallery.urls')), ) This results in a 404 page when I try to access a url set in gallery/urls.py. /mysite/gallery/urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^gallery/browse/$', 'mysite.gallery.views.browse'), (r'^gallery/photo/$', 'mysite.gallery.views.photo'), ) 404 error Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^gallery/$ The current URL, gallery/browse/, didn't match any of these. Also, the site is hosted on a media temple (dv) server and using mod_wsgi

    Read the article

  • trying to load css/images in django

    - by tipu
    I looked http://docs.djangoproject.com/en/dev/howto/static-files/ already, but am still confused on how to get css/image files loaded. On my server, the images folder and css file are located at /srv/twingle/search my urls.py 1 from django.conf.urls.defaults import * 2 3 # Uncomment the next two lines to enable the admin: 4 # from django.contrib import admin 5 # admin.autodiscover() 6 7 urlpatterns = patterns('twingle.search.views', 8 url(r'^$', 'index'), 9 url(r'^search/(?P<param>\w+)$', 'index'), 10 ) 11 (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', 12 {'document_root': '/srv/twingle/search'}), 13 I try to access my css as follows, <link rel="stylesheet" type="text/css" href="/site_media/style.css" /> That's exactly how the tutorial says to do it, but it doesn't work. Any suggestions?

    Read the article

  • Django: how to create sites dynamically?

    - by Leandro Ardissone
    Hi, I need to create an application for the company where I can create sites dynamically. For example, I need an admin interface (Django's admin is enough) where I can setup a new site and add some settings to it. Each site must hold a domain (domains can be manually added to apache conf, but if Django can handle it too would be awesome). Each site must be independent of the others, I mean, I shouldn't be able to see the data content of other sites but I can share same applications/models. I've seen the Django's Sites framework, but I'm not sure if it's possible to implement that way. Should I use Sites framework or create a new app that can handle sites better? What do you think?

    Read the article

  • server reboot has caused django project to lose directories

    - by wmfox3
    A fully functional Django project as well as a couple in development have all broken following the rebooting of the server. In addition to some pieces of the Django admin returning errors as well as missing .js and .css files, I'm getting errors like this when viewing pages that include images uploaded through the admin. Exception Type: TemplateSyntaxError Exception Value: Caught an exception while rendering: (2, 'No such file or directory') Exception Location: /usr/lib/pymodules/python2.6/django/template/debug.py in render_node, line 81 Python Executable: /usr/bin/python Python Version: 2.6.4 So did the reboot stomp on some part of my configuration/setup or did it fail to restart a critical piece?

    Read the article

  • Django: automatically import MEDIA_URL in context

    - by pistacchio
    Hi, like exposed here, one can set a MEDIA_URL in settings.py (for example i'm pointing to Amazon S3) and serve the files in the view via {{ MEDIA_URL }}. Since MEDIA_URL is not automatically in the context, one have to manually add it to the context, so, for example, the following works: #views.py from django.shortcuts import render_to_response from django.template import RequestContext def test(request): return render_to_response('test.html', {}, context_instance=RequestContext(request)) This means that in each view.py file i have to add from django.template import RequestContext and in each response i have to explicitly specify context_instance=RequestContext(request). Is there a way to automatically (DRY) add MEDIA_URL to the default context? Thanks in advance.

    Read the article

  • Django: url and content creation results in 500 and no apache error log entry

    - by user1684082
    If i try to open a created url i get an 500 error. My procedure was: First python manage.py startapp black I added in project/settings.py under INSTALLED_APPS 'black', I added in project/urls.py url(r'^test/', include('black.urls')), Content of black/urls.py is: from django.conf.urls import patterns, url from black import views urlpatterns = patterns('', url(r'^$', views.index, name='index') ) And content of black/views.py: from django.http import HttpResponse def index(request): return HttpResponse("SHOW ME: BLACK") After all i synced the database. I can't see any error in apache-error-log and also not in my posted django files. What could cause this?

    Read the article

  • PHP CURL sending POST to Django app issue

    - by Felipe Pelá
    This code in PHP sends a HTTP POST to a Django app using CURL lib. I need that this code sends POST but redirect to the page in the same submit. Like a simple form does. The PHP Code: $c = curl_init(); curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); curl_setopt($c, CURLOPT_URL, "http://www.xxx.com"); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, 'Var='.$var); curl_exec($c); curl_close ($c); In this case, the PHP is sending the HTTP POST, but is not redirecting to the page. He is printing the result. My URL still .php and not a django/url/ I need be redirected to the django URL with the Post like a simple form in HTML does. Any Idea? Thanks.

    Read the article

  • PHP Form - Empty input enter this text - Validation

    - by James Skelton
    No doubt very simple question for someone with php knowledge. I have a form with a datepicker, all is fine when a user has selected a date the email is send with: Date: 2012 04 10 But i would like if the user has skipped this and left blank (as i have not made this required) to send as: Date: Not Entered (<-- Or something) Instead at the minute of course it reads: Date: Form input <input type="text" class="form-control" id="datepicker" name="datepicker" size="50" value="Date Of Wedding" /> This is the validator $(document).ready(function(){ //validation contact form $('#submit').click(function(event){ event.preventDefault(); var fname = $('#name').val(); var validInput = new RegExp(/^[a-zA-Z0-9\s]+$/); var email = $('#email').val(); var validEmail = new RegExp(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/); var message = $('#message').val(); if(fname==''){ showError('<div class="alert alert-danger">Please enter your name.</div>', $('#name')); $('#name').addClass('required'); return;} if(!validInput.test(fname)){ showError('<div class="alert alert-danger">Please enter a valid name.</div>', $('#name')); $('#name').addClass('required'); return;} if(email==''){ showError('<div class="alert alert-danger">Please enter an email address.</div>', $('#email')); $('#email').addClass('required'); return;} if(!validEmail.test(email)){ showError('<div class="alert alert-danger">Please enter a valid email.</div>', $('#email')); $('#email').addClass('required'); return;} if(message==''){ showError('<div class="alert alert-danger">Please enter a message.</div>', $('#message')); $('#message').addClass('required'); return;} // setup some local variables var request; var form = $(this).closest('form'); // serialize the data in the form var serializedData = form.serialize(); // fire off the request to /contact.php request = $.ajax({ url: "contact.php", type: "post", data: serializedData }); // callback handler that will be called on success request.done(function (response, textStatus, jqXHR){ $('.contactWrap').show( 'slow' ).fadeIn("slow").html(' <div class="alert alert-success centered"><h3>Thank you! Your message has been sent.</h3></div> '); }); // callback handler that will be called on failure request.fail(function (jqXHR, textStatus, errorThrown){ // log the error to the console console.error( "The following error occured: "+ textStatus, errorThrown ); }); }); //remove 'required' class and hide error $('input, textarea').keyup( function(event){ if($(this).hasClass('required')){ $(this).removeClass('required'); $('.error').hide("slow").fadeOut("slow"); } }); // show error showError = function (error, target){ $('.error').removeClass('hidden').show("slow").fadeIn("slow").html(error); $('.error').data('target', target); $(target).focus(); console.log(target); console.log(error); return; } });

    Read the article

  • Can Django flush its database(s) between every unit test

    - by mikem
    Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not flushed. One of the effects of flushing the database is the auto_increment counters are reset. Consider a test which pulls data out of the database by primary key: class ChangeLogTest(django.test.TestCase): def test_one(self): do_something_which_creates_two_log_entries() log = LogEntry.objects.get(id=1) assert_log_entry_correct(log) log = LogEntry.objects.get(id=2) assert_log_entry_correct(log) This will pass because only two log entries were ever created. However, if another test is added to ChangeLogTest and it happens to run before test_one, the primary keys of the log entries are no longer 1 and 2, they might be 2 and 3. Now test_one fails. This is actually a two part question: Is it possible to force ./manage.py test to flush the database between each test case? Since Django doesn't flush the DB between each test by default, maybe there is a good reason. Does anyone know?

    Read the article

  • Design Documents for Python/Django?

    - by british_trader
    After working on a Django project for a while, I now have to do some design documents for it (UML type stuff). However the code doesn't have classes, but instead uses views.py with modules in it... What would be the best way to show the design of my application from the initial __init__.py, to the urls.py where the HTML requests are then filtered to the specific urls.py in each of the packages and then handled by the views.py? i.e. django-app urls.py views.py settings.py manager.py __init__.py django-package urls.py views.py

    Read the article

  • django/apache permissions problem

    - by Kevin
    I'm running a django project on Centos 5.4 and serving it with httpd/mod_wsgi. I can't figure out the correct permissions for /home/website/django_project so that I don't get a 403 error. In my httpd.conf the user and group to run httpd as is apache. The group django is set up with website and apache as members. The owner of /home/website and all subdirs is website:django, and the permissions are rwxrwx---. Right now the project works fine with the dev server, but if I try to view it through apache, I get a 403 error. chmod -R o+rx /home/website/django_project fixes the problem, but this obviously isn't a good solution. Thanks

    Read the article

  • JQuery Checkbox with Textbox Validation

    - by Volrath
    I am using Jorn's validation plugin. I have a a group of checkboxes beside a group of textboxes. The textboxes are disabled by default and will enable when the matching checkbox is checked. At least 1 checkbox has to be checked which is not a problem. However, when I check more than 2 checkboxes only 1 textbox validates. The form still submits even when the second checkbox is empty. $count = 0; while($row = mysql_fetch_array($rs)) { ?> <tr> <td> <label> <input type="checkbox" name="tDays[]" id="tDays<?php echo $count; ?>" value="<?php echo $row['promoDayID'];?>" onClick="enableTxt();" <?php if((isset($arrTDays) && in_array_THours($row['promoDayID'], $arrTDays)) || (!empty($arrSelectedTHours) && in_array_THours($row['promoDayID'], $arrSelectedTHours))) { echo "checked='checked'"; }?> validate="required:true" /> <?php echo $row['promoDay'];?>: </label> </td> <td align="right"> <input type="textbox" size="45" style="font-size:12px" name="tHours[]" id="tHours<?php echo $count; ?>" <?php if(isset($arrTDays) && in_array_THours($row['promoDayID'], $arrTDays)) { echo "value='" .getHours($row['promoDayID'], $arrTDays) ."'"; } elseif (!empty($arrSelectedTHours) && in_array_THours($row['promoDayID'], $arrSelectedTHours)) { echo "value='" .getHours($row['promoDayID'], $arrSelectedTHours). "'"; } else { echo "value='' disabled='disabled'"; }?> class="required" /> <label for="tHours[]" class="error" id="tHourserror<?php echo $count; ?>">Please enter the Trading Hour.</label> </td> </tr> <?php $count++; }//while ?> This is done using javascript: function enableTxt() { for (i = 0; i <= 7; i++) { if (document.getElementById("tDays" + i) != null && document.getElementById("tDays" + i).checked == true) { document.getElementById('tHours' + i).disabled = false; document.getElementById('tHourserror' + i).style.visibility = "visible"; } else if (document.getElementById("tDays" + i) != null) { document.getElementById('tHours' + i).disabled = "disabled"; document.getElementById('tHours' + i).value = ""; document.getElementById('tHourserror' + i).style.visibility = "hidden"; } } } Please kindly advise in detail as to how this problem can be solved. I am fairly weak in JQuery.

    Read the article

  • Django logging in and out - doesn't work if prepend_www set

    - by ropz
    I'm a Django beginner. My site - let's call it abc.com - works fine, letting users log in and out (having originally registered via Django registratiaon). If it's relevant, my virtuahosts file has ServerName abc.com and ServerAlias www.abc.com directives. I don't want my visitors to sense that both abc.com and www.abc.com exist, and so discovered Django's prepend_www setting, which works as intended. In addition to working as intended, however, there's a side effect that disables logging in and out when visiting the www. variant of my site.

    Read the article

  • Javascript form validation only works in firefox

    - by Logic Artist
    Hello, I am relatively new to Javascript so I'm hoping this is a simple mistake. I building a generic form validation function that is called on the form's onSubmit. The function loops through all the form's child elements, looks for certain classes, and analyzes the contents of the appropriate fields. If it finds something missing or erroneous, it displays the appropriate error message div and returns false, thus preventing the form from being submitted to the php page. It works well in firefox 3.6.3, but in every other browser I've tested (Safari 4.0.4, Chrome 4.1, IE8) it seems to ignore the onSubmit and jump straight to the php processing page. HTML CODE: <form name='myForm' id='myForm' action='process_form.php' method='post' onSubmit="return validateRequired('myForm')"> <fieldset class="required radioset"> <label for='selection1'> <input type='radio' name='selection' id='selection1' value='1'/> Option 1 </label> <label for='selection2'> <input type='radio' name='selection' id='selection2' value='2'/> Option 2 </label> <label for='selection3'> <input type='radio' name='selection' id='selection3' value='3'/> Option 3 </label> <label for='selection4'> <input type='radio' name='selection' id='selection4' value='4'/> Option 4 </label> <div class='errorBox' style='visibility:hidden'> Please make a selection </div> </fieldset> <fieldset class="required checkset"> <label> Choice 1 <input type='checkbox' name='choices' id='choice1' value='1'/> </label> <label> Choice 2 <input type='checkbox' name='choices' id='choice2' value='2'/> </label> <label> Choice 3 <input type='checkbox' name='choices' id='choice3' value='3'/> </label> <label> Choice 4 <input type='checkbox' name='choices' id='choice4' value='4'/> </label> <div class='errorBox' style='visibility:hidden'> Please choose at least one </div> </fieldset> <fieldset class="required textfield" > <label for='textinput1'> Required Text: <input type='text' name='textinput1' id='textinput1' size='40'/> </label> <div class='errorBox' style='visibility:hidden'> Please enter some text </div> </fieldset> <fieldset class="required email textfield"> <label for='email'> Required Email: <input type='text' name='email' id='email' size='40'/> </label> <div class='errorBox' style='visibility:hidden'> The email address you have entered is invalid </div> </fieldset> <div> <input type='submit' value='submit'> <input type='reset' value='reset'> </div> </form> JAVASCRIPT CODE: function validateRequired(id){ var form = document.getElementById(id); var errors = 0; var returnVal = true; for(i = 0; i < form.elements.length; i++){ var elem = form.elements[i]; if(hasClass(elem,"required")){ /*RADIO BUTTON or CHECK BOX SET*/ if(hasClass(elem,"radioset") || hasClass(elem,"checkset")){ var inputs = elem.getElementsByTagName("input"); var check = false; for(j = 0; j < inputs.length; j++){ if(inputs[j].checked){ check = true; } } if(check == false){ errors += 1; showError(elem); } else { hideError(elem); } } /*TEXT FIELD*/ else if(hasClass(elem,"textfield")){ var input = elem.getElementsByTagName("input"); if(input[0].value == ""){ errors += 1; showError(elem); } else { hideError(elem); /*EMAIL ADDRESS*/ if(hasClass(elem,"email")){ if(isValidEmail(input[0].value) == false){ errors += 1; showError(elem); } else { hideError(elem); } } } } } } if(errors > 0){ returnVal = false; } else { returnVal = true; } return returnVal;} I know this is a lot of code to look at, but any help would be appreciated. Since it works fine in one browser, Im not sure how to start debugging. Thanks Andrew

    Read the article

  • Validating an XML document fragment against XML schema

    - by shylent
    Terribly sorry if I've failed to find a duplicate of this question. I have a certain document with a well-defined document structure. I am expressing that structure through an XML schema. That data structure is operated upon by a RESTful service, so various nodes and combinations of nodes (not the whole document, but fragments of it) are exposed as "resources". Naturally, I am doing my own validation of the actual data, but it makes sense to validate the incoming/outgoing data against the schema as well (before the fine-grained validation of the data). What I don't quite grasp is how to validate document fragments given the schema definition. Let me illustrate: Imagine, the example document structure is: <doc-root> <el name="foo"/> <el name="bar"/> </doc-root> Rather a trivial data structure. The schema goes something like this: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="doc-root"> <xsd:complexType> <xsd:sequence> <xsd:element name="el" type="myCustomType" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="myCustomType"> <xsd:attribute name="name" use="required" /> </xsd:complexType> </xsd:schema> Now, imagine, I've just received a PUT request to update an 'el' object. Naturally, I would receive not the full document or not any xml, starting with 'doc-root' at its root, but the 'el' element itself. I would very much like to validate it against the existing schema then, but just running it through a validating parser wouldn't work, since it will expect a 'doc-root' at the root. So, again, the question is, - how can one validate a document fragment against an existing schema, or, perhaps, how can a schema be written to allow such an approach. Hope it made sense.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >