Search Results

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

Page 137/309 | < Previous Page | 133 134 135 136 137 138 139 140 141 142 143 144  | Next Page >

  • Why is it that I cannot insert this into Django correctly?

    - by alex
    new_thing = MyTable(last_updated=datetime.datetime.now()) new_thing.save() >>>>select * from MyTable\G; last_updated: 2010-04-01 05:26:21 However, in my Python console...this is what it says... >>> print datetime.datetime.now() 2010-04-01 10:26:21.643041 So obviously it's off by 5 hours. By the way, the database uses "SYSTEM" as its time, so they should match perfectly. mysql> SELECT current_time; +--------------+ | current_time | +--------------+ | 10:30:16 | +--------------+ >>> print datetime.datetime.now() 2010-04-01 10:30:17.793040

    Read the article

  • Django: Gracefully restart nginx + fastcgi sites to reflect code changes?

    - by Bartek
    Hi, Common situation: I have a client on my server who may update some of the code in his python project. He can ssh into his shell and pull from his repository and all is fine -- but the code is stored in memory (as far as I know) so I need to actually kill the fastcgi process and restart it to have the code change. I know I can gracefully restart fcgi but I don't want to have to manually do this. I want my client to update the code, and within 5 minutes or whatever, to have the new code running under the fcgi process. Thanks

    Read the article

  • Access Validation Rule Violations on Append Query

    - by Jacques Tardie
    I'm recieving the following error on trying to run an append query in access. Microsoft Office Access set .... and it didnt't add... 779280 records(s) due to validation rule violations. If I choose to run the query anyways, nothing actually happens. To give some context, I'm simply trying to copy a populated field, consisting of values similar to "16-2009-02, 34-2010-02, et cetera" to another currently unpopulated field. The fields themselves have no set validation rules, and both have the standard text field options. I'm hoping to be able to simply remove those hyphens, and fix the issue. But I guess that's what I'm not sure about, are those hyphens actually a problem? Running SP3 w/ Access 2003. Thanks in advance!

    Read the article

  • best approach to do jsf form validation

    - by gurupriyan.e
    If I have many input controls in a form (There are separate validators for each of these input controls - like required,length and so on ) , there is a command button which submits the form and calls an action method. The requirement is - though the input control values are , say , individually okay - the combination of these values should be okay to process them together after the form submission - Where do i place the code to validate them together? 1) Can i add a custom validator for the command button and validate the combination together? like validate(FacesContext arg0, UIComponent arg1, Object value) but even then I will not have values of the other input controls except for the command button's/component's value right ? 2) can i do the validation of the combination in the action method and add validation messages using FacesMessage ? or do you suggest any other approach? Thanks for your time.

    Read the article

  • MonoRail - Clearing value on edit form submission doesn't trigger validation

    - by Justin
    Hey, In a MonoRail app I have an add/edit view. On add if I don't pick a value for a dropdown I get a validation error and am forced to pick a value. However, if I then edit that same item and reset the dropdown back to the first item ("Select an Item", "0"), it saves and doesn't say it was invalid. Debugging the entity sent back to the server, I can see that it's sending the original value for the dropdown instead of the new value of "0". What's going on here? The first thing I would expect is that it would trigger the validation since the dropdown value isn't set. The second thing I would expect is that it would send the new value I send, not the original. It does send the new value if I change it to another value, but it's as if it has internal logic that says - "I'm updating this entity and a new value was not passed, just don't change the entity value." Thanks, Justin

    Read the article

  • How do set default values in django for an HttpRequest.GET?

    - by Mike
    I have a webpage that displays data based on a default date. The user can then change their view of the data by slecting a date with a date picker and clicking a submit button. I already have a variable set so that if no date is chosen, a default date is used.... so what's the problem? The problem comes if the user trys to type in the url page without a parameter... like so: http://mywebpage/viewdata (example A) instead of http://mywebpage/viewdata?date= (example B) I tried using: if request.method == 'GET': but apparently, even example A still returns true. I'm sure I'm doing some obvious beginner's mistake but I'll ask anyway... Is there a simpler way to handle example A other than passing the url to a string and checking the string for "?date="?

    Read the article

  • How can I support conditional validation of model properties

    - by Jeff
    I currently have a form that I am building that needs to support two different versions. Each version might use a different subset of form fields. I have to do this to support two different clients, but I don't want to have entirely different controller actions for both. So, I am trying to come up with a way to use a strongly typed model with validation attributes but have some of these attributes be conditional. Some approaches I can think of is similar to steve sanderson's partial validation approach. Where I would clear the model errors in a filter OnActionExecuting based on which version of the form was active. The other approach I was thinking of would to break the model up into pieces using something like class FormModel { public Form1 Form1Model {get; set;} public Form2 FormModel {get; set;} } and then we would validate appropriately depending on

    Read the article

  • JSP to Bean to Java class Validation

    - by littlevahn
    I have a rather simple form in JSP that looks like this: <form action="response.jsp" method="POST"> <label>First Name:</label><input type="text" name="firstName" /><br> <label>Last Name:</label><input type="text" name="lastName" /><br> <label>Email:</label><input type="text" name="email" /><br> <label>Re-enter Email:</label><input type="text" name="emailRe" /><br> <label>Address:</label><input type="text" name="address" /><br> <label>Address 2:</label><input type="text" name="address2" /><br> <label>City:</label><input type="text" name="city" /><br> <label>Country:</label> <select name="country"> <option value="0">--Country--</option> <option value="1">United States</option> <option value="2">Canada</option> <option value="3">Mexico</option> </select><br> <label>Phone:</label><input type="text" name="phone" /><br> <label>Alt Phone:</label><input type="text" name="phoneAlt" /><br> <input type="submit" value="submit" /> </form> But when I try and access the value of the select box in my Java class I get null. Ive tried reading it in as a String and an Array of strings neither though seems to be grabbing the right value. The response.jsp looks like this: <%@ page language="java" %> <%@ page import="java.util.*" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%! %> <jsp:useBean id="formHandler" class="validation.RegHandler" scope="request"> <jsp:setProperty name="formHandler" property="*" /> </jsp:useBean> <% if (formHandler.validate()) { %> <jsp:forward page="success.jsp"/> <% } else { %> <jsp:forward page="retryReg.jsp"/> <% } %> I already have Java script validation in place but I wanted to make sure I covered validation and checking for non-JS users. The RegHandler just uses the name field to refer to the value in the form. Any Idea how I could access the select box's value?

    Read the article

  • jquery.validation - how to ignore default values when validating mandatory fields

    - by jack
    I am using jquery validation plugin to validate a registration form. Each text input field has instructions pre-filled as values in the input box ex: for a text-input box id='Name', the default value will be set to 'Enter Your Name'. I have pasted below sample code: <input type="text" id="Name" value="Enter Your Name" onfocus="if(this.value == 'Your Name'){this.value = '';}" type="text" class="required" onblur="if(this.value == ''){this.value='Your Name';}" size="25" /> What I need to know is how to specify in the validation rule such that the plugin throws a required field error if the input box contains either the default message or empty values. Help much appreciated.

    Read the article

  • Conditionally required jsf validation in a4j form

    - by volothamp
    Hello, I'm having a little problem with using conditionally evaluated expression in jsf/a4j Here's my code <a4j:form> <h:inputText id="id1" value="#{mybean.myvalue}" size="1" required="#{not mybean.condition}" rendered="#{not mybean.condition}" requiredMessage="Put a number in here" /> <h:selectBooleanCheckbox value="#{mybean.condition}"> <a4j:support event="onclick" reRender="id1"/> </h:selectBooleanCheckbox> <a4j:commandButton action="#{mybean.myaction}" value="Do something" /> </a4j:form> The boolean checkbox conditionally enable/disable the validation. This doesn't work: the a4j:commandButton simply skip the validation. Thanks.

    Read the article

  • How to skip interstitial in a django view if a user hits the back button?

    - by Jose Boveda
    I have an application with an interstitial page to hold the user while an intensive operation runs in the background (takes anywhere from 30 secs to 1 minute). Once the operation is done, the user is redirected to the results page. Once on the result page, typical user behavior is to hit the 'back' button to perform the operation on a different input set. However, the back button takes them to the interstitial, not the original form. The desired behavior is to go back to the original form, skipping the interstitial entirely. I'd like this to be default behavior if the user goes to the interstitial page from anywhere but the original form. I thought I could create this by using the @never_cache function decorator in my view for the interstitial, and logic based on request.META['HTTP_REFERER'], however the page doesn't respect these. The browser's back button still trumps this behavior. Any ideas on how to solve this issue?

    Read the article

  • jQuery textbox required validation based on another text box having text

    - by doug
    Pretty basic question, however, I am very new to jQuery and javascript in general. I have a jQuery validation that is requiring a text box to have text in it, if a checkbox is checked. <script type="text/javascript"> $(document).ready(function () { $("form").validate( { rules: { Comments: { required: "#IsAbnormal:checked" } }, messages: { Comments: { required: "Comments are required" } }, onkeyup: false, wrapper: "", errorLabelContainer: "#ErrorMessageBox" }); }); Pretty straight forward, if you check the IsAbnormal checkbox, it will throw a validation if there are no comments. What I am trying to do is require a textbox based on if another text box has any text in it, for instance require the old password if a user enters a new password into a textbox. Is there an easy way to get the required: "#NewPassword:NotBlank" to work?

    Read the article

  • What is the best / proper idiom in django for modifying a field during a .save() where you need to o

    - by MDBGuy
    Hi, say I've got: class LogModel(models.Model): message = models.CharField(max_length=512) class Assignment(models.Model): someperson = models.ForeignKey(SomeOtherModel) def save(self, *args, **kwargs): super(Assignment, self).save() old_person = #????? LogModel(message="%s is no longer assigned to %s"%(old_person, self).save() LogModel(message="%s is now assigned to %s"%(self.someperson, self).save() My goal is to save to LogModel some messages about who Assignment was assigned to. Notice that I need to know the old, presave value of this field. I have seen code that suggests, before super().save(), retrieve the instance from the database via primary key and grab the old value from there. This could work, but is a bit messy. In addition, I plan to eventually split this code out of the .save() method via signals - namely pre_save() and post_save(). Trying to use the above logic (Retrieve from the db in pre_save, make the log entry in post_save) seemingly fails here, as pre_save and post_save are two seperate methods. Perhaps in pre_save I can retrieve the old value and stick it on the model as an attribute? I was wondering if there was a common idiom for this. Thanks.

    Read the article

  • jquery; django; parsing httpresponse

    - by Grinart
    hi_all() I have a problem with parsing http response.. I try send some values to client >>>>return HttpResponse(first=True,second=True) when parsing: $.post('get_values',"",function(data){ alert(data['first']); //The alert isn't shown!!! }); what is the right way to extract values from httpresponse maybe I make a mistake when create my response..

    Read the article

  • simple form validation in dancer/perl

    - by devnull
    I am trying to do a simple form validation in perl dancer but I was wondering what would be the best way to validate simple parameters (e.g. field cannot be empty, validity of the email, minimum length of a field) in dancer/perl without any extra plugin or CPAN module here is the code so far post '/register' => sub { my $db = connect_db(); my $sql = 'insert into users (username, email, password, motivation) values (?, ?, ? ,?)'; my $sth = $db->prepare($sql) or die $db->errstr; $sth->execute(params->{'username'}, params->{'email'},params->{'password'}, params->{'motivation'}) or die $sth->errstr; set_flash('Hey you signed up !'); redirect '/thanks'; }; I did google it and I found several ways to do validation using CPAN modules like Form::Foo but how do it without that ?

    Read the article

  • In Django, how to define a "location path" in order to display it to the users?

    - by naw
    I want to put a "location path" in my pages showing where the user is. Supposing that the user is watching one product, it could be Index > Products > ProductName where each word is also a link to other pages. I was thinking on passing to the template a variable with the path like [(_('Index'), 'index_url_name'), (_('Products'), 'products_list_url_name'), (_('ProductName'), 'product_url_name')] But then I wonder where and how would you define the hierarchy without repeating myself (DRY)? As far I know I have seen two options To define the hierarchy in the urlconf. It could be a good place since the URL hierarchy should be similar to the "location path", but I will end repeating fragments of the paths. To write a context processor that guesses the location path from the url and includes the variable in the context. But this would imply to maintain a independient hierarchy wich will need to be kept in sync with the urls everytime I modify them. Also, I'm not sure about how to handle the urls that require parameters. Do you have any tip or advice about this? Is there any canonical way to do this?

    Read the article

< Previous Page | 133 134 135 136 137 138 139 140 141 142 143 144  | Next Page >