admin: allow changlist view but not changeform

2013-05-05 Thread Rainy
Hi! I'm working on a site where I'd like to allow changelist view with sorting, filters, search and links to other custom views, but I want to block users from using changeform. I'm thinking of overriding the change_form template and adding a check there for user.is_superuser (for whom I do want

Re: django 1.5 not getting css

2013-04-21 Thread Rainy
On Sunday, April 21, 2013 11:18:22 AM UTC-4, Carlos Aboim wrote: > > Hi everyone. > > Anybody can tell me why I can get css on my flatpage /home/ ? > > http://dpaste.com/hold/1066757/ -> this is the html of the page > > http://dpaste.com/hold/1067747/ ---> this is the css styles > >

Re: Possible Basic kwargs question.

2013-04-17 Thread Rainy
When the definition is method(self, **kwargs), you ARE asking variable named kwargs. If you want to accept one dict object, it should be: method(self, mydict). If you want to accept variable list of args, it should be method(self, *mylist) -ak On Wednesday, April 17, 2013 12:59:21 AM UTC-4,

Re: django-social-auth problem with facebook

2013-04-17 Thread Rainy
When you get this error, you need to look at your database error log, e.g. for postgres 8.4 on linux: tail -n100 /var/log/postgresql-8.4-main.log It should tell you the exact sql command that caused the first error (you might need to scroll up). On Monday, April 15, 2013 2:01:21 AM UTC-4,

Re: Django-Registration/Custom Authentication Issue

2013-04-16 Thread Rainy
On Sunday, April 14, 2013 9:49:32 PM UTC-4, Lee Hinde wrote: > > I'm trying to do a 'simple' registration with just a user email and > password required to create an account. I'm using django-registration with > django 1.5.1 and have created a custom model and the custom model manager. > >

Re: Understanding UpdateView with forms and formsets

2013-04-08 Thread Rainy
Sorry, I answered before reading your full message. It looks like you understand post loads the object in get_object(). I just want to add that combined create/update can be done in different ways; I have an implementation in mcbv.edit module but I'm not sure if it's the best approach in all

Re: Understanding UpdateView with forms and formsets

2013-04-08 Thread Rainy
On Monday, April 8, 2013 12:22:34 PM UTC-4, Nora Olsen wrote: > > Hi, > > I'm a new user to Django. > > I'm trying to understand how does an UpdateView works when during a POST. > Is there some state carried between the GET and POST, because I don't see > the pk in the form. How does the

Re: Inspecting form errors in a view

2013-03-22 Thread Rainy
On Thursday, March 21, 2013 9:47:03 PM UTC-4, Aubrey Stark-Toller wrote: > > On Thu, Mar 21, 2013 at 03:40:39PM -0700, Rainy wrote: > > I believe you can just set self.my_flag = foo in clean method and then > > check for > > > Cheers for the reply. > > I su

Re: Inspecting form errors in a view

2013-03-21 Thread Rainy
On Thursday, March 21, 2013 5:07:36 PM UTC-4, aub...@deepearth.co.uk wrote: > > Hello, > > I have form class that has a relatively lengthy clean method which does > field > validation (as the validity of fields depends on the values of fields) as > well > setting error messages on the form

Re: I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Rainy
On Wednesday, February 27, 2013 11:28:50 AM UTC-5, Mark London wrote: > > I need a widget or a method that allows users to select items from a list > of choices, or add a new choice. Someone on stackoverflow asked the same > question, and got a kludgy answer: > > >

Re: Updated Django by Example tutorials

2013-02-15 Thread Rainy
On Monday, February 11, 2013 11:24:57 PM UTC-5, Rainy wrote: > > Hi, I've started updating Django by Example tutorials for django version > 1.5 and using class-based views. > I have posted 3 tutorials so far; 3 more will be added soon: > > http://lightbird.net/dbe2/ > >

Updated Django by Example tutorials

2013-02-11 Thread Rainy
. - rainy -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to dj

Re: Why doesn't form_valid() in FormView take a request argument?

2013-02-07 Thread Rainy
On Thursday, February 7, 2013 3:39:43 AM UTC-5, Some Developer wrote: > > On 06/02/13 23:00, Rainy wrote: > > On Wednesday, February 6, 2013 3:09:39 PM UTC-5, Some Developer wrote: > > > > Why doesn't the form_valid() (and for that matter the > form

Re: Why doesn't form_valid() in FormView take a request argument?

2013-02-06 Thread Rainy
ing it to the post argument of the > form_valid() method by using request.user. > > Am I missing something here? Is there any easier way to achieve what I > want to achieve? > How about using self.request attribute? -rainy -- You received this message because you are subscribed

modular CBVs

2013-01-27 Thread Rainy
Hi, I've written modular class-based views, based on generic views distributed with Django, and uploaded the initial version today: http://lightbird.net/mcbv/ The main difference vs. generic CBVs is that you can easily combine different views together, e.g. detail, create, list - in a single

Re: Combinable generic CBVs

2012-08-30 Thread Rainy
On Aug 29, 5:24 pm, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote: > On 29-8-2012 18:46, Rainy wrote: > > > On Aug 29, 3:10 am, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote: > >> On 29-8-2012 4:44, Rainy wrote: > > >>> When I use CBVs, I nea

Re: Combinable generic CBVs

2012-08-29 Thread Rainy
On Aug 29, 3:10 am, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote: > On 29-8-2012 4:44, Rainy wrote: > > > When I use CBVs, I nearly always end up needing to mix different types in > > the same view, e.g. detail view and list view, list view and modelform > > view,

Combinable generic CBVs

2012-08-28 Thread Rainy
When I use CBVs, I nearly always end up needing to mix different types in the same view, e.g. detail view and list view, list view and modelform view, etc. I really like CBVs but I feel this is the one shortcoming that I constantly run into that makes CBVs much less flexible and helpful than

Re: get().delete() does not work, filter().delete() works?

2012-03-16 Thread Rainy
On Friday, March 16, 2012 2:50:25 PM UTC-4, Tom Evans wrote: > > 1) You have overridden the delete() method, and you don't call the > > super class method > Indeed, I had overridden it to create a delete column and forgot about it! Thanks. Rainy > -- You received this m

get().delete() does not work, filter().delete() works?

2012-03-16 Thread Rainy
Hi, I have a function that accepts a pk and deletes an object: Item.objects.filter(pk=pk).delete() If I change it to: Item.objects.get(pk=pk).delete() it no longer works, without any errors. I tried it using exactly the same object. I looked at django docs for deletion, the only difference

Django breaks shelve?

2012-03-15 Thread Rainy
Hi, I have some shelved instances that were saved when a module was run from command line, but when it is run from inside django: from reminders import * Tasks() I get the standard shelve error: 'module' object has no attribute 'Task'. reminders module has classes Task and Tasks defined. If I

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:38 pm, Rainy <andrei@gmail.com> wrote: > On Jan 5, 12:35 pm, Guy Nesher <nesher@gmail.com> wrote: > > > Thanks, > > > I've initially tried to use a dictionary but was still unable to pull > > the data in the template. > > > I

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:35 pm, Guy Nesher wrote: > Thanks, > > I've initially tried to use a dictionary but was still unable to pull > the data in the template. > > I'm using your updated context processor: > def swiss_context_processors(request): >     added_context = { 'mytest':

Re: natural keys for auth.user and group

2011-03-17 Thread Rainy
I fixed the earlier issue, which was happening during serialization, by using add_to_class() class method, but now I'm running into an issue with deserialize(): [...] for deobj in deserialize(fmt, val, ensure_ascii=False, use_natural_keys=True): File

natural keys for auth.user and group

2011-03-16 Thread Rainy
Hi, I know natural keys possibly will be added to auth.user and group in 1.4. I'm using 1.2 currently and I'm trying to add them dynamically: class UserManager(models.Manager): def get_by_natural_key(self, username, first_name): return self.get(username=username,

Re: pgadmin vs schema migration

2011-02-24 Thread Rainy
On Feb 24, 9:54 am, ggavy wrote: > Thanks. It's good to get a little second opinion. I'm sure I'll make > the switch to migration tools eventually as things become a little > more involved. > > Cheers > gav I think the only possible danger is that you might forget

Re: South - when to start?

2011-02-19 Thread Rainy
On Feb 18, 10:59 am, ShawnMilo wrote: > Just to add my tiny bit to this: > > I say start with South right away. But when you're ready to deploy for the > first time, wipe it all and to another --initial. > > The reason is that South is awesome for letting you upgrade a

Re: Looking for IDE + FTP

2011-02-08 Thread Rainy
On Feb 8, 3:30 pm, Karen McNeil wrote: > I have three Django sites that I've been working on recently and I've > been doing most of the development work in Dreamweaver.  I don't use > any of the wysiwyg features (or, pretty much, any of the Dreamweaver > program

Re: using return upper

2011-02-01 Thread Rainy
On Feb 1, 6:12 pm, makayabou wrote: > Hello, > I try to simplify the problem. > > This model gives me a (None) result: > > class OperatingSystem (models.Model): >         operatingsystem = CharField (max_length=30, blank=True, null=True) >         def __unicode__(self): >  

Re: local variable 'qft' referenced before assignment

2011-01-24 Thread Rainy
On Jan 24, 1:46 pm, Trevor Stanley wrote: > Bruno > > I will take your advice and seek out some Python literature.  I did run > through an online Python tutorial about a year ago.  I should probably > go through it again as I may understand it more now. > > Thanks, even

Re: Can someone help with Many-to-many referencing and then calculations against another field on the linked model

2011-01-20 Thread Rainy
On Jan 20, 2:04 pm, Trevor Stanley wrote: > Kenneth > > That is what I originally though but if I write that this is the error I > get: > > in _get_fringe_value >     ft = Fringe.objects.select_related().filter(id=self.id).values() > AttributeError: 'str' object has no

Re: Django's documention is horrible

2011-01-12 Thread Rainy
On Jan 12, 7:18 am, Mike Dewhirst wrote: > OK - so we need an intro to the documention which describes the timeline > of a typical* developer transitioning from beginner to guru and the docs > which should be of interest at successive stages during that transition. > >

Re: Django's documention is horrible

2011-01-11 Thread Rainy
On Jan 11, 3:36 am, mrmclovin wrote: > On Jan 11, 7:44 am, Sam Lai wrote: > > > > > > > > > > > On 11 January 2011 13:39, Christophe Pettus wrote: > > This isn't about patches to the existing docs (which are great for > > their

Re: How to get a web development job (i.e. Django/Python) if someone is an amateur programmer?

2010-12-18 Thread Rainy
, -rainy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit

Re: Generic Views - do you use them?

2010-12-11 Thread Rainy
On Dec 10, 5:22 pm, Łukasz Rekucki <lreku...@gmail.com> wrote: > > On Fri, Dec 10, 2010 at 9:37 AM, Rainy <andrei@gmail.com> wrote: > > >> Is there a doc somewhere that details what the limitations are? How > >> do you tell if some task is definitely t

Re: Generic Views - do you use them?

2010-12-10 Thread Rainy
On Dec 10, 4:04 am, Łukasz Rekucki wrote: > You should try the new class-based generic > views:http://docs.djangoproject.com/en/dev/topics/class-based-views/ > > They're much more flexible. Is there a doc somewhere that details what the limitations are? How do you tell if

Re: Returning value directly to another function

2010-12-09 Thread Rainy
On Dec 9, 9:21 am, Quetzacotl wrote: > Hello, this is rather python problem, but maybe You can help. What i > want to do is to return value in another function calling from other > function. > > It doesnt mean i want this: > > def Func(): >      return 1 > > def Func2():

Re: Django Team Project Best Practices

2010-12-09 Thread Rainy
On Dec 9, 8:26 pm, "acat...@gmail.com" wrote: > I have been using Django for a little over two years as a freelance > developer.  I am currently working at a company where I am at the > beginning stages of a two-person Django app.  I have worked on group > projects before,

Re: Generic Views - do you use them?

2010-12-09 Thread Rainy
On Nov 8, 6:42 pm, Ted wrote: > What are their pros and cons?  How often do you use them when you're > coding? > > The more I code in django the less I find generic views to be useful > shortcuts (direct to template being the exception). > > My biggest complaints are: > *

Re: Using foreignkey data as a primary key

2010-11-18 Thread Rainy
On Nov 18, 9:04 am, JE wrote: > Hi, > > I'm pretty new to Django so feel free to laugh if something's > horrendously wrong here that I haven't spotted. > > I'm trying to use a field from a foreign key as a primary key in > another model, but have no idea how to do this. >

Re: New tutorial added to Django by Example

2010-08-03 Thread Rainy
On Aug 3, 2:25 am, Nikhil Somaru wrote: > How to set up a virtual python/django installation > There is already a tutorial for this here: http://codytaylor.org/2010/07/django-on-dreamhost-virtual-python-install.html -- You received this message because you are subscribed

Re: New tutorial added to Django by Example

2010-08-03 Thread Rainy
On Aug 3, 3:27 am, Mario wrote: > Thank you for sharing the application. I would like to make the start > day of the week Sunday instead of Monday. > > _Mario All you have to do use calendar module's method to set starting day of week:

New tutorial added to Django by Example

2010-08-02 Thread Rainy
I've added a new tutorial: Calendar App to my Django by Example site. As always, feedback is appreciated. What would be a good tutorial to do next? http://LightBird.net/dbe/ -ak -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Best way to present N items in table row for list

2010-07-28 Thread Rainy
On Jul 27, 12:51 pm, Wadim wrote: > Hello. > I have a list that i want to present in a table. > Each row should have 5 items. > For now i create the function that returns me new grouped list, that i > use later in a template. > def groupListByRow(list): >        

Re: New tutorial added to Django by Example

2010-07-20 Thread Rainy
On Jul 20, 12:09 pm, Mitch wrote: > For SEO, your title tags matter greatly, as do the tags, page > content and link text into and within the pages, probably in that > order. If I were you, I'd make sure each page's and tag > had "Django tutorial" in it. For example, on the

Re: New tutorial added to Django by Example

2010-07-20 Thread Rainy
On Jul 19, 2:33 pm, Venkatraman S <venka...@gmail.com> wrote: > On Mon, Jul 19, 2010 at 11:46 PM, Rainy <andrei@gmail.com> wrote: > > > >    http://LightBird.net/dbe/ > > > > You rock ;) > > > A small nit : make the site more search-friendly

New tutorial added to Django by Example

2010-07-19 Thread Rainy
I've added a new tutorial: A Simple Forum to my Django by Example site. As always, feedback is appreciated. http://LightBird.net/dbe/ -ak -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

New tutorial added to Django by Example

2010-07-12 Thread Rainy
I've added a new tutorial: A Photo Organizer and Sharing App to my Django by Example site. As always, feedback is appreciated. This tutorial illustrates the use of tags, ratings, albums, sharing, searching, filtering and sorting. http://LightBird.net/dbe/ -ak -- You received this

Re: New tutorial added to Django by Example

2010-07-11 Thread Rainy
On Jul 9, 9:41 pm, John M wrote: > WOW, this is very cool, you should see if you can add it to the main > django tutorial someway? Thanks! I don't think it will be added to main tutorial but I added the link to the list of tutorials on Django Wiki. -ak -- You received

Re: New tutorial added to Django by Example

2010-07-09 Thread Rainy
Thanks for great comments, Euan. See a few notes below.. On Jul 7, 6:20 am, "euan.godd...@googlemail.com" wrote: > Hi again, > > I've had a read over your blog tutorial and have the following > suggestions: > > 1) Make it PEP-8 (http://www.python.org/dev/peps/pep-0008/)

Re: New tutorial added to Django by Example

2010-07-06 Thread Rainy
Oh! I forgot the URL: http://lightbird.net/dbe/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

New tutorial added to Django by Example

2010-07-06 Thread Rainy
I've added a new tutorial: A simple Blog to my Django by Example site. As always, feedback is appreciated. This tutorial covers display of monthly archive, pagination, a simple, basic comment system, notification when comments are posted and a flexible interface for deletion of spammy comments.

Re: New Django tutorial

2010-07-03 Thread Rainy
Thanks for great feedback, Euan. I've added some comments below. On Jul 3, 8:26 am, "euan.godd...@googlemail.com" wrote: > I had a look over your tutorial and it looks pretty sweet. Definitely > gets down into explaining how to use the admin interface and taught me >

New Django tutorial

2010-07-02 Thread Rainy
Hi, I plan to make a bunch of Django tutorials and I just finished the first one: http://lightbird.net/dbe/ Please let me know how it can be improved and I'll incorporate suggestions into upcoming tutorials. Thanks! -ak -- You received this message because you are subscribed to the Google

Re: Combined search of specific fields

2010-05-17 Thread Rainy
Doh, here it is with hopefully fixed formatting: """ The following code searches records based on query and checkboxes checked in the search form. Query can have words with minus in front (e.g.: -word) to exclude terms. There are three checkboxes,

Combined search of specific fields

2010-05-17 Thread Rainy
The following code works fine but I'm wondering if there's a better / clearer way to do this. `qw` is a list of words to search for, `exclude` is a list of words to exclude from search. Thanks! """ Search records based on query and checkboxes checked in the

How to get to initial value in admin fieldset?

2010-04-20 Thread Rainy
I'm trying to customize admin template fieldset.html and I need to show field's value without widget. The loop there is: for line in fieldset | for field in line. The widget is shown like this: field.field. I tried field.initial, and various combinations; the only way I found to show dictionary of