Search Results

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

Page 52/165 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • One server running Django (with Nginx and Apache) and Wordpress Blog

    - by JCWong
    I have nginx listening to port 80 for my primary site foo.com. It proxys to port 8080 which is where the Django app lives server { listen 80; server_name www.foo.com foo.com; access_log /home/jeffrey/www/ddt/logs/nginx_access.log; error_log /home/jeffrey/www/ddt/logs/nginx_error.log; location / { proxy_pass http://127.0.0.1:8080; include /etc/nginx/proxy.conf; } location /media/ { root /home/jeffrey/www/ddt/; } location /static/ { root /home/jeffrey/www/ddt/; } location /public/ { root /home/jeffrey/www/ddt/; } } I'd like to have a wordpress blog run on the same server. Apache is listening to port 8080 with this http.conf file NameVirtualHost *:8080 WSGIScriptAlias / /home/jeffrey/www/ddt/apache/ddt.wsgi WSGIPythonPath /home/jeffrey/www/ddt <Directory /home/jeffrey/www/ddt/apache/> <Files ddt.wsgi> Order deny,allow Allow from all </Files> </Directory> I added my Wordpress site using a virtualhost <VirtualHost *:8080> ServerName www.bar.com ServerAlias bar.com DocumentRoot /home/jeffrey/www/jeffrey_wp </VirtualHost> When I go to bar.com I still see my django app. Is it possible for these two sites to run on the same server?

    Read the article

  • Enabling mod_wsgi in Apache for a Django app on Gentoo

    - by hobbes3
    I installed Apache, Django, and mod_wsgi on Gentoo using emerge (on Amazon EC2). I know that the mod_wsgi is configured in /etc/apache2/modules.d/70_mod_wsgi.conf: <IfDefine WSGI> LoadModule wsgi_module modules/mod_wsgi.so </IfDefine> # vim: ts=4 filetype=apache So in my /etc/conf.d/apache I added the WSGI module: APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D WSGI" But when I try to list the loaded module, mod_wsgi isn't listed. root ~ # apache2 -M | grep wsgi Syntax OK I also know that mod_wsgi isn't loading properly because the Apache configuration file doesn't recognize WSGIScriptAlias. By the way for Django to work I need to include a custom Apache configuration file. Where should I insert the line below? Include "/var/www/localhost/htdocs/mysite/apache/apache_django_wsgi.conf" I currently have that in the httpd.conf file but I feel like that file will get reseted whenever I upgrade Gentoo or related package. EDIT: it seems the mod_wsgi file is located in /usr/lib64/apache2/modules/mod_wsgi.so. Here is my detailed Apache settings: root@ip-99-99-99-99 /usr/portage/eclass # apache2 -V Server version: Apache/2.2.21 (Unix) Server built: Mar 7 2012 06:52:30 Server's Module Magic Number: 20051115:30 Server loaded: APR 1.4.5, APR-Util 1.3.12 Compiled using: APR 1.4.5, APR-Util 1.3.12 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="/var/run/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types" -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"

    Read the article

  • Lighttpd + django on gentoo 10 seconds to answer

    - by plaetzchen
    I want to run a Django site on a lighttpd with fastcgi on a gentoo machine. Everytime I try to access the site I get a response after more or less exactly 10 seconds. Im using a socket to let lighttpd communicate with my Django site, but a tcp port doesn't help either. Could this be a lighttpd problem? I tried to both from a server in the internet as well as from localost, this is what lighttpd gives me in the error.log 2012-07-10 14:36:36: (response.c.300) -- splitting Request-URI 2012-07-10 14:36:36: (response.c.301) Request-URI : / 2012-07-10 14:36:36: (response.c.302) URI-scheme : http 2012-07-10 14:36:36: (response.c.303) URI-authority: owntube 2012-07-10 14:36:36: (response.c.304) URI-path : / 2012-07-10 14:36:36: (response.c.305) URI-query : 2012-07-10 14:36:36: (response.c.300) -- splitting Request-URI 2012-07-10 14:36:36: (response.c.301) Request-URI : /owntube.fcgi/ 2012-07-10 14:36:36: (response.c.302) URI-scheme : http 2012-07-10 14:36:36: (response.c.303) URI-authority: owntube 2012-07-10 14:36:36: (response.c.304) URI-path : /owntube.fcgi/ 2012-07-10 14:36:36: (response.c.305) URI-query : 2012-07-10 14:36:36: (response.c.349) -- sanatising URI 2012-07-10 14:36:36: (response.c.350) URI-path : /owntube.fcgi/ 2012-07-10 14:36:36: (mod_access.c.135) -- mod_access_uri_handler called 2012-07-10 14:36:36: (mod_fastcgi.c.3632) handling it in mod_fastcgi 2012-07-10 14:36:36: (response.c.470) -- before doc_root 2012-07-10 14:36:36: (response.c.471) Doc-Root : /var/www/owntube 2012-07-10 14:36:36: (response.c.472) Rel-Path : /owntube.fcgi 2012-07-10 14:36:36: (response.c.473) Path : 2012-07-10 14:36:36: (response.c.521) -- after doc_root 2012-07-10 14:36:36: (response.c.522) Doc-Root : /var/www/owntube 2012-07-10 14:36:36: (response.c.523) Rel-Path : /owntube.fcgi 2012-07-10 14:36:36: (response.c.524) Path : /var/www/owntube/owntube.fcgi 2012-07-10 14:36:36: (response.c.541) -- logical -> physical 2012-07-10 14:36:36: (response.c.542) Doc-Root : /var/www/owntube 2012-07-10 14:36:36: (response.c.543) Rel-Path : /owntube.fcgi 2012-07-10 14:36:36: (response.c.544) Path : /var/www/owntube/owntube.fcgi

    Read the article

  • Arch Linux with an nginx/django setup refuses to display ANYTHING

    - by Holland
    I'm on Amazon Ec2, with an Arch Linux server. While I truly am loving it, I'm having the issue of actually getting nginx to display anything. Everytime I try to throw my hostname into the browser, the browser states that it's not available for some reason - almost as if the host doesn't even exist. One thing I'd like to know is, how can I get this up and running? Is there a specific arch linux configuration I have to do to make it web accessible? I have port 80 open, as well as port 22. I've tried using gunicorn, python-flup, and nginx. Nginx Config user http; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name _; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; #charset koi8-r; location ^~ /media/ { root /path/to/media; } location ^~ /admin-media/ { root /usr/lib/python2.7/site-packages/django/contrib/admin/media; } location / { root /path/to/root/; fastcgi_pass 127.0.0.1:8080; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; fastcgi_index index.html; index index.htm index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /etc/nginx/html/50x.html; } } # server { # listen 80; # server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; # location / { # root html; # index index.html index.htm; # } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { root html; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} #} # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } I can't quite tell if it's a server issue or a configuration issue: I've followed so many guides now I can't even count them all. The thing is that Django itself is working fine, and my permissions to the document root of the where the site files are stored is 777. Ontop of that, I have a git repo which works perfectly fine, and django, python, and runfcgi all start without issues. The same goes for gunicorn, when I do a gunicorn_django -b 0.0.0.0:8000 in my document root. Here is my output from that: 2012-04-15 05:17:37 [3124] [INFO] Starting gunicorn 0.14.2 2012-04-15 05:17:37 [3124] [INFO] Listening at: http://0.0.0.0:8081 (3124) 2012-04-15 05:17:37 [3124] [INFO] Using worker: sync 2012-04-15 05:17:37 [3127] [INFO] Booting worker with pid: 3127 As far as I know, everything seems fine, as well as error.log and access.log for nginx. The access log is completely blank, for that matter. I just feel lost here; what would be a step in the right direction to bebugging an issue such as this?

    Read the article

  • Paypal hide address [closed]

    - by Rob F
    I hope this question is okay for this website, to me it seemed most fitting among the stackexchange sites at least. 8) I want to release my software for free, but allow donations for it. So far, I couldn't find any option in Google Checkout to set up a donation button (and website link). I am registered as merchant, but am still waiting for my bank account verification code, that may be the reason. But then, I guess I will not be able to use it anyway because it seems the 'Donation' functionality requires to be a nonprofit organization. My understanding of 'Donation' seems to be unknown to Google (yet). So unfortunately, the one remaining option is Paypal. However, even having upgraded my account to a business account, I can find no option how to remove my living address from the Checkout pages. Basically I have nothing to hide ;) but feel uncomfortable having my address displayed publicly because of the kind of software I'm offering. We live in a world with crazy people it seems, and I don't want to have nightmares of people knocking on my doors at night. So is there a way to deactivate my address from being displayed on Paypal's checkout pages?

    Read the article

  • Django - model.save(commit=False - Is there a way to replicate this?

    - by orokusaki
    I'm wanting to do this: from django.contrib.auth.models import User class PetFrog(models.Model): user = models.OnetoOneField(User) color = models.CharField(max_length=20) def clean(self): if self.color == 'Green': user = User(username='prince') user.save(commit=False) # No commit argument in models.Model.save() like there is in ModelForm.save() user.set_password(self.password) user.save() self.user = user Is there a way to do this creation of a model instance without filling in all the required fields, and then setting them manually before trying to save() for real (which would obviously raise a "Must choose a Password" error)? I need to do this in my model, vs using a ModelForm. If there is another way to do it (while still in clean()), I'm completely open to any suggestions.

    Read the article

  • How to make a Django model fields calculated at runtime?

    - by Anatoly Rr
    I have a model: class Person (models.Model): name = models.CharField () birthday = models.DateField () age = models.IntegerField () I want to make age field to behave like a property: def get_age (self): return (datetime.datetime.now() - self.birthday).days // 365 age = property (get_age) but at the same time I need age to be a true field, so I can find it in Person._meta.fields, and assign attributes to it: age.help_text = "Age of the person", etc. Obviously I cannot just override Person.save() method to calculate and store age in the database, because it inevitably will become wrong later (in fact, it shouldn't be stored in the database at all). Actually, I don't need to have setters now, but a nice solution must have setting feature. Is it possible in Django, or probably there is a more pythonic and djangoic approach to my problem?

    Read the article

  • Django foreign keys cascade deleting and "related_name" parameter (bug?)

    - by Wiseman
    In this topic I found a good way to prevent cascade deleting of relating objects, when it's not neccessary. class Factures(models.Model): idFacture = models.IntegerField(primary_key=True) idLettrage = models.ForeignKey('Lettrage', db_column='idLettrage', null=True, blank=True) class Paiements(models.Model): idPaiement = models.IntegerField(primary_key=True) idLettrage = models.ForeignKey('Lettrage', db_column='idLettrage', null=True, blank=True) class Lettrage(models.Model): idLettrage = models.IntegerField(primary_key=True) def delete(self): """Dettaches factures and paiements from current lettre before deleting""" self.factures_set.clear() self.paiements_set.clear() super(Lettrage, self).delete() But this method seems to fail when we are using ForeignKey field with "related_name" parameter. As it seems to me, "clear()" method works fine and saves the instance of "deassociated" object. But then, while deleting, django uses another memorized copy of this very object and since it's still associated with object we are trying to delete - whooooosh! ...bye-bye to relatives :) Database was arcitectured before me, and in somewhat odd way, so I can't escape these "related_names" in reasonable amount of time. Anybody heard about workaround for such a trouble?

    Read the article

  • Using django-haystack, how do I perform a search with only partial terms?

    - by Sri Raghavan
    I've got a Haystack/xapian search index for django.contrib.auth.models.User. The template is simply {{object.get_full_name}} as I intend for a user to type in a name and be able to search for it. My issue is this: if I search, say, Sri (my full first name) I come up with a result for the user object pertaining to my name. However, if I search Sri Ragh - that is, my full name, and part of my last name, I get no results. How can I set Haystack up so that I can get the appropriate results for partial queries? (I essentially want it to search *Sri Ragh*, but I don't know if wildcards would actually do the trick, or how to implement them). This is my search query: results = SearchQuerySet().filter(content='Sri Ragh')

    Read the article

  • Django loaddata throws ValidationError: [u'Enter a valid date in YYYY-MM-DD format.'] on null=true f

    - by datakid
    When I run: django-admin.py loaddata ../data/library_authors.json the error is: ... ValidationError: [u'Enter a valid date in YYYY-MM-DD format.'] The model: class Writer(models.Model): first = models.CharField(u'First Name', max_length=30) other = models.CharField(u'Other Names', max_length=30, blank=True) last = models.CharField(u'Last Name', max_length=30) dob = models.DateField(u'Date of Birth', blank=True, null=True) class Meta: abstract = True ordering = ['last'] unique_together = ("first", "last") class Author(Writer): language = models.CharField(max_length=20, choices=LANGUAGES, blank=True) class Meta: verbose_name = 'Author' verbose_name_plural = 'Authors' Note that the dob DateField has blank=True, null=True The json file has structure: [ { "pk": 1, "model": "books.author", "fields": { "dob": "", "other": "", "last": "Carey", "language": "", "first": "Peter" } }, { "pk": 3, "model": "books.author", "fields": { "dob": "", "other": "", "last": "Brown", "language": "", "first": "Carter" } } ] The backing mysql database has the relevent date field in the relevant table set to NULL as default and Null? = YES. Any ideas on what I'm doing wrong or how I can get loaddata to accept null date values?

    Read the article

  • Display value of a django form field in a template?

    - by Eran Kampf
    I have a form with an email property. When using {{ form.email }} in case of some validation error, django still renders the previous value in the input tag's value attribute: <input type="text" id="id_email" maxlength="75" class="required" value="[email protected]" name="email"> I want to render the input tag myself (to add some javascript code and an error class in case of an error). For example this is my template instead of {{ form.email }}: <input type="text" autocomplete="on" id="id_email" name="email" class="email {% if form.email.errors %}error{% endif %}"> However this does not display the errorneous value ("[email protected]" in this example) to the user. How do I get the field's value in the template?

    Read the article

  • How to extend the comments framework (django) by removing unnecesary fields?

    - by Ignacio
    Hi, I've been reading on the django docs about the comments framework and how to customize it (http://docs.djangoproject.com/en/1.1/ref/contrib/comments/custom/) In that page, it shows how to add new fields to a form. But what I want to do is to remove unnecesary fields, like URL, email (amongst other minor mods.) On that same doc page it says the way to go is to extend my custom comments class from BaseCommentAbstractModel, but that's pretty much it, I've come so far and now I'm at a loss. I couldn't find anything on this specific aspect.

    Read the article

  • Is Django's manage.py syncdb or South used to create the test database?

    - by Thierry Lam
    With Django 1.1.1 and South 0.62, running a test from the CLI usually have the following output: Creating table some_model Installing index for my_app.SomeModel model . ----- Ran 1 test in 1s OK After upgrading to South 0.7, the output is invoking South's migration: Creating table some_model Installing index for my_app.SomeModel model Migrating... Running migrations for my_app: - Migrating forwards to 0001_initial > my_app:0001_initial - Loading initial data for my_app Migrated: - my_app . ----- Ran 1 test in 1s OK To create the test DB, has the test always used South migration in the past(before South 0.7) even if the output is not explicitly being shown?

    Read the article

  • How to register a model in django-tagging anywhere not in the applications?

    - by culebrón
    Is it possible to register a model in django-tagging not in tagging app, nor in my app? The standard way is to edit apps/myapp/models.py this way: from apps import tagging tagging.register(MyModel) I want to keep both applications without changes, for example, to be able to pull new versions and just replace them. So I tried putting this into project settings.py, in the end, but of course this fails. from apps.myapp.models import MyModel from apps import tagging tagging.register(MyModel) (This fails when importing MyModel.) Any other way?

    Read the article

  • How to combine 2 or more querysets in a Django view?

    - by Espen Christensen
    Hi, I am trying to build the search for a Django site I am building, and in the search I am searching in 3 different models. And to get pagination on the search result list I would like to use a generic object_list view to display the results. But to do that i have to merge 3 querysets into one. How can i do that? Ive tried this: result_list = [] page_list = Page.objects.filter(Q(title__icontains=cleaned_search_term) | Q(body__icontains=cleaned_search_term)) article_list = Article.objects.filter(Q(title__icontains=cleaned_search_term) | Q(body__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term)) post_list = Post.objects.filter(Q(title__icontains=cleaned_search_term) | Q(body__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term)) for x in page_list: result_list.append(x) for x in article_list: result_list.append(x) for x in post_list: result_list.append(x) return object_list(request, queryset=result_list, template_object_name='result', paginate_by=10, extra_context={'search_term': search_term}, template_name="search/result_list.html") But this doesnt work I get an error when i try to use that list in the generic view. The list is missing the clone attribute. Anybody know how i can merge the three lists, page_list, article_list and post_list?

    Read the article

  • how do I use html block snippets with dynamic content inside a django template that extends another

    - by stackoverflowusername
    Hi. Can someone please help me figure out a way to achieve the following (see snippets below) in Django templates? I know that you cannot use more than one extends, but I am new to django and I do not know the proper syntax for something like this. I want to be able to do this so that I can use my nested div layout for css reasons without having to type it like that each time and risking a typo. In words, I want to be able to have a page template extend my base.html file and then use html snippets of dynamic template content (i.e. template for loops or other template logic devices, not just a context variable I set from my view controller). ------------------------------------------------------------ base.html ------------------------------------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>{% block title %}Title{% endblock %}</title> </head> <body> <div class="wrapper"> <div class="header"> This is the common header </div> <div class="nav"> This is the common nav </div> {% if messages %} <div class="messages"> <ul> {% for message in messages %} <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li> {% endfor %} </ul> </div> {% endif %} <div class="content"> {% block content %}Page Content{% endblock %} </div> <div class="footer"> This is the common footer </div> </div> </body> </html> ------------------------------------------------------------ columnlayout2.html ------------------------------------------------------------ <div class="twocol container2"> <div class="container1"> <div class="col1"> {% block twocol_col1 %}{% endblock %} </div> <div class="col2"> {% block twocol_col2 %}{% endblock %} </div> </div> </div> ------------------------------------------------------------ columnlayout3.html ------------------------------------------------------------ <div class="threecol container3"> <div class="container2"> <div class="container1"> <div class="col1"> {% block threecol_col1 %}{% endblock %} </div> <div class="col2"> {% block threecol_col2 %}{% endblock %} </div> <div class="col3"> {% block threecol_col3 %}{% endblock %} </div> </div> </div> </div> ------------------------------------------------------------ page.html ------------------------------------------------------------ {% extends "base.html" %} {% block content %} {% extends "columnlayout2.html" %} {% block twocol_col1 %}twocolumn column 1{% endblock %} {% block twocol_col2 %}twocolumn column 2{% endblock %} {% extends "columnlayout3.html" %} {% block threecol_col1 %}threecol column 1{% endblock %} {% block threecol_col2 %}threecol column 2{% endblock %} {% block threecol_col3 %}threecol column 3{% endblock %} {% endblock %} ------------------------------------------------------------ page.html output ------------------------------------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>Title</title> </head> <body> <div class="wrapper"> <div class="header"> This is the common header </div> <div class="nav"> This is the common nav </div> <div class="content"> <div class="twocol container2"> <div class="container1"> <div class="col1"> twocolumn column 1 </div> <div class="col2"> twocolumn column 2 </div> </div> </div> <div class="threecol container3"> <div class="container2"> <div class="container1"> <div class="col1"> threecol column 1 </div> <div class="col2"> threecol column 2 </div> <div class="col3"> threecol column 3 </div> </div> </div> </div> </div> <div class="footer"> This is the common footer </div> </div> </body> </html>

    Read the article

  • Alternate User select interface in django admin to reduce page size on large site?

    - by David Eyk
    I have a Django-based site with roughly 300,000 User objects. Admin pages for objects with a ForeignKey field to User take a very long time to load as the resulting form is about 6MB in size. Of course, the resulting dropdown isn't particularly useful, either. Are there any off-the-shelf replacements for handling this case? I've been googling for a snippet or a blog entry, but haven't found anything yet. I'd like to have a smaller download size and a more usable interface.

    Read the article

  • How to allow sorting in the Django admin by a custom list_display field, which doesn't have a DB fie

    - by Gj
    I have a custom list_display field which is responsible for a column of integers in one of my admin pages. I need to allow staff members to sort according to it. There's a solution for how to acheive that if the integer represents a count/average/etc of some DB field, which is not the case for me. [ the solution for that case is here: http://stackoverflow.com/questions/2168475/django-admin-how-to-sort-by-one-of-the-custom-list-display-fields-that-has-no-da ] Any ideas how I can achieve this sorting without actually creating and maintaining a DB field for the values?

    Read the article

  • Is there something similar to 'rake routes' in django?

    - by The MYYN
    In rails, on can show the active routes with rake (http://guides.rubyonrails.org/routing.html): $ rake routes users GET /users {:controller=>"users", :action=>"index"} formatted_users GET /users.:format {:controller=>"users", :action=>"index"} POST /users {:controller=>"users", :action=>"create"} POST /users.:format {:controller=>"users", :action=>"create"} Is there a similar tool/command for django showing the e.g. the URL pattern, the name of the pattern (if any) and the associated function in the views?

    Read the article

  • Java equivalent for database schema changes like South for Django?

    - by gerdemb
    I've been working on a Django project using South to track and manage database schema changes. I'm starting a new Java project using Google Web Toolkit and wonder if there is an equivalent tool. For those who don't know, here's what South does: Automatically recognize changes to my Python database models (add/delete columns, tables etc.) Automatically create SQL statements to apply those changes to my database Track the applied schema migrations and apply them in order Allow data migrations using Python code. For example, splitting a name field into a first-name and last-name field using the Python split() function I haven't decided on my Java ORM yet, but Hibernate looks like the most popular. For me, the ability to easily make database schema changes will be an important factor.

    Read the article

  • How To Collapse Just One Field in Django Admin?

    - by Apreche
    The django admin allows you to specify fieldsets. You properly structure a tuple that groups different fields together. You can also specify classes for certain groups of fields. One of those classes is collapse, which will hide the field under a collapsable area. This is good for hiding rarely used or advanced fields to keep the UI clean. However, I have a situation where I want to hide just one lonesome field on many different apps. This will be a lot of typing to create a full fieldset specification in every admin.py file just to put one field into the collapsed area. It also creates a difficult maintenance situation because I will have to edit the fieldset every time I edit the associated model. I can easily exclude the field entirely using the exclude option. I want something similar for collapse. Is this possible?

    Read the article

  • Showing custom model validation exceptions in the Django admin site.

    - by Guy Bowden
    I have a booking model that needs to check if the item being booked out is available. I would like to have the logic behind figuring out if the item is available centralised so that no matter where I save the instance this code validates that it can be saved. At the moment I have this code in a custom save function of my model class: def save(self): if self.is_available(): # my custom check availability function super(MyObj, self).save() else: # this is the bit I'm stuck with.. raise forms.ValidationError('Item already booked for those dates') This works fine - the error is raised if the item is unavailable, and my item is not saved. I can capture the exception from my front end form code, but what about the Django admin site? How can I get my exception to be displayed like any other validation error in the admin site?

    Read the article

  • django-haystack urlpatterns include('haystack.urls') where does it lead to?

    - by Eugene
    I've recently begun to learn/install django/haystack/solr. Following the tutorial given in haystack site, I have urlpatterns = pattern('', r'^search/', include('haystack.urls')) I found haystack installed in /usr/local/lib/python2.6/dist-packages/haystack and located urls.py there. It has urlpatterns=patterns('haystack.views', url(r'^$', SearchView(), name='haystack_search'),) I thought the second argument of url() should be callable object. I looked at the views.py and SearchView is a class. What is going on here? What's get called eventually?

    Read the article

  • Django & custom auth backend (web service) + no database. How to save stuff in session?

    - by Infinity
    I've been searching here and there, and based on this answer I've put together what you see below. It works, but I need to put some stuff in the user's session, right there inside authenticate. How would I store acme_token in the user's session, so that it will get cleared if they logged out? class AcmeUserBackend(object): # Create a User object if not already in the database? create_unknown_user = False def get_user(self, username): return AcmeUser(id=username) def authenticate(self, username=None, password=None): """ Check the username/password and return an AcmeUser. """ acme_token = ask_another_site_about_creds(username, password) if acme_token: return AcmeUser(id=username) return None ################## from django.contrib.auth.models import User class AcmeUser(User): objects = None # we cannot really use this w/o local DB def save(self): """saving to DB disabled""" pass def get_group_permissions(self): """If you don't make your own permissions module, the default also will use the DB. Throw it away""" return [] # likewise with the other permission defs def get_and_delete_messages(self): """Messages are stored in the DB. Darn!""" return []

    Read the article

  • What is the proper way to check the previous value of a field before saving an object? (Using Django

    - by anonymous coward
    I have a Django Model with updated_by and an approved_by fields, both are ForeignKey fields to the built-in (auth) User models. I am aware that with updated_by, it's easy enough to simply over-ride the .save() method on the Model, and shove the request.user in that field before saving. However, for approved_by, this field should only ever be filled in when a related field (date_approved) is first filled in. I'm somewhat certain that I can check this logically, and fill in the field if the previous value was empty. What is the proper way to check the previous value of a field before saving an object? I do not anticipate that date_approved will ever be changed or updated, nor should there be any reason to ever update the approved_by entry. UPDATE: Regarding forms/validation, I should have mentioned that none of the fields in question are seen by or editable by users of the site. If I have misunderstood, I'm sorry, but I'm not sure how forms and validation apply to my question.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >