Re: Can't get date formatting right

2012-06-27 Thread Benedict Verheyen
On 27/06/2012 11:07, Benedict Verheyen wrote: >> > > I found a bug where there was a reference too > translation.activate(settings.LANGUAGE_CODE) > I tried this as the first line of code in the view, and then my date is > formatted correcly > and a date of format dd/mm

Re: Can't get date formatting right

2012-06-27 Thread Benedict Verheyen
On 27/06/2012 10:42, Benedict Verheyen wrote: > Hi, > > I'm still struggling with getting dates formatted correctly without > formatting them myself. > I went over all docs again, still, I must be doing something wrong. > > I want to use the built in Django sy

Can't get date formatting right

2012-06-27 Thread Benedict Verheyen
Hi, I'm still struggling with getting dates formatted correctly without formatting them myself. I went over all docs again, still, I must be doing something wrong. I want to use the built in Django system that formats the date according to the locale. I try this on a Debian Linux Squeeze, local

Re: from future url -- argh

2012-06-15 Thread Benedict Verheyen
On 15/06/2012 1:55, Andre Terra wrote: > Ah, here it is: > > https://docs.djangoproject.com/en/dev/internals/deprecation/#id2 > > > Cheers, > AT Indeed, the first argument in the url tag used to be an implied string. In Django 1.5 it isn't anymore, so if the first argument to the url tag is

Re: How I use Django, Virtualenv and Buildout together

2012-06-14 Thread Benedict Verheyen
On 14/06/2012 15:53, Andrew Bialecki wrote: > Hey everyone, > > I wrote a quick blog post on how I use Django with virtualenv and Buildout. > Hope it's helpful: > http://www.sophomoredev.com/2012/06/how-i-use-django-virtualenv-and-buildout-together/. > Nice article. However, I do concur with so

Re: syncdb does not find model, but it does in the shell

2012-06-12 Thread Benedict Verheyen
On 6/06/2012 16:47, jmolmo wrote: > I think that you have to indicate app_label in your separate model > file > According to: > https://docs.djangoproject.com/en/1.4/ref/models/options/ > > class MyTestModel(models.Model): > field1=models.CharField(max_length=12) > field2=models.CharField(

syncdb does not find model, but it does in the shell

2012-06-05 Thread Benedict Verheyen
Hi, as the title says, in a new project (django trunk), my model isn't found by syncdb. However, when I run a shell_plus (I use django extensions), then I can import it without a problem. So from sql.models.mytestmodel import MyTestModel works. syncdb doens't produce any errors, it just doesn't

Re: App inside another app or nesting in django apps

2012-06-01 Thread Benedict Verheyen
On 1/06/2012 8:21, Jani Tiainen wrote: > 1.6.2012 9:16, Derek kirjoitti: >> And the Zen of Python? >> >> "Flat is better than nested" > > But don't forget, again Zen of Python: > > "Namespaces are one honking great idea -- let's do more of those!" > Hehe, I always imagined how programmers fight

Re: Webservice return pdf

2012-05-31 Thread Benedict Verheyen
On 28/05/2012 9:51, Madhu wrote: > Hi! all > I create client & through client i call the web service. > which returns pdf file, i want to stored that file directly. > I use this > response['Content-Disposition'] = 'attachment; filename= 'demo.pdf' > but it will ask the user to store the file, but i

Re: users and groups management without admin site??

2012-05-04 Thread Benedict Verheyen
e and the login or logout),i dont want to rewrite code > because i don´t have so much time to the development of the project. > Have a look at django-registration. It might be helpful Regards, Benedict -- Benedict Verheyen Debian, Python and Django user GnuPG

Re: Django - Worldwide Developer Rates - Hourly Income - location and project duration specific

2012-05-04 Thread Benedict Verheyen
programming (Django and wxPython amongst others). However, I'm thinking about what might be possible going freelance again. Unfortunately Python and Django aren't widespread YET :) in Belgium. My 2 cents Regards, Benedict -- Benedict Verheyen Debian, Python and

Re: Can't create a test suite for a Django app

2012-04-11 Thread Benedict Verheyen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Hi all, > > I'm having trouble creating a test suite in Django 1.3. > > Say I have an installed app in a directory called app_name. One of the > files in that directory is foo.py which defines a class named Foo. I > want to test that, so I also hav

Passing current logged in system user to a django app

2012-04-10 Thread Benedict Verheyen
Hi, I've made a dashboard app for my company that is going to be widely used. The dashboard is a collection of links to apps and some other functionality. Server runs Debian Linux, Nginx with Gunicorn. Nothing special but, now I need to log on twice, once for Windows, and once for the app. Is th

Re: Django deployment practices -- do people use setup.py?

2012-03-14 Thread Benedict Verheyen
On 14/03/2012 16:40, bruno desthuilliers wrote: > On Mar 12, 11:55 pm, Tom Eastman wrote: >> Hey guys, >> >> I'm looking for deployment best practices for Django projects. Google >> searches seem to show countless numbers of them, many of them somewhat >> contradictory :-) >> >> So as a simple dis

Re: Creating an app for recurring features

2011-12-02 Thread Benedict Verheyen
On 30/11/2011 16:10, Benedict Verheyen wrote: Hi, I managed to create the standalone application, that's the good news. I have some questions on testing the app below. I ended up making a virtualenv for the application. Afterwards, I copied the relevant files (templates, view, urls, s

Re: How to deploy new code to the Production Server?

2011-12-02 Thread Benedict Verheyen
On 2/12/2011 11:14, Andre Lopes wrote: > Thanks for the replies, > > I'm using Nginx + Gunicorn + Supervisor + Virtualenv > > My goal is to deploy the code to the Production in a One Click Step. I > think I will read on Fabric to achieve this. > > More read also about Pip, I don't know how Pip F

Re: How to deploy new code to the Production Server?

2011-12-02 Thread Benedict Verheyen
On 2/12/2011 10:00, Andre Lopes wrote: > Hi, > > I'm new to Django. I need to setup Git to deploy a Django website to > the production server. My question here is to know what is the best > way of doing this. > > By now I only have a Master branch. My problem here is that > Development environmen

Creating an app for recurring features

2011-11-30 Thread Benedict Verheyen
Hi, I have made several projects now for internal use and some of the functionality keeps coming back. For instance, language selection, user authentication, ad syncronization of users. I want to put these in seperate apps that I can easily install in a project. All projects use virtualenv. M

Re: Getting into professional django development

2011-10-21 Thread Benedict Verheyen
On 20/10/2011 4:02, kenneth gonsalves wrote: > On Wed, 2011-10-19 at 14:59 +0200, Benedict Verheyen wrote: >> - Debian ( 1st install was potato :)) >> - VirtualBox >> - nginx >> - gunicorn >> - supervisord (watch gunicorn process) >> - git >> - virtual

Re: Getting into professional django development

2011-10-21 Thread Benedict Verheyen
27;t find it looking at the project structure. I like to keep everything that can affect a program, close to the program so I don't have to worry about where certain pieces are. Regards, Benedict Verheyen -- You received this message because you are subscribed to the Google Gr

Re: Getting into professional django development

2011-10-19 Thread Benedict Verheyen
On 18/10/2011 8:45, Kevin wrote: > Hello everyone! > > I have been using Django for about a year now and feel that I want > to take my experience to the next level. I have created a few website > using Django to test my skills, although not for anyone specific. I > am creating this thread as I

Re: custom table for django authentication possible

2011-10-13 Thread Benedict Verheyen
On 13/10/2011 13:15, Jiss wrote: > I am new to django. Can I use my own table (say) 'User' instead of > 'auth_user' table (keeeping all other tables for django > authentication ) ?. > Why would you want to do that? Keep everything standard and put the fields you want in a UserProfile of your own

Re: Extending Reusable App Models

2011-07-28 Thread Benedict Verheyen
On 27/07/2011 23:29, Django Grappelli wrote: > Hi All, > I'm working with a reusable Django application which defines a model that I'd > like to extend. I've read through the documentation on model > inheritance > > but

Re: Doesn't render templates any longer

2011-07-28 Thread Benedict Verheyen
On 27/07/2011 23:39, Max Bachl wrote: > Hi all! > I've encountered a strange bug today. > I want to return an HTTP response with this code: > > def main(request): > t = loader.get_template("main/start.html") > return HttpResponse(t) > > However, the only result I get is > > > > <

Re: USE_I18N vs. USE_L10N

2011-07-28 Thread Benedict Verheyen
On 28/07/2011 2:28, Lachlan Musicman wrote: > On Wed, Jul 27, 2011 at 16:53, kenneth gonsalves > wrote: >> On Tue, 2011-07-26 at 15:09 +0100, Tom Evans wrote: >>> I strongly disagree, i18n and l10n have explicit and well known >>> technical meanings, dating from the late 80s. It is right and prop

How to best use gunicorn with multiple virtualenv's

2011-07-19 Thread Benedict Verheyen
Hi, I just discovered gunicorn after some problems with wsgi. It seems like a very clean setup together with supervisord. However, it's not clear to me how you set it up when you have multiple virtualenvs. It's easy enough to install gunicorn in a virtualenv and then specify a upstream in nginx

Re: Speed of search question

2011-07-08 Thread Benedict Verheyen
On 7/07/2011 11:31, Marc Aymerich wrote: > Hi Benedict, > If you're concerned about the performance of your django apps, I > recomend you this app: > https://github.com/robhudson/django-debug-toolbar/commits/master/ > > Besides many other interesting things, It shows you the DB queries > that you

Re: Speed of search question

2011-07-06 Thread Benedict Verheyen
On 6/07/2011 12:28, Malcolm Box wrote: > I think this should work: > > Calendar.objects.filter(appointment__owner = request.user) > > Try it and see. > > Malcolm > Thanks, I'll see if I can make a test script to test this. It's actually a good idea to put in a performance test of some sorts.

Speed of search question

2011-07-06 Thread Benedict Verheyen
Hi, I have these models (not really but it's to explain my question :)) class Calendar(models.Model): name = models.CharField(max_length=60) description = models.TextField(blank=True) appointment = models.ManyToManyField(Appointment, related_name='appointment_set') class Appointmen

Installing requirements in a virtualenv works when installed manually, fails when installed automatically

2011-06-30 Thread Benedict Verheyen
Hi, i've encountered a strange problem. When I install packages on the server in a virtualenv with pip manually, my page loads correctly. If I install the requirements via "pip install -r requirements", then i get the following error in apache: Internal Server Error Apaches error.log: [Thu Ju

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-30 Thread Benedict Verheyen
> Hey all, > > Last call for registering your interest in this webcast (28 votes so far). > > If you haven't done so already, please visit the following URL: > > https://spreadsheets.google.com/spreadsheet/viewform?hl=en_GB&formkey=dENyOVFSSkhSYnhBLVZGTktiN1Z3Y2c6MQ#gid=0 >

Re: syncdb doesn't create UserProfile table

2011-06-16 Thread Benedict Verheyen
On 16/06/2011 11:29, Kenneth Gonsalves wrote: > On Thu, 2011-06-16 at 11:10 +0200, Benedict Verheyen wrote: >> On 16/06/2011 10:43, Kenneth Gonsalves wrote: >>> On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote: >>>> user = models.ForeignKey(User, unique=T

Re: syncdb doesn't create UserProfile table

2011-06-16 Thread Benedict Verheyen
On 16/06/2011 10:43, Kenneth Gonsalves wrote: > On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote: >> user = models.ForeignKey(User, unique=True) > > you need onetoone for this to work. Hi, Actually, I've read that ForeignKey is now the way to specify it. Anyway,

Re: syncdb doesn't create UserProfile table

2011-06-16 Thread Benedict Verheyen
On 16/06/2011 10:27, Ivo Brodien wrote: > an idea: Do you have a __init__.py in every subfolder? also the models and > userprofile folder under calltracking_main ? > > Ivo, i do have an __init__.py in every folder. As Jari pointed out, it was the appname in my UserProfile model that was incor

Re: syncdb doesn't create UserProfile table

2011-06-16 Thread Benedict Verheyen
On 16/06/2011 10:25, Jani Tiainen wrote: > On Thu, 2011-06-16 at 10:10 +0200, Benedict Verheyen wrote: >> Hi, >> >> >> The syncdb command doesn't want to create the UserProfile table. >> Also when I was trying to get this working while runnin

syncdb doesn't create UserProfile table

2011-06-16 Thread Benedict Verheyen
Hi, The syncdb command doesn't want to create the UserProfile table. Also when I was trying to get this working while running the app, it was complaining about AUTH_PROFILE_MODULE. It is however correctly specified in my settings.py: ... AUTH_PROFILE_MODULE = 'calltracking_main.UserProfile' ... I

Re: 2 projects based on the same codebase

2011-06-14 Thread Benedict Verheyen
On 14/06/2011 17:24, Stuart MacKay wrote: > Benedict, > > One solution I tried was project franchising, > http://www.huyng.com/archives/franchising-running-multiple-sites-from-one-django-codebase-2/394/ > The idea was to have a core site that was > customized for different deployments. The idea h

Re: ManyToManyField linking to Users in another database

2011-06-10 Thread Benedict Verheyen
On 10/06/2011 13:37, Benedict Verheyen wrote: > Hi, > > > (2nd attempt, as after a few hours the message still doesn't show up) > First, to sketch the situation. > To authenticate users, I use my own login backend. Nothing special, checks > the users in AD. > I hav

ManyToManyField linking to Users in another database

2011-06-10 Thread Benedict Verheyen
Hi, (2nd attempt, as after a few hours the message still doesn't show up) First, to sketch the situation. To authenticate users, I use my own login backend. Nothing special, checks the users in AD. I have 1 project with all users in it, and other projects have their own limited set of users. Th

Re: 2 projects based on the same codebase

2011-06-09 Thread Benedict Verheyen
> Hi, > > > I developed a calltracking for our team and now, another team is interested > to have their own calltracking. > The best way to seem to deal with a project that is the same from the start, > is to makea new virtualenv > and "git clone" the codebase. The new project might slightly d

2 projects based on the same codebase

2011-06-09 Thread Benedict Verheyen
Hi, I developed a calltracking for our team and now, another team is interested to have their own calltracking. The best way to seem to deal with a project that is the same from the start, is to makea new virtualenv and "git clone" the codebase. The new project might slightly differ in the fut

Re: [] Filtering on weekday

2011-05-11 Thread Benedict Verheyen
On 11/05/2011 11:47, Henrik Genssen wrote: > you should try week_day instead > http://docs.djangoproject.com/en/dev/ref/models/querysets/#week-day > > regards > Henrik Henrik, thanks, it works. I don't know how I missed that. Regards, Benedict -- You received this message because you are sub

Filtering on weekday

2011-05-11 Thread Benedict Verheyen
Hi, I've developed a calltracking app and I would want to know how many calls we have on Monday, Tuesday and so on. I would like to filter on weekdays as specified in the date module as date.weekday() Is there an easy way to do this? I've tried this: c=Call.objects.filter(date_created__day=3)

Re: logging in a user to more than one site

2011-03-04 Thread Benedict Verheyen
On 4/03/2011 10:05, Benedict Verheyen wrote: > Wow, what a pain this is. > I succeeded in making it work but I have to do some more testing to be sure > my solution is ok. > > I had to make a User for site B as well and then, the user is logged in, in > site A and B. > O

Re: logging in a user to more than one site

2011-03-04 Thread Benedict Verheyen
On 3/03/2011 15:15, Benedict Verheyen wrote: > Hi, > > i have a problem with logging in a user to more than one site. > SIte A and B are on the same subdomain. > > When a user visits site B, he is redirected to site A. > Site A shows a login screen, checks the credentials

logging in a user to more than one site

2011-03-03 Thread Benedict Verheyen
Hi, i have a problem with logging in a user to more than one site. SIte A and B are on the same subdomain. When a user visits site B, he is redirected to site A. Site A shows a login screen, checks the credentials with LDAP. After a succesful login, the user is redirected back to site B. However

Re: Using user data from another project

2011-02-25 Thread Benedict Verheyen
On 25/02/2011 12:38, bruno desthuilliers wrote: > Won't work that way. > >> I need to set the user object in site B to get the user info (I display the >> username on every page amongst other data) >> >> Is that even possible? > > Yeps, using multi-db support (to share the user tables) and a cu

Using user data from another project

2011-02-25 Thread Benedict Verheyen
Hi, i have 2 sites that use the standard Django authentication system. I use the first site, say site A, as the site to manage logon's. My point is to achieve that when a user is logged in on site A, he/she is automatically logged in on site B. Now, when a user visits site B, he/she gets redirec

Re: Best way to deploy a project with custom compiled python 2.7 & virtualdev

2011-02-22 Thread Benedict Verheyen
On 21/02/2011 9:57, Benedict Verheyen wrote: > Hi, > > > i have a Django project in a virtualdev. > Because it was developed before Debian squeeze, i wanted a recent version of > python > and compiled my own 2.7 version, then installed that in my virtual dev. > &g

Best way to deploy a project with custom compiled python 2.7 & virtualdev

2011-02-21 Thread Benedict Verheyen
Hi, i have a Django project in a virtualdev. Because it was developed before Debian squeeze, i wanted a recent version of python and compiled my own 2.7 version, then installed that in my virtual dev. Now for deploying to the production server, i had following scenario in mind: - install progra

Re: AW: AW: Form to add data

2011-02-15 Thread Benedict Verheyen
> def main(request): > f = BuchungForm(request.POST) > buchung = f.save(commit=False) > buchung.Mitarbeiter = 'request.user.id' > buchung.save() > return render_to_response('main/index.html', {'user' : request.user, > 'form' : f}) > > but this gives me the following erro

Re: Separating application media from project media

2010-10-06 Thread Benedict Verheyen
On 1/10/2010 11:48, bruno desthuilliers wrote: > This is fine when using the dev server, but what when you will serve > your static files directly from the frontend web server ? Hi Bruno, to answer your question, i'll post the relevant parts of configs. I use apache with the wsgi module, nginx f

Re: UnicodeEncodeError

2010-10-01 Thread Benedict Verheyen
On 30/09/2010 18:47, jean polo wrote: > ok, thanks to everybody for the help but unfortunately nothing works > for my issue. > (except Karen one that solves it on one of my local machines but not > the other which has the same linux system... weird..). > > I guess I'll ask my client to rename thei

Re: Separating application media from project media

2010-10-01 Thread Benedict Verheyen
On 1/10/2010 10:06, bruno desthuilliers wrote: > I don't think that's the case, and FWIW the OP's layout makes perfect > sense to me. His point is that even while all apps are in a same > project and share a common auth, they are otherwise totally (or > mostly ?) independent so it doesn't really ma

Re: Separating application media from project media

2010-09-30 Thread Benedict Verheyen
On 29/09/2010 18:55, Carles Barrobés wrote: > At some point I also thought this was a good idea. This way I can > reuse the app and all its visual stuff as well. > > But the problem is that for most cases you will want your templates > and media to be consistent with a site's design and look&feel.

Re: Separating application media from project media

2010-09-30 Thread Benedict Verheyen
On 29/09/2010 13:58, Benedict Verheyen wrote: > On 29/09/2010 13:13, David De La Harpe Golden wrote: >> On 29/09/10 09:34, Benedict Verheyen wrote: >> >>> In my template i add this: >>> >> href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" />

Re: Separating application media from project media

2010-09-29 Thread Benedict Verheyen
On 29/09/2010 13:13, David De La Harpe Golden wrote: > On 29/09/10 09:34, Benedict Verheyen wrote: > >> In my template i add this: >> > href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" /> >> > > (I'd favour prefix rather than suffix if you&#

Separating application media from project media

2010-09-29 Thread Benedict Verheyen
Hi, I want to further split my application from the project. I've already put the templates inside the application directory. Now I'm thinking of doing the same with media. I think it's clearer if the media of the application is separate from the project. I'm not sure however if the application

Re: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread Benedict Verheyen
On 28/09/2010 0:48, bruno desthuilliers wrote: > > > On 27 sep, 17:31, Thomas Weholt wrote: >> On Mon, Sep 27, 2010 at 4:52 PM, bruno desthuilliers >> > >>> ??? Which "django specific magic" ??? >> >> I was referring to syncdb. As far as I know, models defined outside >> any models.py or models

Re: SITE_ID

2010-09-28 Thread Benedict Verheyen
On 27/09/2010 12:19, Tim Sawyer wrote: >> On 25/09/2010 18:32, Tim Sawyer wrote: >>> On 25/09/10 15:57, craphunter wrote: Yes, I have read it, but I don't really get it. What is the meaning of it? >>> >>> Consider a website that has multiple blogs, all of which are deployed to >>> the sam

Re: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread Benedict Verheyen
On 27/09/2010 23:59, Diederik van der Boor wrote: > SInce watching that video, my projects are composed by default of 2 apps. A > "projectname" for the core backend stuff, and a "projectname-site" with the > templates, settings, and frontend media. This is imho a nicer base to start > "hooking

Re: Where do you put your business logic in django? Organizing big projects in django.

2010-09-27 Thread Benedict Verheyen
On 27/09/2010 9:08, MrMuffin wrote: > Where do you put your business logic in django? In my project I`ve put > it into the models.py, but that file soon become huge and hard to > maintain. Of course I can just stuff it into whatever file I like, but > I`d like to have some standard way of doing thi

Re: SITE_ID

2010-09-27 Thread Benedict Verheyen
On 25/09/2010 18:32, Tim Sawyer wrote: > On 25/09/10 15:57, craphunter wrote: >> Yes, I have read it, but I don't really get it. What is the meaning of >> it? > > Consider a website that has multiple blogs, all of which are deployed to the > same database. > > Consider that you want each blog to

Re: Django Accounts - User account 'component'

2010-09-24 Thread Benedict Verheyen
On 23/09/2010 18:04, Guiga wrote: > Hi guys, > > I'd like to know if django have a "component" (or some like this) to > create, edit and login user's accounts. I mean, some like a system > user accounts to work with django. > > Thanks. > Hi, as mentioned you can use the authentication system o

Re: Relationship between multiple sites & projects, apps

2010-09-24 Thread Benedict Verheyen
c to different areas of our site since we can always break out more > servers to handle different virtual hosts. If it was all one > django project I don't think you could allocate infrastructure this > granularly. > > my 2 cents, but I'd love to hear what others think

Relationship between multiple sites & projects, apps

2010-09-23 Thread Benedict Verheyen
Hi, it's not exactly clear to me how the sites, projects and apps need to be structured. For instance, if you have 2 sites both with a domain name, how would you structure this in Django? The Django project could be called "mysites" or whatever name. In the admin site, you would then have 2 si

Re: Advice needed on bundling applications

2010-09-09 Thread Benedict Verheyen
On 7/09/2010 10:45, Benedict Verheyen wrote: > Hi, > > > i've written a calltracking application for my company and other apps will > follow soon. > Now, i would want a central way to access them and to assign rights on who > can see > and run what application. &g

Advice needed on bundling applications

2010-09-07 Thread Benedict Verheyen
Hi, i've written a calltracking application for my company and other apps will follow soon. Now, i would want a central way to access them and to assign rights on who can see and run what application. The dashboard or access panel will be very simple: icons that link to the application and bas

Re: generate cache by visiting protected links

2010-07-30 Thread Benedict Verheyen
On 30/07/2010 12:06, Jirka Vejrazka wrote: >> I still have 2 approaches i can take. > > I still believe that there is a 3rd option there - to bypass the > view / auth / login machinery completely :) > > > If your primary goal is to cache the statistics and the statistics > does not depend on

Re: generate cache by visiting protected links

2010-07-30 Thread Benedict Verheyen
On 29/07/2010 18:48, David De La Harpe Golden wrote: > On 29/07/10 16:58, Benedict Verheyen wrote: > >> So calling a thread once from within a view is not safe ? > > Depends on what your expectations are... > > I haven't managed to dig up the paragraph discuss

Re: generate cache by visiting protected links

2010-07-30 Thread Benedict Verheyen
On 29/07/2010 21:10, Jirka Vejrazka wrote: >> That's why i asked on what Django uses as a key to set and entry in the >> cache. >> If i generate the page and put it on the cache and then rely on Django to >> get it, >> the key i use needs to be the same as Django uses otherwise the page isn't >>

Re: generate cache by visiting protected links

2010-07-29 Thread Benedict Verheyen
On 29/07/2010 17:16, Jirka Vejrazka wrote: > Well, it probably depends on the frequency od data change as well as > other factors. I personally don't like spawning another thread in a > request-response cycle, but if it works for you, be happy with it :) > > Based on the print statement on you

Re: generate cache by visiting protected links

2010-07-29 Thread Benedict Verheyen
On 29/07/2010 17:53, David De La Harpe Golden wrote: > On 29/07/10 16:16, Jirka Vejrazka wrote: > > >> I personally don't like spawning another thread in a >> request-response cycle, but if it works for you, be happy with it :) > > IIRC it's not really safe, at least in the django/apache case, t

Re: generate cache by visiting protected links

2010-07-29 Thread Benedict Verheyen
On 29/07/2010 15:41, Jirka Vejrazka wrote: >>ret_val = stats_top_callers_per_year(_request) >>cache.set(reverse("stats_top_callers_per_year"), ret_val) > > Hi, > > it's your code and I won't try talk you out of it :) > > However, I don't see any reason why you couldn't call > "stats

Re: generate cache by visiting protected links

2010-07-29 Thread Benedict Verheyen
On 28/07/2010 18:51, Jirka Vejrazka wrote: > > Hi, > > is the statistics user-dependent? > > If not, just create a cron job (or similar, depending on your > platform) that will calculate the statistics every hour and maybe even > create the main blocks of the page to be displayed. > >

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-29 Thread Benedict Verheyen
On 28/07/2010 18:22, Kieran Farr wrote: > Thanks, David -- you're right on, now I just return an HttpResponse > with result code 404. > > Benedict, could you post the view for /management/statistics/top/user/ > yearly/ that is causing the 403? > > Kieran > Yes, here it is. Depending on wether

Re: Help:How to post data to the admin form by urllib2 ?

2010-07-28 Thread Benedict Verheyen
On 27/07/2010 17:48, jerry wrote: > Hi: > I build a website and want to login the admin form by python code. I > have disabled the CSRF in my project and use urllib2 to post data. > here are my codes: > -

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread Benedict Verheyen
On 28/07/2010 3:54, Kieran Farr wrote: > Further research shows that CSRF is enabled regardless of my > settings.py if we use Django's built-in auth. > > Obviously, we need to still use Django's auth, so we can't just > disable CSRF site-wide like this hack: > http://stackoverflow.com/questions/16

generate cache by visiting protected links

2010-07-28 Thread Benedict Verheyen
Hi, i have cache enabled on a few heavy statistical views. I would like to generate the pages before a user goes to that page and maybe even regenerate the pages every hour to avoid the initial delay. However, i can't seem to automate the caching as my site's authentication gets in the way of a

Re: Sorting objects according to a field from a foreign field

2010-06-22 Thread Benedict Verheyen
On 22/06/2010 16:42, Daniel Roseman wrote: > > As described in the documentation [1], you use the double-underscore > syntax for sorting across relationships. > Call.objects.all().order_by('-priority__weight') > > [1]:http://docs.djangoproject.com/en/1.2/ref/models/querysets/#order- > by-fiel

Sorting objects according to a field from a foreign field

2010-06-22 Thread Benedict Verheyen
I have an issue sorting objects. First, let me explain the models i'm using: class Call(models.Model): ... priority = models.ForeignKey(Priority) class Priority(models.Model): title=models.CharField(max_length=30) description=models.CharField(max_length=255) weight=models.Inte

Re: danjgo authentification

2010-04-22 Thread Benedict Verheyen
On 22/04/2010 15:46, Shawn Milochik wrote: Everything you need is here: http://docs.djangoproject.com/en/1.1/topics/auth/#authentication-in-web-requests This will tell you exactly, in detail, how to create your own login page to tie into the built-in authentication.

Re: error when updating

2010-03-19 Thread Benedict Verheyen
Benedict Verheyen wrote: > Benedict Verheyen wrote: > > As expected, it works if i set the values in my view: > > action = get_object_or_404(Action, pk=action_id) > form=ActionForm(instance=action) > if request.method == 'POST': > form = ActionF

Re: error when updating

2010-03-19 Thread Benedict Verheyen
Benedict Verheyen wrote: > > This is the code in my update view: > > def action_edit(request, action_id): > action = get_object_or_404(Action, pk=action_id) > if request.method == 'POST': > form = ActionForm(request.POST, act

Re: error when updating

2010-03-18 Thread Benedict Verheyen
ge...@aquarianhouse.com wrote: > You Welcome. > > I guess is the combination between POST nad instance data. > > did you try only: > > form = ActionForm(request.POST) > > because in POST is already the data posted. > > you might have like this before the form: > > def view_name(request): >

Re: error when updating

2010-03-18 Thread Benedict Verheyen
ge...@aquarianhouse.com wrote: > Hi, > > I hope I understood it right. You could set the field to > editable=False, the rest Django will take care. > > Btw, you have a typo "attachement" should be "attachment" I think. > Thanks for the info & finding the typo. Setting the field to editable=Fals

error when updating

2010-03-18 Thread Benedict Verheyen
Hi, i have a problem when saving a form for updating. In my model, i have a field date_created. Now when i edit the form, i don't want that field to be editable and thus is don't include it in the field list. I have specified a form where i specify the fields that i want to see on the form. I h

related forms on 1 page

2010-03-10 Thread Benedict Verheyen
Hi, i'm developing a simple calltracking application. I want to have a page where you can fill out info on a call and fill in 1 or more related actions. The models call & action look like this (mind i'm still in the early stages of development :)) class Call(models.Model): class Meta:

Re: date formats in settings.py

2008-11-07 Thread Benedict Verheyen
Benedict Verheyen wrote: I have solved it in my view. However, i'm not sure this is the best way to deal with it. In my view i set the input_formats of the datefield like this: report_f = ReportForm(request.POST,instance=r) report_f.base_fields['date_reported'].input_forma

Re: getting request.user into a ModelForm?

2008-11-07 Thread Benedict Verheyen
Rob Hudson wrote: > I have the following: > > ## MODELS > > class Category(models.Model): > user = models.ForeignKey(User) > name = models.CharField(max_length=200) > > class Link(models.Model): > user = models.ForeignKey(User) > category = models.ForeignKey(Category) > name

Re: date formats in settings.py

2008-11-06 Thread Benedict Verheyen
Karen Tracey wrote: > On Thu, Nov 6, 2008 at 11:30 AM, Benedict Verheyen > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: > > > Hi, > > i have a question on the different date/time settings one can specify in > the settings.py. >

date formats in settings.py

2008-11-06 Thread Benedict Verheyen
Hi, i have a question on the different date/time settings one can specify in the settings.py. I currently have these: TIME_ZONE = 'Europe/Brussels' DATE_FORMAT = 'd/m/Y' DATETIME_FORMAT = 'd/m/Y H:i' TIME_FORMAT = 'H:i' YEAR_MONTH_FORMAT = 'm Y' MONTH_DAY_FORMAT = 'd m' However, any date i ente

Re: Adding a custom permission to the User model

2008-10-30 Thread Benedict Verheyen
Benedict Verheyen wrote: > > Now i need to find out how i can make the syndb command aware of the > models in that subdirectory. Can i trigger this from the __init__.py > file that lives in the main application directory? I added the directory (project.app.modeldir) to the INSTALL

Re: Adding a custom permission to the User model

2008-10-30 Thread Benedict Verheyen
Benedict Verheyen wrote: > When i do python manage.py syncdb i don't see anything written to the > db. The permission is also not visible from within the users part of the > admin site. I found out that the syncdb command didn't work. I deleted a table and after i did th

Re: best practice to change allowed characters in a username

2008-10-29 Thread Benedict Verheyen
Jarek Zgoda wrote: > You have to unregister the admin class for User model before > registering your own. Thanks, that seems to solve the register error. However, the other question remains, is the way i'm going about to change the allowed characters ok? Thanks, Benedict --~--~-~--~

best practice to change allowed characters in a username

2008-10-29 Thread Benedict Verheyen
Hi, i want to know what the best practice is for following problem. I use the built in user authentication framework. I've already made the login authenticate against our AD. Works fine (see http://www.djangosnippets.org/snippets/901/) In our company, usernames are specified with a period betw

Re: File upload problem

2008-10-29 Thread Benedict Verheyen
Roodie wrote: > Hello, > > I have an interesting problem. One of the users of my ( test ) django > site reported that he cannot upload image banners to the site using > the custom admin. I've checked the logs, and found the following > exception logged: > > Traceback (most recent call last): >

Re: Adding a custom permission to the User model

2008-10-24 Thread Benedict Verheyen
Benedict Verheyen wrote: > Hi, > > I'm trying to specify a custom permission on the User model. > I would use it to delegate control to users over certain models. > > I have an admin.py file where i add this: > > from django.contrib.auth.models import

Adding a custom permission to the User model

2008-10-21 Thread Benedict Verheyen
Hi, I'm trying to specify a custom permission on the User model. I would use it to delegate control to users over certain models. I have an admin.py file where i add this: from django.contrib.auth.models import User ... class UserAdmin(admin.ModelAdmin): class Meta: permissions = (

Re: possible bug in django-admin

2008-09-11 Thread Benedict Verheyen
Karen Tracey wrote: > It's not trying to limit you to just one project. It's just trying to > prevent confusion by not letting you create and attempt to work with a > new project when you're running in an environment already set up to > manage a different project. In those cases, simply unset

  1   2   >