Re: @login_required do nothing

2012-04-28 Thread yati sagade
Hi Have you set the LOGIN_URL setting in settings.py? That setting should be assigned a location(e.g., "/login/") to redirect to when your view is called without the user logged in. Also, you can do this if for some reason you don't want to have that setting. @login_required(login_url="/login/

Re: @login_required do nothing

2012-04-28 Thread Jonathan Baker
Apologies, as I shouldn't have assumed that the import had not taken place. Would you mind posting the views.py to pastebin or codepad? On Sat, Apr 28, 2012 at 2:24 PM, marcelo nicolet wrote: > Thanks, but of course the views module does the import. > I'm a python newbie. Just to test it, I comme

Re: Databases

2012-04-28 Thread Shawn Milochik
Assuming your PYTHONPATH is set up properly, and your DJANGO_SETTINGS_MODULE is correct or you import your settings file from your crawler, then you can just import and use the models. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Databases

2012-04-28 Thread Aurelio
Hi there, I am new to Django and I have set up my models and admin site working as I want. Perfect! But, I have a problem; I am making a little project for a search engine so I have a webcrawler, so my question is: Is there a way to acces and modify the database with the program? (not with the she

Re: URL resolution in a Django template

2012-04-28 Thread Karen Tracey
On Sat, Apr 28, 2012 at 3:04 PM, LJ wrote: > In other words, if I have two methods with the same name, but each in > a different directory, how would Django know which method to call? By "method" here I think you are meaning "url pattern" (specifically, get_required_meeting_participants in your e

Re: Cannot add/save flatpages via admin???

2012-04-28 Thread Karen Tracey
This was a bug in the flatpage form validation, where it would throw an exception rather than give you an error message if you did not specify any values for the required sites field. Fixed now on git master. You can also avoid it by being sure to select at least one site for the page. Karen -- h

dutch django hoster

2012-04-28 Thread Vidja
I'm looking for a reliable Dutch (speaking) hosting company that is able to host a Django based website for a small non-profit organization with ,surprise, ... a low budget. The idea is that when something goes wrong they can just call a support help desk and they don't have to deal with maintenanc

Re: @login_required do nothing

2012-04-28 Thread marcelo nicolet
Thanks, but of course the views module does the import. I'm a python newbie. Just to test it, I commented the import line, and the page loads without trouble. I suppose that referencing a symbol not imported would raise an exception! On 04/28/2012 04:18 PM, Jonathan D. Baker wrote: You have t

Re: Display Video inside a Text field -Django Templates

2012-04-28 Thread Nikhil Verma
Hi Pratik Thanks for the reply {{ post.user.forum_profile.signature|safe }} contains complete text including the urls of youtube and other links. Only youtube links will show video(i have made them displayed in iframe) and other will open in a new tab. Currently this task have been achieved by

Re: Display Video inside a Text field -Django Templates

2012-04-28 Thread Pratik Mandrekar
Hi, You will need to identify the video url in the post, then depending on the url try do some processing, like getting the title or thumbnail and render it back to your template. If you want to play the video, you will need a video player. Eg. If it is a youtube link, then embed the youtube playe

Re: keep models simple ? where to put the business logic ?

2012-04-28 Thread HarpB
First of all, I think your function is too big if it is doing all of these things. Are you able to unit test the function? In my view, the logic for extract should not be in the model. I would create a class specifically for data extractions. I am assuming that the _store does not DB saves to

Re: @login_required do nothing

2012-04-28 Thread Jonathan D. Baker
You have to be sure and import the module at the top of your script: from django.contrib.auth.decorators import login_required. Otherwise, it's never in scope and thus not available. Sent from my iPhone On Apr 28, 2012, at 1:00 PM, marcelo nicolet wrote: > Hi > Following the on-line docs ( >

Storing Sorl-thumbnail created images in separate folder

2012-04-28 Thread Swaroop Shankar V
Hello All, I am using sorl-thumbnail extensively in my project. It works perfectly fine except for one issue which is regarding the storage. The default behaviour of sorl-thumbnail is to create the images in the same folder where the original image is stored. Is it possible to provide a separate lo

URL resolution in a Django template

2012-04-28 Thread LJ
I am using ajax to update a list of participants in my html page, based on the student id selected. I am trying to figure out how Django knows what path to look to find my method. Does it just go through all of the urls.py files until it finds a method that matches the url request? $('#id_s

@login_required do nothing

2012-04-28 Thread marcelo nicolet
Hi Following the on-line docs ( https://docs.djangoproject.com/en/1.4/topics/auth/ ) I decorated my "index" view with @login_required, but nothing happens. In other words, it'supossed I would be redirected to a login page, else an exception migth raise. But the whole thing keeps doing as alway

django and oracle --

2012-04-28 Thread gmail
hello django boys, i hope someone here can help me. i have a problem with django e oracle. above the code with problem: insert = """insert into modello (title, descrizione, url, prezzo, sconto) values (:title, :descrizione, :url, :prezzo, :

Cannot add/save flatpages via admin???

2012-04-28 Thread DjangoKid
I dont know much about Python and Django. Whenever i try to save a flat page i got error: ValueError at /admin/flatpages/flatpage/add/ Exception Value: Cannot use None as a query value http://dpaste.com/739338/ I am using Python 2.7.3 and Django 1.4 ad sqlite3 as database -- You received this

Re: outdated django book

2012-04-28 Thread Jonathan Baker
Ah yes, I should have clarified that in my response. @knowledge_seeker, if you'll check your python code with a tool like pyflakesit will tell you when you're referencing modules that have not been imported (as well as many other common errors). I use the pyfla

Re: Does adding editable=False to model require a data migration?

2012-04-28 Thread Micky Hulse
Hi Jerome! Thanks for your help, I really appreciate it. :) On Apr 28, 2012, at 7:59 AM, Jerome Baum wrote: > Sounds like it. If you are using South then you can also run > "manage.py schemamigration --auto" and South will tell you > whether it thinks a schema migration is required. If it isn't

Re: Custom commands for manage.py

2012-04-28 Thread .
> Just redefine your Command class option_list: > class MyBadCommand(BaseCommand): >   option_list = () # no options at all... The problem is that I want to be able to write my own options. -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: Can't find module

2012-04-28 Thread Gerald Klein
Ok thanks I will give that a try. --jerry On Sat, Apr 28, 2012 at 4:28 AM, Alagappan wrote: > In your installed applications list you have mentioned 'search' as an > application. But in your url pattern you are using 'cms.search'. Either use > 'cms' as your installed application or mention it

Re: Edit-once object in admin?

2012-04-28 Thread Roy Smith
On Saturday, April 28, 2012 10:35:40 AM UTC-4, Shawn Milochik wrote: > > Override the save() method to raise an exception if "self.id is not > None." > But, that still doesn't tell the admin interface to *show* the fields as read-only (which is really what I'm interested in). If I raise an

Re: Does adding editable=False to model require a data migration?

2012-04-28 Thread Jerome Baum
On Apr 27, 7:34 pm, Micky Hulse wrote: > From the docs: > > editable > Field.editable > If False, the field will not be editable in the admin or via forms > automatically generated from the model class. Default is True. > > So, it reads like I can add the editable argument to the field without > h

Re: Edit-once object in admin?

2012-04-28 Thread Shawn Milochik
I think you have to change your model. Override the save() method to raise an exception if "self.id is not None." This won't prevent developers from using the 'update()' or 'delete()' methods of a queryset, but for a single instance it shouldn't be editable. It will still be able to be deleted

Edit-once object in admin?

2012-04-28 Thread Roy Smith
I've got a model that looks something like this: class Image(Model): name = CharField(max_length=40) class ImageVersion(Model): image = ForeignKey(Image) upload_date = DateTimeField(auto_now_add=True) data = ImageField(upload_to="images/learncms") I want all the data in an ImageV

Re: how to get the variable in the context

2012-04-28 Thread Thomas Rega
Am 28.04.12 11:11, schrieb DanYun Liu: I defined a context processor to pass the login user info to the template. and, I also need to use it in the view. is there any way to get the variable from the context? http://stackoverflow.com/questions/41547/always-including-the-user-in-the-django-te

Re: how to get the variable in the context

2012-04-28 Thread Amao Zhao
Dear DanYun Liu Django has the biuld-in middlewar with the user. You can use the user in your templates immediately. 在 2012年4月28日星期六,DanYun Liu 写道: > I defined a context processor to pass the login user info to the template. > and, I also need to use it in the view. > > is there any way t

Re: Can't find module

2012-04-28 Thread Alagappan
In your installed applications list you have mentioned 'search' as an application. But in your url pattern you are using 'cms.search'. Either use 'cms' as your installed application or mention it as just 'search.views.search' in your url pattern. I feel that should do the job. Thanks, Alagappan

how to get the variable in the context

2012-04-28 Thread DanYun Liu
I defined a context processor to pass the login user info to the template. and, I also need to use it in the view. is there any way to get the variable from the context? -- Pursuit the freedom of the soul. -- You received this message because you are subscribed to the Google Groups "Django us

Re: Can't find module

2012-04-28 Thread Gerald Klein
Sorry hit the send button http://dpaste.com/739184/ Here it is and thanks --jerry On Fri, Apr 27, 2012 at 6:46 AM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On Apr 27, 3:56 am, Gerald Klein wrote: > > Hi, I am having a strange problem, I have a search module named 'search'

Re: Can't find module

2012-04-28 Thread Gerald Klein
Environment: Request Method: GET Request URL: http://localhost/search/ Django Version: 1.4 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.stati

Re: outdated django book

2012-04-28 Thread Daniel Roseman
Which, of course, is nothing to do with Django versions, and was true even when the Django book was new. On Saturday, 28 April 2012 03:30:26 UTC+1, jondbaker wrote: > > You need to import User from django.contrib.auth.models and login_required > from django.contrib.auth.decorators. Hope this hel