Search Results

Search found 4109 results on 165 pages for 'django paypal'.

Page 26/165 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • how to do server side form validation for dynamic inputs with Django

    - by Satoru.Logic
    Hi, all. I am using django.forms.Form to validate form data in a survey applications. In a survey-creating form, a user can submit multiple questions that belong to the survey being created. Names for the question inputs are in the form of 'question_seq' , where seq is maintained using Javascript. Back in the server side, my code doesn't know before hand how many such questions will be submitted. Is there any way to do this with Django form so that the form can automatically recognizes the questions and validate them?

    Read the article

  • Django - how to make ImageField/FileField optional?

    - by ilya
    class Product(models.Model): ... image = models.ImageField(upload_to = generate_filename, blank = True) When I use ImageField (blank=True) and do not select image into admin form, exception occures. In django code you can see this: class FieldFile(File): .... def _require_file(self): if not self: raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) def _get_file(self): self._require_file() ... Django trac has ticket #13327 about this problem, but seems it can't be fixed soon. How to make these field optional?

    Read the article

  • Django: Data corrupted after loading? (possible programmer error)

    - by Rosarch
    I may be loading data the wrong way. excerpt of data.json: { "pk": "1", "model": "myapp.Course", "fields": { "name": "Introduction to Web Design", "requiredFor": [9], "offeringSchool": 1, "pre_reqs": [], "offeredIn": [1, 5, 9] } }, I run python manage.py loaddata -v2 data: Installed 36 object(s) from 1 fixture(s) Then, I go to check the above object using the Django shell: >>> info = Course.objects.filter(id=1) >>> info.get().pre_reqs.all() [<Course: Intermediate Web Programming>] # WRONG! There should be no pre-reqs >>> from django.core import serializers >>> serializers.serialize("json", info) '[{"pk": 1, "model": "Apollo.course", "fields": {"pre_reqs": [11], "offeredIn": [1, 5, 9], "offeringSchool": 1, "name": "Introduction to Web Design", "requiredFor": [9]}}]' The serialized output of the model is not the same as the input that was given to loaddata. The output has a non-empty pre_req list, whereas the input's pre_reqs field is empty. What am I doing wrong?

    Read the article

  • Sorting related objects in the Django Admin form interface

    - by Carver
    I am looking to sort the related objects that show up when editing an object using the admin form. So for example, I would like to take the following object: class Person(models.Model): first_name = models.CharField( ... ) last_name = models.CharField( ... ) hero = models.ForeignKey( 'self', null=True, blank=True ) and edit the first name, last name and hero using the admin interface. I want to sort the objects as they show up in the drop down by last name, first name (ascending). How do I do that? Context I'm using Django v1.1. I started by looking for help in the django admin docs, but didn't find the solution As you can see in the example, the foreign key is pointing to itself, but I expect it would be the same as pointing to a different model object. Bonus points for being able to filter the related objects, too (eg~ only allow selecting a hero with the same first name)

    Read the article

  • Django: Why Doesn't the Current URL Match any Patterns in urls.py

    - by austin_sherron
    I've found a few questions here related to my issue, but I haven't found anything that has helped me resolve my issue. I'm using Python 2.7.5 and Django 1.8.dev20140627143448. I have a view that's interacting with my database to delete objects, and it takes two arguments in addition to a request: def delete_data_item(request, dataclass_id, dataitem_id): form = AddDataItemForm(request.POST) data_set = get_object_or_404(DataClass, pk=dataclass_id) context = {'data_set': data_set, 'form': form} data_item = get_object_or_404(DataItem, pk=dataitem_id) data_item.delete() data_set.save() return HttpResponseRedirect(reverse('detail', args=(dataclass_id,))) The URL in myapp.urls.py looks something like this: url(r'^(?P<dataclass_id>[0-9]+)/(?P<dataitem_id>[0-9]+)/delete_data_item/$', views.delete_data_item, name='delete_data_item') and the portion of my template relevant to the view is: <a href="{% url 'delete_data_item' data_set.id data_item.id %}">DELETE</a> Whenever I click on the DELETE link, django tells me that the request URL: http://127.0.0.1:8000/myapp/5/%7B%%20url%20'delete_data_item'%20data_set.id%20data_item.id%20%%7D doesn't match any of my URL patterns. What am I missing? The URL on which the DELETE links exist is myapp/(<dataclass_id>[0-9]+)/

    Read the article

  • Getting a KeyError in DB backend of django-digest

    - by rtmie
    I have just started to integrate django_digest into my app. As a start I have added the @httpdigest decorator to one of my views. If I try to connect to it I get a KeyError exception thrown in django_digest/backend/db.py . Depending on which db I configure I get a different KeyError in a different location. I am using Django 1.2.1, with MySql (also tested with sqlite). I am using the default values for all the settings options. As far as I can see I have followed all instructions but am struggling all day with this. I am using the repository versions of django-digest and python-digest. Any steer would be greatly appreciated. Tracebacks for sqlite and mysql below: with sqlite: Traceback (most recent call last): File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 248, in __call__ signals.request_finished.send(sender=self.__class__) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/dispatch/dispatcher.py", line 162, in send response = receiver(signal=self, sender=sender, **named) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/backend/db.py", line 16, in close_connection _connection.close() File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 186, in close if self.settings_dict['NAME'] != ":memory:": KeyError: 'NAME' with mysql: Traceback (most recent call last): File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 241, in __call__ response = self.get_response(request) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 142, in get_response return self.handle_uncaught_exception(request, resolver, exc_info) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 166, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 80, in get_response response = middleware_method(request) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/middleware.py", line 13, in process_request if (not self._authenticator.authenticate(request) and File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/__init__.py", line 86, in authenticate partial_digest = self._account_storage.get_partial_digest(digest_response.username) File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/backend/db.py", line 97, in get_partial_digest cursor = get_connection().cursor() File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/__init__.py", line 75, in cursor cursor = self._cursor() File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 281, in _cursor if settings_dict['USER']: KeyError: 'USER'

    Read the article

  • Google App Engine with local Django 1.1 gets Intermittent Failures

    - by Jon Watte
    I'm using the Windows Launcher development environment for Google App Engine. I have downloaded Django 1.1.2 source, and un-tarrred the "django" subdirectory to live within my application directory (a peer of app.yaml) At the top of each .py source file, I do this: import settings import os os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' In my file settings.py (which lives at the root of the app directory, as well), I do this: DEBUG = True TEMPLATE_DIRS = ('html') INSTALLED_APPS = ('filters') import os os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' from google.appengine.dist import use_library use_library('django', '1.1') from django.template import loader Yes, this looks a bit like overkill, doesn't it? I only use django.template. I don't explicitly use any other part of django. However, intermittently I get one of two errors: 1) Django complains that DJANGO_SETTINGS_MODULE is not defined. 2) Django complains that common.html (a template I'm extending in other templates) doesn't exist. 95% of the time, these errors are not encountered, and they randomly just start happening. Once in that state, the local server seems "wedged" and re-booting it generally fixes it. What's causing this to happen, and what can I do about it? How can I even debug it? Here is the traceback from the error: Traceback (most recent call last): File "C:\code\kwbudget\edit_budget.py", line 34, in get self.response.out.write(t.render(template.Context(values))) File "C:\code\kwbudget\django\template\__init__.py", line 165, in render return self.nodelist.render(context) File "C:\code\kwbudget\django\template\__init__.py", line 784, in render bits.append(self.render_node(node, context)) File "C:\code\kwbudget\django\template\__init__.py", line 797, in render_node return node.render(context) File "C:\code\kwbudget\django\template\loader_tags.py", line 71, in render compiled_parent = self.get_parent(context) File "C:\code\kwbudget\django\template\loader_tags.py", line 66, in get_parent raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent TemplateSyntaxError: Template u'common.html' cannot be extended, because it doesn't exist And edit_budget.py starts with exactly the lines that I included up top. All templates live in a directory named "html" in my root directory, and "html/common.html" exists. I know the template engine finds them, because I start out with "html/edit_budget.html" which extends common.html. It looks as if the settings module somehow isn't applied (because that's what adds html to the search path for templates).

    Read the article

  • django & postgres linux hosting (with SSH access) recommendations

    - by Justin Grant
    We're looking for a good place to host our custom Django app (a fork of OSQA) and its postgresql backend. Requirements include: Linux Python 2.6 or (ideally) Python 2.7 Django 1.2 Postgres 8.4 or later DB backup/restore handled by the hoster, not us OS & dev-platform-stack patching/maintenance handled by the hoster, not us SSH access (so we can pull source code from GitHub, so we can install python eggs, etc.) ability to set up cron jobs (e.g. to send out dail email updates) ability to send up to 10K emails/day good performance (not ganged up with a zillion other sites on one CPU, not starved for RAM) FTP or SCP access to web logs dedicated public IP SSL support Costs under $1000/month for a relatively small site (<5M pageviews/month) Good customer service We already have a prototype site running on EC2 on top of a Bitnami DjangoStack. The problem is that we have to patch the OS, patch postgres, etc. We'd really prefer a platform-as-a-service (PaaS) offering, like Heroku offers for Rails apps, where all we need to worry about is deploying our code instead of worrying about system software patching and maintenance. Google App Engine is closest to what we're looking for, but they don't offer relational DB access (not yet at least). Anyone have a recommendation?

    Read the article

  • simplest way to confirm payment via PayPal?

    - by Giles Bowkett
    Hi - what's the best way to simply get feedback from PayPal to confirm that your customer paid? It looks as if the answer is IPN - if so, my followup question is, can I enable IPN for only specific buttons? I don't want PayPal pinging my IPN listener for purchases that don't require any kind of IPN integration. I'm all about Agile and YAGNI, I don't want to do ANYTHING unnecessary.

    Read the article

  • Oscommerce PayPal IPN still Status pending

    - by ron
    I'm working with oscommerce and i have problem with Paypal ipn When someone makes a payment, even though the money is coming through OK, on the backend of the website it is saying it is unverified something like that : PayPal IPN Verified [Completed (Unverified; $99.90). I get the email "Notification of payment received" so why is it still pending? any idea? Thanks in advance

    Read the article

  • paypal integration

    - by tibin mathew
    Hi, I am integrating paypal in my website But i have some issues in it , http://www.rmmitchellconsulting.com/ - click on the paypal button here you will see one box, I need two boxes. to put amount and invoice number. How can i do this. does any one did this. Please help me to do this.

    Read the article

  • Paypal IPN call back with parameter

    - by proyb2
    I want to automate a process after user have made a payment. 1) User enter details on forms and submit, the session will pass unique ID to paypal 2) After user complete the paypal payment, unique ID is then pass back to my server for the script to read and register into db. How do I do that?

    Read the article

  • Paypal as in-app Payment model in Android?

    - by sunil
    Hi, I am integrating Paypal into my application for in-app purchase. I am using Paypal Mobile Checkout for this purpose. I will like to know whether Android Market will approve this kind of application which uses a payment gateway other than Google Checkout. Can anyone let me know where I can find information related to this? Thanks & Regards Sunil

    Read the article

  • Multiple items with PayPal button and PHP

    - by user146780
    I'm building a website where I basically want my checkout to work like this website: http://www.solutionkaizen.com/html/boutique.php It allows you to enter the quantity for each item and then press a button which brings you to PayPal and lists how many Products you have. On PayPal's website, all the info I found seems to lead to me needing a shopping cart. If this is absolutely necessary, how could I implement that? Thanks

    Read the article

  • how pass multiple values to paypal

    - by hwd
    how pass multiple values to paypal .i used it in paypal submission page <input type="hidden" name="custom" value="id_cart={$id_cart}&option={option}" /> i get $_POST['custom'] = id_cart=534&option=1620850004 , how i get it seperately like $_POST['id_cart'] =534 , $_POST['option'] =1620850004.

    Read the article

  • Get information from PayPal after a transaction

    - by user146780
    I want to create a simple transaction on my Web Site where after the person's transaction completes, I want paypal to redirect the user to go to a place on my site and I want PayPal to provide me with details so I can use PHP to parse it and email them the link to their purchase. I'm not sure what notify_url does? Thanks

    Read the article

  • paypal create app giving unknown error

    - by user1241438
    On the developer.paypal.com i login using my ID. When i click on Applications-My App i see the following error We’re sorry, but something went wrong. Please try again. [Error code: LVAPPSGET400-20140608081651] When i click on create apps and try to create an app it gives the following error We’re sorry, but something went wrong while creating the application. Please try again. I could not find how to contact paypal to get this resolved so i thought i come to stackoverflow. please help

    Read the article

  • Django running on Apache+WSGI and apache SSL proxying

    - by Lessfoe
    Hi all, I'm trying to rewrite all requests for my Django server running on apache+WSGI ( inside my local network) and configured as the WSGI's wiki how to, except that I set a virtualhost for it. The server which from I want to rewrite requests is another apache server listening on port 80. I can manage it to work well if I don't try to enable SSL connection as the required way to connect. But I need all requests to Django server encrypted with SSL so I generally used this directive to achieve this ( on my public webserver ): Alias /dirname "/var/www/dirname" SSLVerifyClient none SSLOptions +FakeBasicAuth SSLRequireSSL AuthName "stuff name" AuthType Basic AuthUserFile /etc/httpd/djangoserver.passwd require valid-user # redirect all request to django.test:80 RewriteEngine On RewriteRule (.*)$ http://django.test/$1 [P] This configuration works if I try to load a specific page trough the external server from my browser. It is not working clicking my django application urls ( even tough the url seems correct when I put my mouse over). The url my public server is trying to serve use http ( instead of https ) and the directory "dirname" I specified on my apache configuration disappear, so it says that the page was not found. I think it depends on Django and its WSGI handler . Does anybody went trough my same problem? PS: I have already tried to modify the WSGI script . I'm Using Django 1.0.3, Apache 2.2 on a Fedora10 (inside), Apache 2.2 on the public server. Thanks in advance for your help. Fab

    Read the article

  • 'NoneType' object has no attribute 'day'

    - by Asinox
    Hi guy, i dont know where is my error, but Django 1.2.1 is give this error: 'NoneType' object has no attribute 'day' when i try to save form from the Administrator Area models.py from django.db import models from django.contrib.auth.models import User class Editorial(models.Model): titulo = models.CharField(max_length=250,help_text='Titulo del editorial') editorial = models.TextField(help_text='Editorial') slug = models.SlugField(unique_for_date='pub_date') autor = models.ForeignKey(User) pub_date = models.DateTimeField(auto_now_add=True) activa = models.BooleanField(verbose_name="Activa") enable_comments = models.BooleanField(verbose_name="Aceptar Comentarios",default=False) editorial_html = models.TextField(editable=False,blank=True) def __unicode__(self): return unicode(self.titulo) def get_absolute_url(self): return "/editorial/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug) class Meta: ordering=['-pub_date'] verbose_name_plural ='Editoriales' def save(self,force_insert=False, force_update=False): from markdown import markdown if self.editorial: self.editorial_html = markdown(self.editorial) super(Editorial,self).save(force_insert,force_update) i dont know why this error, thanks guys sorry with my English

    Read the article

  • Returning user data for forms that have errors in when using ModelForms

    - by Sevenearths
    forms.py from django.forms import ModelForm from client.models import ClientDetails, ClientAddress, ClientPhone from snippets.UKPhoneNumberForm import UKPhoneNumberField class ClientDetailsForm(ModelForm): class Meta: model = ClientDetails class ClientAddressForm(ModelForm): class Meta: model = ClientAddress class ClientPhoneForm(ModelForm): number = UKPhoneNumberField() class Meta: model = ClientPhone views.py from django.shortcuts import render_to_response, redirect from django.template import RequestContext from client.forms import ClientDetailsForm, ClientAddressForm, ClientPhoneForm def new_client_view(request): formDetails = ClientDetailsForm(initial={'marital_status':'u'}) formAddress = ClientAddressForm() formHomePhone = ClientPhoneForm(initial={'phone_type':'home'}) formWorkPhone = ClientPhoneForm(initial={'phone_type':'work'}) formMobilePhone = ClientPhoneForm(initial={'phone_type':'mobi'}) return render_to_response('client/new_client.html', {'formDetails': formDetails, 'formAddress': formAddress, 'formHomePhone': formHomePhone, 'formWorkPhone': formWorkPhone, 'formMobilePhone': formMobilePhone}, context_instance=RequestContext(request)) (the new_client.html is nothing special) How should I write views.py so that if the user's data raises an error, instead of showing them the form again with the errors in but none of their original data, it shows them the form again with the errors AND their original data?

    Read the article

  • Foreign keys in django admin list display

    - by Olivier
    If a django model contains a foreign key field, and if that field is shown in list mode, then it shows up as text, instead of displaying a link to the foreign object. Is it possible to automatically display all foreign keys as links instead of flat text? (of course it is possible to do that on a field by field basis, but is there a general method?) Example: class Author(models.Model): ... class Post(models.Model): author = models.ForeignKey(Author) Now I choose a ModelAdmin such that the author shows up in list mode: class PostAdmin(admin.ModelAdmin): list_display = [..., 'author',...] Now in list mode, the author field will just use the __unicode__ method of the Author class to display the author. On the top of that I would like a link pointing to the url of the corresponding author in the admin site. Is that possible? Manual method: For the sake of completeness, I add the manual method. It would be to add a method author_link in the PostAdmin class: def author_link(self, item): return '<a href="../some/path/%d">%s</a>' % (item.id, unicode(item)) author_link.allow_tags = True That will work for that particular field but that is not what I want. I want a general method to achieve the same effect. (One of the problems is how to figure out automatically the path to an object in the django admin site.)

    Read the article

  • Re-ordering child nodes in django-MPTT

    - by Dominic Rodger
    I'm using Ben Firshman's fork of django-MPTT (hat tip to Daniel Roseman for the recommendation). I've got stuck trying to re-order nodes which share a common parent. I've got a list of primary keys, like this: ids = [5, 9, 7, 3] All of these nodes have a parent, say with primary key 1. At present, these nodes are ordered [5, 3, 9, 7], how can I re-order them to [5, 9, 7, 3]? I've tried something like this: last_m = MyModel.get(pk = ids.pop(0)) last_m.move_to(last_m.parent, position='first-child') for id in ids: m = MyModel.get(pk = id) m.move_to(last_m, position='right') Which I'd expect to do what I want, per the docs on move_to, but it doesn't seem to change anything. Sometimes it seems to move the first item in ids to be the first child of its parent, sometimes it doesn't. Am I right in my reading of the docs for move_to that calling move_to on a node n with position=right and a target which is a sibling of n will move n to immediately after the target? It's possible I've screwed up my models table in trying to figure this out, so maybe the code above is actually right. It's also possible there's a much more elegant way of doing this (perhaps one that doesn't involve O(n) selects and O(n) updates). Have I misunderstood something? Bonus question: is there a way of forcing django-MPTT to rebuild lft and rght values for all instances of a given model?

    Read the article

  • django-mptt fields showing up twice, breaking SQL

    - by Dominic Rodger
    I'm using django-mptt to manage a simple CMS, with a model called Page, which looks like this (most presumably irrelevant fields removed): class Page(mptt.Model, BaseModel): title = models.CharField(max_length = 20) slug = AutoSlugField(populate_from = 'title') contents = models.TextField() parent = models.ForeignKey('self', null=True, blank=True, related_name='children', help_text = u'The page this page lives under.') removed fields are called attachments, headline_image, nav_override, and published All works fine using SQLite, but when I use MySQL and try and add a Page using the admin (or using ModelForms and the save() method), I get this: ProgrammingError at /admin/mycms/page/add/ (1110, "Column 'level' specified twice") where the SQL generated is: 'INSERT INTO `kaleo_page` (`title`, `slug`, `contents`, `nav_override`, `parent_id`, `published`, `headline_image_id`, `lft`, `rght`, `tree_id`, `level`, `lft`, `rght`, `tree_id`, `level`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' for some reason I'm getting the django-mptt fields (lft, rght, tree_id and level) twice. It works in SQLite presumably because SQLite is more forgiving about what it accepts than MySQL. get_all_field_names() also shows them twice: >>> Page._meta.get_all_field_names() ['attachments', 'children', 'contents', 'headline_image', 'id', 'level', 'lft', 'nav_override', 'parent', 'published', 'rght', 'slug', 'title', 'tree_id'] Which is presumably why the SQL is bad. What could I have done that would result in those fields appearing twice in get_all_field_names()?

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >