Re: How to call a database function from Django?

2012-11-08 Thread Arnold Krille
On Thursday 08 November 2012 15:17:38 Kurtis Mullins wrote: > I usually create management commands and call that. Here's the docs: > https://docs.djangoproject.com/en/dev/howto/custom-management-commands/ As an alternative you can use django_extensions and create a job. Might be to much when its

Re: How many developers have moved to class-based views?

2012-11-11 Thread Arnold Krille
On Sun, 11 Nov 2012 09:57:16 -0800 (PST) Kevin wrote: > Hello! > > I am curious of how many existing Django developers have moved over > to class-based views or are still using the function-based ones. I > tend to use a mix depending on what I am trying to do. I try to >

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-15 Thread Arnold Krille
On Thursday 15 November 2012 17:12:09 Carsten Fuchs wrote: > using Django 1.3 (soon 1.4), we use models like these: > class Staff(models.Model): > name = models.CharField(max_length=80) > class Period(models.Model): > staff = models.ForeignKey(Staff) > begin = models.DateField() >

Re: transfer one django app to another server

2012-11-15 Thread Arnold Krille
On Thursday 15 November 2012 21:03:56 siddharth ghumre wrote: > You can just copy your app from your local machine to server. > Just keep in mind to do the necessary changes in the settings.py file. And remember that you might have a database that (if its on the same machine but not a local

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-15 Thread Arnold Krille
Hi, On Thu, 15 Nov 2012 18:15:37 +0100 Carsten Fuchs <carsten.fu...@cafu.de> wrote: > Am 15.11.2012 17:52, schrieb Arnold Krille: > > On Thursday 15 November 2012 17:12:09 Carsten Fuchs wrote: > >> [...] > >> (Note that it is not enough to consider the P

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-15 Thread Arnold Krille
On Fri, 16 Nov 2012 08:43:04 +1100 Mike Dewhirst <mi...@dewhirst.com.au> wrote: > On 16/11/2012 3:52am, Arnold Krille wrote: > > Why do you want to do this only in the admin interface? > > Its a generic thing: every time you save/change a period you should > > set the e

Re: Generating HTML code

2013-01-13 Thread Arnold Krille
On Sat, 12 Jan 2013 05:43:40 -0800 (PST) Matteo Suppo wrote: > I use http://foundation.zurb.com/ or > http://twitter.github.com/bootstrap/ > > They don't generate html but they help build pages faster. And then there are jetstrap.com and boottheme.com which help creating

Re: Form with variable fields

2013-01-26 Thread Arnold Krille
On Sat, 26 Jan 2013 11:39:20 -0800 (PST) sephii wrote: > Hey there, > > I'm trying to create a form with a "static" part (a "title" field, a > "date" field) and a variable part (these are "artist names", so > that's a single field that can be repeated multiple times,

Re: Form with variable fields

2013-01-27 Thread Arnold Krille
On Sat, 26 Jan 2013 17:38:03 -0800 (PST) sephii wrote: > Thanks for your answer. I wanted to avoid using a ManyToMany field in > my case for two reasons: > 1. The artist table has about 700'000 entries, which is really too > big to fit in a element > 2. I could

Re: url pattern correct but not working

2013-02-21 Thread Arnold Krille
On Thu, 21 Feb 2013 10:46:05 -0800 (PST) Aswani Kumar wrote: > my url pattern > > [a-zA-Z0-9]-(?P\d+).html > > urls will be like > > news-in-finland-yesterday-festival-3456.html > > i want 3456 which is news id. > > the regex is correct but not working if i keep it in

Re: url pattern correct but not working

2013-02-21 Thread Arnold Krille
On Thu, 21 Feb 2013 15:41:12 -0500 Bill Freeman wrote: > Not quite right either, even if it didn't have the non matched open > parenthesis after the carat, since it would match > "foo-bar--1234.html". > > Perhaps '^(?:[a-zA-Z0-9]+-)+(?P\d+).html$' > > (?:...) is a

Re: simplifying double decorators?

2014-11-30 Thread Arnold Krille
On Sun, 30 Nov 2014 10:30:29 -0800 Richard Brockie wrote: > I'm running into the situation where I have several views with the > same set of decorators: > @login_required() > @user_passes_test(some_test_function, login_url='/', > redirect_field_name=None) > def

Re: Every view requires authentication

2013-07-17 Thread Arnold Krille
On Wed, 17 Jul 2013 11:22:36 -0700 Jon Dufresne wrote: > My application requires an authenticated user for every view (with > very few exceptions). Is there a standard correct way to handle this > or should I roll my own middleware? I'm probably not the first have > this

Re: Design for storing likes/dislikes?

2013-07-17 Thread Arnold Krille
On Tue, 16 Jul 2013 17:29:47 -0700 (PDT) Victor Hooi wrote: > We have a list of users, who are going to like/dislike various > widgets. > > My question is regarding how to store the like/dislikes. > > Essentially, there can be three states between a user and a widget - >

Re: Every view requires authentication

2013-07-17 Thread Arnold Krille
On Wed, 17 Jul 2013 14:18:54 -0700 Jon Dufresne <jon.dufre...@gmail.com> wrote: > On Wed, Jul 17, 2013 at 1:25 PM, Arnold Krille <arn...@arnoldarts.de> > wrote: > > > On Wed, 17 Jul 2013 11:22:36 -0700 Jon Dufresne > > <jon.dufre...@gmail.com> wrote:The

Re: is Django useful for a basic site as well?

2013-07-19 Thread Arnold Krille
On Thu, 18 Jul 2013 17:45:32 -0400 Bill Freeman wrote: > Good programmers steal. Great programmers steal from the best. Find > a beautiful site and don't deviate much from his layout/CSS scheme. And some call their work a framework and make everyone use/steal it. @Alex:

Re: Query Set and Output

2013-08-07 Thread Arnold Krille
Hi, On Tue, 6 Aug 2013 20:19:01 -0700 (PDT) Muhammed TÜFEKYAPAN wrote: > def home(request): > output = Excuse.objects.order_by('?')[:1] [:1] selects all elements from the beginning up to the first and returns that list. true, its a list with only one member, but still

Re: South doesn't recognize modification in ManytoMany fields

2013-08-14 Thread Arnold Krille
Hi, On Thu, 15 Aug 2013 03:31:08 +0530 Pradeep Kumar wrote: > I have made a model change from > standard = models.ManyToManyField(Standard) > to > standard = models.ManyToManyField(Standard, blank = True, null = True) > South schemamigration for this app doesn't recognize

Re: Django Periodic tasks

2013-08-20 Thread Arnold Krille
On Sat, 17 Aug 2013 03:36:29 +0100 Some Developer wrote: > I'm aware of django-cron and django-celery, both of which are capable > of doing what I want but I was wondering if I was just making a > fundamental design mistake and there maybe a better option that > someone

Re: Testing Permissions in URL Includes

2013-09-13 Thread Arnold Krille
On Fri, 13 Sep 2013 11:30:44 -0700 Lee Hinde wrote: > So, the question, is there a way to wrap url include calls in a > permission check? Wrapping a whole url-include would only work when the url-tree is rebuild for each request taking into account the requesting user. Todays

Re: How to use selenium test against different browsers using LiveServerTestCase

2013-09-26 Thread Arnold Krille
On Thu, 26 Sep 2013 09:46:43 -0700 (PDT) Tianyi Wang wrote: > So follow the Django doc example, > https://docs.djangoproject.com/en/dev/topics/testing/overview/#django.test.LiveServerTestCase > In the example, the test only test against Firefox. How can I test > against

Re: What is the best solution to deploy Django on a Windows server?

2013-10-11 Thread Arnold Krille
On Fri, 11 Oct 2013 08:35:06 -0700 (PDT) Augusto Destrero wrote: > A client of mine want to keep its existing Windows Server > infrastructure, so I'm forced to deploy my Django based web > application on Windows 2003/2007. > > The first question is: > > is Django

Re: Loading data from Django into RedShift - ORM vs SQL?

2013-10-17 Thread Arnold Krille
Am Thu, 17 Oct 2013 13:32:44 +0300 schrieb Avraham Serour : > The whole idea of having an ORM is not having ot deal with SQL > directly unless necessary. I would try to do it using the ORM first > but there's not general rule, each case should be analised > individually

Re: Django - How to combine queries in to one and display it in the template?

2013-11-03 Thread Arnold Krille
On Sun, 3 Nov 2013 18:31:42 +0530 Robin Lery wrote: > Suppose this is a model for an app Blog: > class Blog(models.Model): > And this is another model for an app Status: > class Status(models.Model): > How do I come up with something like this: > What I wan't is that, in

Re: Logging warnings inside settings.py

2013-11-03 Thread Arnold Krille
On Fri, 1 Nov 2013 10:11:05 -0700 Jon Dufresne wrote: > I am trying to log warnings inside settings.py. I want to log warnings > when settings (from an outside source) are not provided, but the > application can continue. Is this possible? It seems like this might > not

Re: Testing Frameworks and Practices(consensus?)

2013-12-12 Thread Arnold Krille
Am Wed, 11 Dec 2013 12:03:44 -0500 schrieb Thomas Murphy : > This seems like a more appropriate forum that SO for this discussion. > > I've been testing my apps with Selenium, which seems to be a popular > choice for Django, but so does unittest and some others, as

Re: Adding Objects to Query Set

2013-12-17 Thread Arnold Krille
Hi, define related names in ProjectMember: class ProjectMember(models.Model): project = models.ForeignKey(Project, related_name='members') member = models.ForeignKey(User) added_on = models.DateTimeField() The full query to get all Projects the User is either member or leader:

Re: wxMailServer: GUI tool to help you with testing Django e-mails

2013-12-19 Thread Arnold Krille
Hi On Thu, 19 Dec 2013 01:23:58 -0800 (PST) Michał Pasternak wrote: > I would like to announce a GUI app, written in wxPython, that I > quickly assembled yesterday mainly using some code from StackOverflow > and Google. > > The app is called wxMailServer and all it does

Re: migrations to custom user model - complex project

2014-01-25 Thread Arnold Krille
Hi, On Fri, 24 Jan 2014 15:10:44 +0100 Frank Bieniek wrote: > a do have to upgrade an existing > django project, it is an openid provider with around 10k users. > In order to update to django 1.6 I do need to get rid of > the good old AUTH_PROFILE_MODULE and need

Re: Optimizing DB query involving annotate and aggregate

2014-02-06 Thread Arnold Krille
On Wed, 5 Feb 2014 10:11:29 -0800 (PST) ST wrote: > Hi, > > I'm trying to optimize the run-time of getting total credit and debt > values out of our database. Ideally I'd like to formulate it as a > Django query. This is the raw SQL query I have, which produces the > right

Re: Using SSL and Apache on Windows together

2014-02-09 Thread Arnold Krille
On Sun, 9 Feb 2014 06:48:10 -0800 François Schiettecatte wrote: > SSL is not something that is handled by Django but is further up the > stack, you should check how to implement SSL with your Windows Server. Actually its not that high (or low) on the stack. You don't

Re: I'm getting obsessed! Where should I put this code?

2014-02-09 Thread Arnold Krille
On Sun, 9 Feb 2014 02:15:46 -0800 (PST) Glyn Jackson wrote: > So far I have moved this logic around so many times, but where should > it really be happening in my Django project? Opinions very much > welcome. Thanks > > 1) product *pre_save* - this works really well but

Re: very light weight django task queues

2014-04-06 Thread Arnold Krille
On Sun, 6 Apr 2014 03:33:30 -0700 (PDT) TinyJaguar wrote: > I've been using both django-huey and celery as task queues with > varying success in other projects. > see (https://www.djangopackages.com/grids/g/workers-queues-tasks/) > > Most of the task queues are redis