Search Results

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

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

  • Cant get the child dir in django hosting (alwaysdata.com) .

    - by zjm1126
    this is my file : mysite templates homepage.html accounts a.html login_view.html i can get the homepage.html and accounts\a.html on 127.0.0.1:8000 but in http://zjm1126.alwaysdata.net , i can only get the homepage.html ,and cant get the account\a.html , this is my code : return render_to_response('accounts/login_view.html') and the accounts/login_view.html is : {% include "accounts\a.html" %} what can i do , thanks ,

    Read the article

  • What is the difference between a site and an app in Django?

    - by larf311
    I know a site can have many apps but all the examples I see have the site called "mysite". I figured the site would be the name of your site, like StackOverflow for example. Would you do that and then have apps like "authentication", "questions", and "search"? Or would you really just have a site called mysite with one app called StackOverflow?

    Read the article

  • Django: returning a selection of fields from a model based on their values?

    - by AP257
    I am working with some data over which I have little control. I'd like to return ONLY the fields of my model that aren't certain 'uninteresting' values (e.g. '0', 'X' or '-'), and access them individually in the template. My model is like this: class Manors(models.Model): structidx = models.IntegerField(primary_key=True, verbose_name="ID") hills = models.CharField(max_length=100, null=True, blank=True, verbose_name="Number of fields") In my template, I return a QuerySet of Manors, and I'd like to output something like this if the hills field isn't uninteresting: {% for manor in manors %} {% if manor.hills %}<li>Hills blah blah: {{ manor.hills }}</li>{% endif %} {% endfor %} I want to avoid too much logic in the template. Ideally, the manor object would simply not return with the uninteresting fields attached, then I could just do {% if manor.hills %}. I tried writing a model method that returns a dictionary of the interesting values, like this: def get_field_dictionary(self): interesting_fields = {} for field in Manors._meta.fields: if field.value_to_string(self) != "N" and field.value_to_string(self) != "0" and field.value_to_string(self) != "-" and field.value_to_string(self) != "X": interesting_fields[field.name] = field.value_to_string(self) return interesting_fields But I don't know how to access individual values of the dictionary in the template: {% if manor.get_field_dictionary['hills'] %}<li>Hills blah blah: {{ manor.get_field_dictionary['hills'] }}</li>{% endif %} gives a TemplateSyntaxError. Is there a better way to do this?

    Read the article

  • Creating a User Registration Page using MongoEngine

    - by Drew Watkins
    I am currently working an a webapp, using mongoengine and django, which will require users to create an account from a registration page. I know MongoEngine has an authentication backend, but does it also include a registration form, etc..., like django itself does? If not, are there any example projects which show how to implement this? The only open-source mongoengine project I've found is django-mumblr, but I can't find the examples I want in it. I'm not interested in alternative options, such as MongoKit or mango for handling authentication. I am just getting started with django and mongoDB, so please excuse my lack of knowledge. Thanks in advance for the help!

    Read the article

  • MSAccess Change Date Value Before Validation

    - by sisdog
    In a grid I have a date/time field where I would like the user to be able to type in short-hand formats for dates and times. For example, if they type in "435p" and then focus off of the cell they get the message "The value you entered isn't valid for this field.". Instead, I want to trap a pre-validationevent and change it to "4:35pm" for them. What event can I use? I've tried: LostFocus & BeforeUpdate: too late (validation fires before event) Dirty & OnChange: too early (they haven't left the cell yet) Or is there a way to turn off the native validation rule that is checking for date formats?

    Read the article

  • How do I use multiple settings file in Django with multiple sites on one server?

    - by William Bing Hua
    I have an ec2 instance running Ubuntu 14.04 and I want to host two sites from it. On my first site I have two settings file, production_settings.py and settings.py (for local development). I import the local settings into the production settings and override any settings with the production settings file. Since my production settings file is not the default settings.py name, I have to create an environment variable DJANGO_SETTINGS_MODULE='site1.production_settings' However because of this whenever I try to start my second site it says No module named site1.production_settings I am assuming that this is due to me setting the environment variable. Another problem is that I won't be able to use different settings file for different sites. How do I start use two different settings file for two different websites?

    Read the article

  • Django Problem - trying to access data entered into a form and feed it through a different page

    - by John Hoke
    OK, so let me give you an overview first. I have this site and in it there is a form section. When you access that section you can view or start a new project. Each project has 3-5 different forms. My problem is that I don't want viewers to have to go through all 3-5 pages to see the relevant information they need. Instead I want to give each project a main page where all the essential data entered into the forms is shown as non-editable data. I hope this makes sense. So I need to find a way to access all that data from the different forms for each project and to feed that data into the new page I'll be calling "Main". Each project will have a separate main page for itself. I'm pretty much clueless as to how I should do this, so any help at all would be appreciated. Thanks

    Read the article

  • How can I update only certain fields in a Django model form?

    - by J. Frankenstein
    I have a model form that I use to update a model. class Turtle(models.Model): name = models.CharField(max_length=50, blank=False) description = models.TextField(blank=True) class TurtleForm(forms.ModelForm): class Meta: model = Turtle Sometimes I don't need to update the entire model, but only want to update one of the fields. So when I POST the form only has information for the description. When I do that the model never saves because it thinks that the name is being blanked out while my intent is that the name not change and just be used from the model. turtle_form = TurtleForm(request.POST, instance=object) if turtle_form.is_valid(): turtle_form.save() Is there any way to make this happen? Thanks!

    Read the article

  • Remove Validation in ASP.NET MVC 3

    - by johndoe
    I am trying to get remote validation working in ASP.NET MVC 3 but for some reason the validation never gets fired. I am returning json from the controller and in FireFox it ask me to download the files. Not sure what is going on here. Here is my code: @using(Html.BeginForm(new {Action = "ValidateUserName"})) { <text> Enter UserName: </text> @Html.TextBoxFor(x => x.UserName) <input type="submit" value="Login" /> } Here is the RegistrationViewModel: public class RegistrationViewModel { [Required(ErrorMessage = "UserName is required!")] [Remote("ValidateUserName","Home",ErrorMessage ="UserName already taken!")] public string UserName { get; set; } } And here is the HomeController: public ActionResult ValidateUserName(RegistrationViewModel registrationViewModel) { return Json(!registrationViewModel.UserName.Equals("test"),JsonRequestBehavior.AllowGet); }

    Read the article

  • Installing OSQA on windows(Local system)

    - by Pankaj Khurana
    Hi I want to install osqa on windows local system for this i have downloaded bitnami-djangostack-1.1.1-2-windows-installer.exe which has in built django,python,mysql & apache. I have run a django example given on the django website. Its working fine. But i am confused how to install osqa. I have downloaded the source code available on osqa site and readed the installation instruction(requires django 1.1.1). But how to make it working? Please help me on this Thanks

    Read the article

  • Validation of viewstate MAC failed in Safari

    - by Midhat
    Hi I have a web app using forms authentication. When I perform the following steps Let the login cookie expire Click on a link that requires a logged in user The user is redirected to the login page Click the browser back button The user is redirected to the login page again Log in using a valid username/password I get this exception Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. This case appears only in safari (windows and mac). The fundamental difference between safari and other browsers is that when we click the back button in step 4, safari shows the login page again, while the other browsers show the previous page the user was working on. Please help in this regard

    Read the article

  • Validation of method parameters

    - by Anton Tsivarev
    I have a RESTful web service. For implementation using JAX-RS (Jersey). Have the following method: public void foo (@PathParam ("name") String uuid) { ... } I need to do validation of input parameters. And if data invalid throw WebApplicationException. I added my custom annotation CheckUuid (extends ): public void foo (@PathParam ("name") @CheckUuid String uuid) { ... } Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?

    Read the article

  • Rails: Generic form actions, cancel link losing `:back` on validation failure

    - by Patrick Connor
    I am trying to create a generic set of Submit, Cancel, and Destroy actions for forms. At this point, it appears that everything is working, except that I lose :back functionality then a form reloads due to validation errors. Is there a way to catch the fact that validation has failed, and in that case, keep the request.env['HTTP_REFERER'] or :back value the same without having to edit every controller? = simple_form_for @announcement do |f| = f.error_notification = f.input :message = f.input :starts_at = f.input :ends_at #submit = f.button :submit = "or " = link_to("cancel", url_for(:back)) .right - if !f.object.new_record? - resource = (f.object.class.name).downcase = link_to "destroy", url_for(:action => 'destroy'), :confirm => "Are you sure that you want to delete this #{resource}?", :method => :delete .clear .non_input #post_back_msg #indicator.inline = image_tag "indicator.gif" .inline = "Please wait..." .non_input

    Read the article

  • Is there a better way to format this Python/Django code as valid PEP8?

    - by Ryan Detzel
    I have code written both ways and I see flaws in both of them. Is there another way to write this or is one approach more "correct" than the other? def functionOne(subscriber): try: results = MyModelObject.objects.filter( project__id=1, status=MyModelObject.STATUS.accepted, subscriber=subscriber).values_list( 'project_id', flat=True).order_by('-created_on') except: pass def functionOne(subscriber): try: results = MyModelObject.objects.filter( project__id=1, status=MyModelObject.STATUS.accepted, subscriber=subscriber) results = results.values_list('project_id', flat=True) results = results.order_by('-created_on') except: pass

    Read the article

  • Validation controls error message from Resource file and parameterized

    - by BigBoss
    Hi, I would like to get validation messages for validation controls from resource files. I know I can do that easily by following code snippet. <%$ Resources:[filename prefix,]resource-key %> or <asp:Label ID="Label1" runat="server" meta:resourcekey="resource-key-prefix" /> But I would also like to parameterized it. e.g. Above Resource Expression will give me message like "Fill Information.". What I have in resource file is "Fill {0} Information." which should show end user message like "Fill Address Information.".

    Read the article

  • How can I traverse a reverse generic relation in a Django template?

    - by user569139
    I have the following class that I am using to bookmark items: class BookmarkedItem(models.Model): is_bookmarked = models.BooleanField(default=False) user = models.ForeignKey(User) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() And I am defining a reverse generic relationship as follows: class Link(models.Model): url = models.URLField() bookmarks = generic.GenericRelation(BookmarkedItem) In one of my views I generate a queryset of all links and add this to a context: links = Link.objects.all() context = { 'links': links } return render_to_response('links.html', context) The problem I am having is how to traverse the generic relationship in my template. For each link I want to be able to check the is_bookmarked attribute and change the add/remove bookmark button according to whether the user already has it bookmarked or not. Is this possible to do in the template? Or do I have to do some additional filtering in the view and pass another queryset?

    Read the article

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