Re: Noob: How do I get this app to work :(

2013-05-19 Thread Kelvin Wong
If you have old code, you can still use it with an older Django using the pip installer $ pip install Django==1.3.7 K On Thursday, May 16, 2013 1:58:52 PM UTC-7, Todd Wickizer wrote: > > Hello there, > > I just install Django yesterday. I am trying to take a calendar app and > edit it for my

Re: new to Django and building web applications. Advice with postgresql

2013-05-19 Thread Kelvin Wong
You don't have to become an expert with postgres to use Django. You can do most of the db development using SQLite and hold off on postgres until you are ready to deploy. I'd get a Linux server running in VirtualBox. Install Apache and postgres. Configure postgres. Install phpPgAdmin. If you a

Re: working with images in django

2013-07-29 Thread Kelvin Wong
So you have images already made and you want to place them into HTML? That's easy. If you want to make the image dynamically using something like PIL or Pillow then flow them into a PDF then that's a little more involved. Try explaining your use case a bit more. K On Sunday, July 28, 2013 7:2

Re: How the authentication takes place at the backend in django?

2013-07-29 Thread Kelvin Wong
You can always read the source code to find this out https://github.com/django/django/blob/master/django/contrib/auth/models.py https://github.com/django/django/blob/master/django/contrib/auth/backends.py https://github.com/django/django/blob/master/django/contrib/auth/hashers.py Also the docs

Re: Help getting started: Which server setup for a beginner? Apache? lighttpd? To use or not virtualenv?

2013-08-01 Thread Kelvin Wong
It is def worth taking the trouble to learn how to use virtualenv and virtualenvwrapper. Once they are set up and assuming that you haven't already put too much already into your global site-packages, they will save you time and greatly simplify keeping different project environments separate.

Re: problem with deploying django using mod wsgi

2013-08-10 Thread Kelvin Wong
Is your form (on page /mice/search_mice/) submitting to /mice/search or /search Check your form element in the html document. Is it pointing to the right URL? Maybe check your WSGIScriptAlias setting. Maybe verify your DocumentRoot setting. You might also want to check the request and respo

Re: Error importing middleware django.contrib.sessions.middleware

2013-08-13 Thread Kelvin Wong
Did you do this part (from the docs): https://docs.djangoproject.com/en/1.5/topics/http/sessions/#using-database-backed-sessions Using database-backed sessions ... Once you have configured your installat

Re: Error importing middleware django.contrib.sessions.middleware

2013-08-14 Thread Kelvin Wong
What version of Django are you running? $ python2.7 -c "import django; print django.VERSION;" Did this ever work before you enabled Memcached? Did you remove the extra CACHES dictionary from settings.py? What was the full traceback from the Django shell? K -- You received this message becaus

Re: Django Gunicorn with Two Django App

2013-08-14 Thread Kelvin Wong
The error "Could not reliably determine the server's fully qualified domain name" is harmless, but the fix is easy. See... https://help.ubuntu.com/community/ApacheMySQLPHP#Troubleshooting_Apache If you are running Django under Nginx and Gunicorn, why are you restarting Apache anyway? Your gate

Re: How do I create a script to fill in django admin login form and submit?

2013-08-14 Thread Kelvin Wong
https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.login K On Tuesday, August 13, 2013 10:23:48 PM UTC-7, 7equiv...@gmail.com wrote: > > Here is what I'm doing. I have written a script the runs and monitors a > serial connection for incoming data. The data comes from

Re: is it possible to use REST API with HTML within Django?

2013-08-15 Thread Kelvin Wong
To make calls to remote http-enabled servers, use Requests within your view. The results can be passed to the template in the standard way. http://docs.python-requests.org/en/latest/ K On Thursday, August 15, 2013 9:27:26 AM UTC-7, evh wrote: > > Hi, > > I am having trouble getting REST to wo

Re: tests failing/throwing errors - not sure where to start

2013-08-18 Thread Kelvin Wong
My advice to you is to just ignore it all and focus on the tests in your application. For example, if your app that you wrote yourself is called "amazingapp" then you test only that app thus. --- $ python manage.py test amazingapp --- And it will say something similar to this... --- Creati

Re: How do I create a script to fill in django admin login form and submit?

2013-08-18 Thread Kelvin Wong
You were missing a key. The following works on my machine. K --- import requests login_url = "http://192.168.0.21/admin/login/"; client = requests.session() client.get(login_url) csrftoken = client.cookies['csrftoken'] login_data = {'username':'jim', 'password':'beam', 'this_is_the_login

Re: Using an external Server to serve Static files - Development Server

2013-08-21 Thread Kelvin Wong
This is how I do it. In settings.py: STATIC_ROOT = '/home/user/app/site_media/static/' # Generated files here from 'manage.py collectstatic' STATIC_URL = 'http://static.example.com/static/' In templates: {% load staticfiles %} ... Produces: http://static.example.com/static/myapp/stylesh

Re: How do I create a script to fill in django admin login form and submit?

2013-08-21 Thread Kelvin Wong
I've used Requests in the past. All I did was load the page in Chrome and then I looked at what was being sent and compared it to what your script was sending. When I added the missing key it worked. Trial and error. :) K On Wednesday, August 21, 2013 8:48:16 AM UTC-7, 7equiv...@gmail.com w

Re: Django IndexError: list index out of range

2013-08-24 Thread Kelvin Wong
Can you change the name of this file from newweb/polls/__init.py__ to newweb/polls/__init__.py That file name is not right. K On Saturday, August 24, 2013 8:02:38 AM UTC-7, Oleg Gorjajnov wrote: > > I'm new to Django. > > > newweb/ > manage.py > newweb/ > __init__.p

Re: Saving google maps values to db

2013-08-29 Thread Kelvin Wong
If you have a map on a page, you can add some Javascript that obtains the Lat and Lng and Zoom Level from the map and then use that data to fill in a form (or do whatever you want with it). This code give some hints https://developers.google.com/maps/documentation/javascript/examples/map-coordin

Re: Admin: Add new dataset with a pre-selected foreign key?

2013-08-30 Thread Kelvin Wong
Take a look at filters in the admin. You might be able to add log entries to recent items using an appropriate ModelAdmin on 'entry_created' https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter Then use an InlineModelAdmin https://docs.djangoproje

Re: New to Django and developing website based on a Framework. What is the best order to develop website?

2013-08-31 Thread Kelvin Wong
Add features as you need them. If you are going to launch in multiple languages I'd add that early on. Adding the stock authorization is pretty safe as well. Learn and use the testing framework as much as possible. K On Saturday, August 31, 2013 1:07:46 PM UTC-7, Mark Strickland wrote: > > I

Re: Django driving me nuts

2013-08-31 Thread Kelvin Wong
Try the Django IRC channel for faster answers https://code.djangoproject.com/wiki/IrcFAQ If you are learning Python at the same time learning Django then it can be a tough climb K On Saturday, August 31, 2013 5:50:19 AM UTC-7, Gerd Koetje wrote: > > Why is it so hard to get as a former php pr

Re: Django logs for the website

2013-09-01 Thread Kelvin Wong
It depends on how you're running your Django app. If you are running this under Apache mod_wsgi, they end up in the Apache error.log file. If you are running this under Gunicorn/Supervisor with an Nginx out in front then I've seen them show up in the Supervisor log file. I've also seen them emi

Re: Django-registration reset password templates not getting picked up

2013-09-01 Thread Kelvin Wong
TEMPLATE_DIRS needs to have the location of the templates. As long as those templates are being picked up and one is called 'password_reset_form.html' it should work. One of my apps has this form at: /my_project/templates_global/registration/password_reset_form.html In /my_project/my_project/s

Re: Django-registration reset password templates not getting picked up

2013-09-02 Thread Kelvin Wong
If you are not using a templates folder in your project root, where are your registration templates located? K On Monday, September 2, 2013 9:42:50 AM UTC-7, Vibhu Rishi wrote: > > > So far, all the other template html files get picked up - except the ones > related to the password management

Re: Django-registration reset password templates not getting picked up

2013-09-02 Thread Kelvin Wong
Check that your 'homepage' app is above the 'registration' app: INSTALLED_APPS = ( 'homepage', # Order matters, this is loaded before others 'registration', 'django.contrib.auth', ... ) Order of the apps is significant. Review https://docs.djangoproject.com/en/dev/ref/templates/a

Re: Django-registration reset password templates not getting picked up

2013-09-03 Thread Kelvin Wong
I put the overridden templates (auth, registration, etc) in a project templates folder in the project root. You have to set it up though in your settings.py as I noted earlier. The filesystem loader is still right there above the app_directories loader. To me the overridden templates don't seem

Re: Do I always have to run collectstatic to serve uploaded images by apache?

2013-09-04 Thread Kelvin Wong
The MEDIA_ROOT is the local system location where the FileField in your models is going to store incoming files. Users submit files and they are placed in the location specified by the 'upload_to' setting of the field (usually a directory within MEDIA_ROOT). https://docs.djangoproject.com/en/de

Re: ValueError at / Empty module name

2013-09-04 Thread Kelvin Wong
Your MEDIA_ROOT setting is also suspect. As-is you will be writing user submitted files into your shared site-packages folder. Hopefully you won't be running Django as root and you'll get a permission error. K -- You received this message because you are subscribed to the Google Groups "Djan

Re: Do I always have to run collectstatic to serve uploaded images by apache?

2013-09-05 Thread Kelvin Wong
4f22 > > > On Thu, Sep 5, 2013 at 2:29 AM, Kelvin Wong > > wrote: > >> The MEDIA_ROOT is the local system location where the FileField in your >> models is going to store incoming files. Users submit files and they are >> placed in the location specified b

Re: Mezzanine Gunicorn Problem

2013-09-09 Thread Kelvin Wong
> > This is the command (single line) that I am using for a Django app using > Gunicorn (and Supervisor). It is running with a virtualenv which explains > the python executable. > > /home/myapp/.virtualenvs/productionmyapp/bin/python > /home/myapp/webapps/production_fido/fido/manage.py run_guni

Re: static files are not working

2013-09-13 Thread Kelvin Wong
Are you saying that your settings are like this? STATIC_ROOT = '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static' STATIC_URL='/static/' # < Trailing slash required! check it If so that is asking for trouble when you do a collectstatic. You'll prob get permission error un

Re: Django unittest failure

2013-09-14 Thread Kelvin Wong
Are you reusing an old database or something? There should be only two users in the database prior to testing that section. # Create two users so we can filter by is_staff when handing our # wizard a queryset keyword argument. self.normal_user = User.objects.create(username='test1', email='nor..

Re: Django unittest failure

2013-09-16 Thread Kelvin Wong
You should probably open a bug on this issue. The test suite fails for me on MacOS/Python 2.7 on the stable/1.5.x branch. This is the command that fails reliably on my machine: $ PYTHONPATH=..:$PYTHONPATH python ./runtests.py --settings=test_sqlite utils formtools It might be related to this a

Re: Trouble with STATIC_URL in v1.5.2

2013-09-17 Thread Kelvin Wong
Check that your STATIC_URL setting in your template is outputting the same string as settings.STATIC_URL. Make sure that any included local_settings.py files are not wiping out those settings. You can check it using the Django shell: $ python manage.py shell >>> from django.conf import setting

Re: Trouble with STATIC_URL in v1.5.2

2013-09-17 Thread Kelvin Wong
ction environments. It > was pretty simple for me to switch. All STATIC_ variables were already > set correctly. I just needed to add this to the top of my base template > file: > > {% load static %} > {% get_static_prefix as STATIC_URL %} > > and everything else remained

Re: Upload de musicas (music upload)

2013-09-19 Thread Kelvin Wong
I just wrote a blog post on uploading files using generic class based views. It has a sample app as well. https://bit.ly/14m6Q65 Let me know if you have any questions. K On Monday, September 16, 2013 8:41:06 AM UTC-7, Carlos Andre wrote: > > Olá pessoal, tudo bom? > Eu gostaria de uma ajuda d

Re: Copy all the data from an existing database when create the testing database.

2013-10-05 Thread Kelvin Wong
Consider using model factories (you can roll your own) or FactoryBoy https://factoryboy.readthedocs.org/en/latest/ K On Friday, October 4, 2013 9:17:51 AM UTC-7, Tianyi Wang wrote: > > Yes, it'd be nice to have all the data from the existing database. > I am aware the loading fixtures way, but

Re: Implementation of a Search Engine. How??

2013-10-09 Thread Kelvin Wong
Look up Solr because it does everything you want. You can crawl with Nutch. Django can be used as a front end to that. http://en.wikipedia.org/wiki/Apache_Solr K On Wednesday, October 9, 2013 11:57:25 AM UTC-7, Mithil Bhoras wrote: > > Hello, I am a newbie in Django. I am required to do a proj

Re: View not working / how can I test it in the shell?

2013-10-11 Thread Kelvin Wong
In the shell: >>> from django.test import Client >>> c = Client() >>> r = c.get('/about') >>> r.context https://docs.djangoproject.com/en/1.5/topics/testing/overview/#module-django.test.client K On Friday, October 11, 2013 3:14:38 PM UTC-7, Mario Osorio wrote: > > You are right, I fixed that

Re: View not working / how can I test it in the shell?

2013-10-12 Thread Kelvin Wong
You need to understand what ALLOWED_HOSTS does if you want to ever deploy your app. Please read it. https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts Check your settings in the shell >>> from django.conf import settings as s >>> s.DEBUG True >>> s.ALLOWED_HOSTS ['.example.com',

Re: unable to access django development server on firefox/chrome

2013-10-12 Thread Kelvin Wong
You can also try this $ python manage.py runserver 0.0.0.0:8000 You can get your IP from ifconfig, open that in a browser (it might be 192.168.0.10, etc). You can test your site from another machine in this way K On Saturday, October 12, 2013 10:02:40 AM UTC-7, gitrookie wrote: > > hi > > I

Re: add custom action button on each admin row

2013-10-17 Thread Kelvin Wong
Take a look at Admin Actions. It should be able to do what you are thinking. You can also make a Admin-only view and tie it into the admin. K On Thursday, October 17, 2013 1:12:59 PM UTC-7, Laurent GARTNER wrote: > > Hi, > > Is there a simple way to add custom action button (maybe links, > but

Re: Read a csv file and save data in postgresql

2015-02-24 Thread Kelvin Wong
Looking at your code, maybe this one is better https://pypi.python.org/pypi/unicodecsv/0.9.4 This thing will make a dict, which you can make into a object by feeding it to a modelform. K On Tuesday, February 24, 2015 at 3:53:19 PM UTC-8, elcaiaimar wrote: > > Hello, > > I have a website and I

Re: Porting to Django Linux with SQL Server Backend

2014-10-15 Thread Kelvin Wong
I have a working system running Django 1.6/Python 2.7 on RHEL 7 connecting to MSSQL2012 SP 2 on Win Server. On the Linux box we are installing this with Pip requirements: git+https://code.google.com/p/pyodbc@3.0.7#egg=pyodbc django-pyodbc-azure==1.1.5 The local_settings.py contains: DATABASE

Re: Porting to Django Linux with SQL Server Backend

2014-10-16 Thread Kelvin Wong
Your options are limited if you want to connect to a 2012 SQL Server. The azure driver is the only one that would work for us and we tested everything we could find. K On Thursday, October 16, 2014 7:50:15 AM UTC-7, robert brook wrote: > > Thanks for your response. > > I am in the process of p

Re: How to display BST (British Summer Time)?

2014-10-17 Thread Kelvin Wong
https://docs.djangoproject.com/en/1.6/ref/templates/builtins/#date K On Friday, October 17, 2014 8:14:12 AM UTC-7, Daniel Grace wrote: > > Hi, > I have the time zone set as follows: > TIME_ZONE='Europe/London' > USE_TZ = True > > This is the same as GMT. But what I want is BST (British Summer

Re: How to deny access to a logged user directly to a specific URL

2014-10-17 Thread Kelvin Wong
Have you reviewed this? https://docs.djangoproject.com/en/1.6/ref/contrib/formtools/form-wizard/ K On Friday, October 17, 2014 10:08:08 AM UTC-7, Martin Torre Castro wrote: > > Hello, > > at my project we need some sort of system for allowing/denying some access > to an URL. > > The example, w

Re: Installing django on red hat linux box

2014-10-22 Thread Kelvin Wong
Take a look at the Software Collections (ver 1.1 works on RHEL 7) http://developerblog.redhat.com/2013/01/28/software-collections-on-red-hat-enterprise-linux/ $ sudo yum install python33-python-devel $ scl enable python33 bash You can then install everything locally in your application user's h

Re: template url reverse and namespacing is driving me crazy

2014-11-30 Thread Kelvin Wong
Change all instances of this in your templates {% url 'greet' greeter.pk %} To this {% url 'greeter:greet' greeter.pk %}. Since you are now using the 'greeter' namespace. Also, the other one is {% url 'greeter:list' %} and not {% url 'list' %} because you are using the 'greeter' namespace.

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Kelvin Wong
Comment out the earlier slug field. What happens? # slug = models.SlugField(null=True, blank=True) K On Monday, December 1, 2014 4:12:45 AM UTC-8, Danish Ali wrote: > > Hello, > > I am getting this error: Error: 'NoneType' object has no attribute 'strip' > I have created a model and I am trying

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Kelvin Wong
Post the full trace. I looked at the source for auto slug field and they don't use strip, so the source of this error must be somewhere else. You are looking for code like this: slug = None slug.strip() K On Monday, December 1, 2014 5:11:17 AM UTC-8, Danish Ali wrote: > > still same error. >

Re: django, multi-tenancy and urls

2014-12-05 Thread Kelvin Wong
Take a look at Cartridge. It has multi-tenancy out of the box. The rewriting can be done in Nginx or Apache. K On Friday, December 5, 2014 3:10:36 AM UTC-8, vijay shanker wrote: > > am writing a e-commerce application where different people can have > stores with urls like this: www.store-one

Re: Database Error (SQLite) Database is locked

2014-03-28 Thread Kelvin Wong
You can try finding the lock (assuming you are on unix): $ which fuser /usr/bin/fuser $ fuser db.sqlite3 db.sqlite3: 84349 $ ps aux | grep 84349 kelvin 84349 0.0 0.1 491220 4776 ?? SFri03PM 3:24.57 /Applications/SQLite Database Browser.app This shows candidates that might ha

Re: Nesting custom template tags

2014-04-01 Thread Kelvin Wong
You might want to look at the code for making a tag like: URLNode(Node) line 408 of https://github.com/django/django/blob/stable/1.6.x/django/template/defaulttags.py Then extend that. class MyAnchor(URLNode): override the init function to accept the params your are sending and override rende

Re: Django: Having trouble with nesting URLS

2014-04-01 Thread Kelvin Wong
You might try this # settings.py INSTALLED_APPS += ('registration',) # urls.py -- In appropriate section url(r'^accounts/', include('registration.backends.simple.urls')), -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: django on rhel5 with both python2.4 and python2.7 confusion

2014-05-07 Thread Kelvin Wong
Question one... The gist is: 1. Set up Virtualenv and Virtualenvwrapper (lots of howtos on the web for this - find one written in the last year) 2. Set correct environment keys to point to the right Python (similar to the following, you paths may be different) # ~/.bashrc export VIRTUALENVWRAP

Re: Registration in 1.8

2014-05-10 Thread Kelvin Wong
Unless you want to hack on Django core, stick with the stable Django releases. You say that you are three days in. Maybe try Django 1.4 to start. K On Saturday, May 10, 2014 12:00:04 PM UTC-7, erip wrote: > > Jon, > > I found this. https://docs.djangoproject.com/en/dev/releases/1.8/ > > I don't

Re: Registration in 1.8

2014-05-16 Thread Kelvin Wong
OP is new to Django. There are tons of old blog posts, working code, etc dealing with registration and basic app set-ups using 1.4. Also Django-registration works with 1.4, does it work with 1.6? K On Sunday, May 11, 2014 1:41:48 AM UTC-7, Lee wrote: > > What's the value in starting with 1.4?

Re: Django RequestFactory() secure not working

2014-05-16 Thread Kelvin Wong
If you print out your code you will see that you are adding a key-value to the WSGI environ: # print factory.post('/', secure=True) , POST:, COOKIES:{}, META:{ ... 'PATH_INFO': u'/', ... 'REQUEST_METHOD': 'POST', ... 'SERVER_PROTOCOL': 'HTTP/1.1', 'secure': True, ... 'wsgi.url_scheme':

Re: Can't get i18n/setLang to match any urls

2014-05-16 Thread Kelvin Wong
The L in setLang should be setlang as in the L is lowercase >From my Django log "POST /i18n/setlang/ HTTP/1.1" 302 0 K On Wednesday, May 14, 2014 2:45:43 PM UTC-7, Shawn H wrote: > > I'm beginning the process of adding some translations to one public page, > and I can't get my setLang url to

Re: django on rhel5 with both python2.4 and python2.7 confusion

2014-05-16 Thread Kelvin Wong
I haven't used mod_python in such a long time that I don't recall the configuration details. Off the top of my head, you might want to check how to add the Python 2.7 site-packages folder to the path that mod_python searches for python modules like Django. Also, check this out on SO. http://st

Re: URL lookup fails in apache/wsgi unless mapped to server root.

2014-05-21 Thread Kelvin Wong
Maybe WSGIScriptAlias /awma /var/www/djangoapp/djangoapp/wsgi.py K On Wednesday, May 21, 2014 9:27:14 PM UTC-7, Spaceman Paul wrote: > > My application works fine in runserver and in apache/wsgi mapped to root, > but when I map wsgi to a directory, url lookups fail. > > E.g. > > Request URL: h

Re: URL lookup fails in apache/wsgi unless mapped to server root.

2014-05-22 Thread Kelvin Wong
Maybe post your apache.conf or/and your wsgi file. Maybe check your Apache logs. K On Wednesday, May 21, 2014 11:01:29 PM UTC-7, Spaceman Paul wrote: > > No that's what I've got. > > P. > > >>> -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: How to execute query for multiple table using cursor in Django

2014-05-23 Thread Kelvin Wong
https://docs.djangoproject.com/en/1.6/topics/db/sql/ K On Thursday, May 22, 2014 11:31:26 PM UTC-7, swapnil srivastava wrote: > > Hi Experts, > > I just want to execute queries and subqueries in Django . > Can anybody please tell me how to use cursor for execute queries in Django > framework in

Re: AttributeError when trying to reference ForeignKey attributes

2014-05-24 Thread Kelvin Wong
Might try removing the default from x_pos then try setting it by overriding the save method https://docs.djangoproject.com/en/1.4/topics/db/models/#overriding-predefined-model-methods K On Saturday, May 24, 2014 8:28:17 PM UTC-7, Robbie Edwards wrote: > > Hi, I have some code like such... > > >

Re: Django queryset csv encode

2014-05-25 Thread Kelvin Wong
Try name = [name.encode("utf8") for name in Staff.objects.filter(id = 3).values_list('user_name', *flat=True*)] The other returns one-tuples in a list https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list K On Sunday, May 25, 2014 7:55:51 PM UTC-7, hito koto wrote: > > Hi, >

Re: Django queryset csv encode

2014-05-25 Thread Kelvin Wong
Python 3.4.0 (default, Mar 20 2014, 12:50:31) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> b'\xe5\x93\x88\xe6\x96\xaf\xe6\x9c\x9d\xe9\xad\xaf'.decode('utf8') '哈斯朝魯' K On Sunday, May 25, 2014 9:23:47 PM UTC-7, hito koto

Re: Django queryset csv encode

2014-05-26 Thread Kelvin Wong
Okay, I re-read your first post. You said that you wanted to get a UTF-8 string. name = [name.encode("utf8") for name in Staff.objects.filter(id = 3).values_list('user_name', flat=True)] This variable 'name' now contains a UTF-8 encoded string in a list-like object. Python 2.7.6 (default, Jan

Re: Django queryset csv encode

2014-05-26 Thread Kelvin Wong
If you want all the user_name's in Staff as UTF-8: staff = Staff.objects.all() staff_list = [s.user_name.encode('utf-8') for s in staff] I'm not familiar with the encoding you mentioned in your last message. Try it. K On Monday, May 26, 2014 2:12:14 AM UTC-7, hito koto wrote: > > Hi, > > this

Re: hoping for a quick code review of a few simple class-based generic views

2014-05-27 Thread Kelvin Wong
I'd recommend removing the login_required checks from the views. Put them in the UrlConf instead: from django.contrib.auth.decorators import login_required from yourapp.views import MyListsView urlpatterns = patterns('', url(r'^$', login_required(MyListsView.as_view()), name='yourapp_list')

Re: virtualenv help needed

2014-05-28 Thread Kelvin Wong
Why are you placing user media in your /usr/local/.../dist-package directories? (Debian?) Wouldn't it make more sense to place them somewhere in /srv or /var? https://docs.djangoproject.com/en/1.6/howto/static-files/ K On Wednesday, May 28, 2014 9:40:54 AM UTC-7, Deepak Sharma wrote: > > A yea

Re: Help - Django App on Heroku & local dev machine

2014-05-28 Thread Kelvin Wong
Clone the app locally http://stackoverflow.com/questions/1872113/how-do-i-clone-a-github-project-to-run-locally Create a virtualenv http://virtualenv.readthedocs.org/en/latest/virtualenv.html#usage Install your requirements $ pip -r your_app_path/requirements.txt Run the dev server https://d

Re: Custom user model backend

2014-05-28 Thread Kelvin Wong
In your settings.py you might have to set the SESSION_COOKIE_AGE https://docs.djangoproject.com/en/1.4/topics/http/sessions/#session-cookie-age K On Wednesday, May 28, 2014 5:49:01 AM UTC-7, Domagoj Kovač wrote: > > Hi guys, > > I extended base user model with certain fields. My code is as foll

Re: Custom user model backend

2014-05-29 Thread Kelvin Wong
Maybe try putting some logging in your CustomUserModelBackend. Near the top, put in some logging boilerplate: import logging logger = logging.getLogger(__name__) Then in your backend, something like this: class CustomUserModelBackend(ModelBackend): ... def get_user(self, user_id):

Re: reverse function

2014-05-29 Thread Kelvin Wong
The functions reverse and reverse_lazy are useful for figuring out the paths from labels. If you or someone else changes the urlconf in the future, your app uses the new paths without difficulty. If you have in your urls.py url(r'^home/$', views.home, name='home'), url(r'^specifics/(?P\d+)/$',

Re: reverse function

2014-05-29 Thread Kelvin Wong
Oooppps! print reverse('detail', args=[12]) # prints /specifics/12/ K On Thursday, May 29, 2014 4:04:47 AM UTC-7, Kelvin Wong wrote: > > The functions reverse and reverse_lazy are useful for figuring out the > paths from labels. If you or someone else changes the urlconf in

Re: Django Template - problema

2014-05-30 Thread Kelvin Wong
In relacaoconjugetipouniao_form.html Add this tag...then refresh... {{ form.fields }} Should give you more info about what fields are in the form and what widget they are using. ie. 'tipo_conjuge': django.forms.fields.TypedChoiceField object Also check your html source in a browser. Sometimes

Re: Registration extend nightmare

2014-05-30 Thread Kelvin Wong
This is not an answer to your question, but I have used Django-registration before and ran into its limitations. Consider all the time you spent trying to debug this then consider that you'd probably already be done if you had just wrote a custom user and maybe salvaged some of the nicer code f

Re: Django Template - problema

2014-05-31 Thread Kelvin Wong
UE', _('Uniao estavel')), > ('OU', _('Outros')), > ) > > I'll see how to solve this issue. Any clues? > > > 2014-05-31 0:11 GMT-03:00 Erick Brockes >: > >> Kevin, Thank you. >> >> If you don'

Re: Need help my first Django app

2014-05-31 Thread Kelvin Wong
https://docs.djangoproject.com/en/1.6/intro/tutorial01/ K On Saturday, May 31, 2014 12:06:20 AM UTC-7, Mamdou Attallah wrote: > > Since I have never delveoped any Django app before I need to find an easy > tutorial to kick start my first app > I am using free trial of py charm > thanks > -- Yo

Re: Django auth customing error

2014-05-31 Thread Kelvin Wong
In your helpdesk app you have leftover references to auth.User. Replace all of them with something like this: user = models.ForeignKey(settings.AUTH_USER_MODEL) K On Saturday, May 31, 2014 6:25:28 AM UTC-7, Jackie wrote: > > I want to custom the django auth app, since the default auth app can

Re: HELP on unittest.loader.ModuleImportFailure

2014-06-08 Thread Kelvin Wong
You need to be in the first superlists directory. You have a db created so you must have run syncdb at some point. Go back to that folder: $ pwd /home/you/superlists $ ls __init__.py db.sqlite3superlistslistsmanage.py $ ls lists/tests.py lists/tests.py $ python manage.py test Cr

Re: HELP on unittest.loader.ModuleImportFailure

2014-06-08 Thread Kelvin Wong
ur codes above but I still get the same error... > > Kind regards, > Kim > > > On Mon, Jun 9, 2014 at 3:33 AM, Kelvin Wong > wrote: > >> You need to be in the first superlists directory. You have a >> db created so you must have run syncdb at some point. Go back

Re: HELP on unittest.loader.ModuleImportFailure

2014-06-08 Thread Kelvin Wong
> > if __name__ == "__main__": > os.environ.setdefault("DJANGO_SETTINGS_MODULE", "superlists.settings") > > from django.core.management import execute_from_command_line > > execute_from_command_line(sys.argv) > > Kind regards, > Ki

Re: Can't get MySQLdb

2014-06-09 Thread Kelvin Wong
You better check that the MySQL connector actually runs on Py3. I recall reading that it does not run on Py3. I don't use MySQL with Django though. Maybe someone else familiar has better info. Try to import it from the shell. K On Monday, June 9, 2014 5:38:13 PM UTC-7, Alan Sawyer wrote: > >

Re: Expected URL with primary key when testing SimpleTestCase.assertRedirects()

2014-06-18 Thread Kelvin Wong
This is how I usually do redirect tests: self.assertEqual(response.status_code, 302) self.assertRedirects( response, 'http://testserver' + reverse('pizza:deleted') ) I recommend using named URLs, that way your message_id would be similar to this: reverse('pizza:delete', args=[pi

Re: converting the format of datetime from datetime.datetime( yyyy mm dd hh mm tzinfo=) to yyyy mm dd hh mm

2014-06-22 Thread Kelvin Wong
$ python Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> dt = datetime.datetime.utcnow() >>> fmt = "%Y %m %d %H %M" >>> print dt.strftime(fmt) 2

Re: page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Kelvin Wong
If you have access to your logs, check your logs to figure out where those requests are going. You can also SSH into the server and temporarily turn on the DEBUG=True, TEMPLATE_DEBUG=True and let Django tell you what is going on. Without seeing your fcgi script, my guess is that it is Apache no

Re: crm app

2014-06-27 Thread Kelvin Wong
If you don't want to help the fellow when he runs into issues, give him a supported product like Zoho CRM. It is free for 3 users. I'm currently reviewing Tree.io for a client and while it looks nice, it uses Piston (abandonware), Jinja (unnecessary), Dajaxice (a bad idea generally). I wouldn't

Re: crm app

2014-06-28 Thread Kelvin Wong
I've not used Django-CRM. I've used Salesforce in the past, but it is even more overkill than SugarCRM. It is incredibly flexible though. It depends on what your client's requirements are. Keep in mind what they are going to do for on-going support (backup, etc). Non-tech users always need sup

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
Install the MariaDB/MySQL header files. # yum install mysql-devel or # yum install MariaDB.devel Depends on what fork you are planning on running K On Monday, February 22, 2016 at 6:17:58 PM UTC-8, larry@gmail.com wrote: > > Not strictly a django question, but it's something required to

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
t_18)(64bit) >Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) >libmysqlclient.so.18(libmysqlclient_18)(64bit) >Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64 > (mysql57-community) >Not found > You could try

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
.noarchel6-7 > @/mysql57-community-release-el6-7.noarch > php-mysql.x86_645.4.43-1.el6.remi @remi > > I don't see the devel package, but when I try to install it it fails > as shown below. > > On Mon, Feb 22, 2016 at 10:20 PM, Kelvin Won