Re: Django-Registration/Custom Authentication Issue

2013-04-16 Thread Scott Anderson
Django registration is not compatible with custom user models in Django 1.5, as it directly references django.contrib.auth.models.User in several places. If you want to maintain your own copy you can swap those refs for those of your own User model. -scott Via mobile phone On Apr 16, 2013, at

How to translate database content?

2013-04-16 Thread Cody Scott
I want the end user of the site to be able to view the site in different languages. I have marked the static text in my templates for translation. I have not marked the verbose_names because they are used in the admin which the end user will not have access to. But I just realized that the act

How to clear all session variables without getting logged out?

2013-04-16 Thread Cody Scott
I am trying to clear all of the session variables but not logout the current user. user = request.session.get('member_id', None) request.session.flush() request.session.modified = True request.session['member_id'] = user request.session.modified = True Will this also affect

Re: make_template_fragment_key is in what version?

2013-04-11 Thread Scott Anderson
Derp, my fault, thanks. I don't know how I missed that. Odd that that was the page that showed up first in the search results too. Regards, -scott On Apr 11, 2013, at 8:24 PM, James Bennett wrote: > Notice that your URL marks the version of Django as 'dev' -- that

make_template_fragment_key is in what version?

2013-04-11 Thread Scott Anderson
se" for more information. (InteractiveConsole) >>> from django.core.cache.utils import make_template_fragment_key Traceback (most recent call last): File "", line 1, in ImportError: No module named utils >>> import django >>> django.VERSION (1, 5, 1, 'final', 0) >>> Regards, -scott smime.p7s Description: S/MIME cryptographic signature

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
ls.ManyToManyField(Question) created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="quizzes") #questions = models.ManyToManyField(QuestionManager, null=True, related_name="quiz") class Meta: verbose_name_plural = "quizzes" def __unicode__(self):

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
that I can set Choices for a Question when I am making a Quiz? On Wednesday, 10 April 2013 13:38:14 UTC-4, Cody Scott wrote: > > I am trying to store questions in a database. > I don't to set a fixed number of options for the question, some questions > could have 4 or 2 or 5.

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
w is duplicate a question, edit on a single page, > hit save. > > Brian Schott > bfsc...@gmail.com > > > > On Apr 10, 2013, at 3:02 PM, Cody Scott > > wrote: > > I like the is_correct and the count attributes! > > The problem with that it is hard to make

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
m/derek-schaefer/django-json-field > > 3. There are several flavors of ListField out there: > http://djangosnippets.org/snippets/1491/ > > > > Brian Schott > bfsc...@gmail.com > > > > On Apr 10, 2013, at 1:38 PM, Cody Scott > > wrote: > >

How to use a list in a django model

2013-04-10 Thread Cody Scott
I am trying to store questions in a database. I don't to set a fixed number of options for the question, some questions could have 4 or 2 or 5. Currently I am using a ManyToManyField to a table that just contains a CharField. This works but creating an option requires making another Choice objec

Can't get Save method to work

2013-04-09 Thread Cody Scott
I have a Question Model with a ForeignKey field (answer) and a ManyToManyField (choices) that link to the same model (Choice). When I create a question I create a new Choice object for the answer field but that option does not show up for the choices field. I don't want to have to cancel the cr

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
n or not is > going to check if you are active and superuser. > > # Active superusers have all permissions. > if self.is_active and self.is_superuser: > return True > > > On Tue, Apr 9, 2013 at 9:46 AM, Cody Scott > > wrote: > >> If I don't h

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
f.is_active and self.is_superuser: > return True > > > On Tue, Apr 9, 2013 at 9:46 AM, Cody Scott wrote: > >> If I don't have them and I log in to admin I get >> "You don't have permission to edit anything." >> >> >> On Tue, Apr 9, 2013 a

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
gt; https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user > > Do not override those methods otherwise all users will return always true. > > > On Tue, Apr 9, 2013 at 9:22 AM, Cody Scott wrote: > >> In the docs >> https://docs.djangoproject.

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
perms(self, app_label): return True On Tue, Apr 9, 2013 at 11:05 AM, Cody Scott wrote: > In models.py in /django/contrib/auth there is a > > u.is_superuser = True > > but when I add it just like how is_staff and is_active are added I get the > error > > "Fie

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
PermissionsMixin' " On Monday, 8 April 2013 11:09:29 UTC-4, Cody Scott wrote: > > To create a User object you need to have a unique username. > > I would like to use an email and a password to identify users, since an > email is already required for my site's funct

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
Except the super user I created with syncdb doesn't have access to anything On Tuesday, 9 April 2013 10:24:19 UTC-4, Cody Scott wrote: > > Thank you that was my issue. Now syncdb works I also needed to add a name > parameter to create_superuser and create_user and make sure create

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
our module/app is 'mysite' and you have defined 'Users' > class in 'mysite/models.py', then your settings.AUTH_USER_MODEL should be > 'mysite.Users' > > > On Tue, Apr 9, 2013 at 4:52 PM, Cody Scott > > wrote: > >> I placed the

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
itial["password"] > > class MyUserAdmin(UserAdmin): > form = UserChangeForm > add_form = UserCreationForm > > list_display = ('email', 'is_admin') > list_filter = ('is_admin',) > fieldsets = ( >

Re: Why is a username required for a User?

2013-04-08 Thread Cody Scott
Yes I am using Django 1.5 On Monday, 8 April 2013 11:11:57 UTC-4, Anderson Borges wrote: > > Hey Cody are using django 1.5? > > > On Mon, Apr 8, 2013 at 9:09 AM, Cody Scott > > wrote: > >> To create a User object you need to have a unique username. >> &

Why is a username required for a User?

2013-04-08 Thread Cody Scott
To create a User object you need to have a unique username. I would like to use an email and a password to identify users, since an email is already required for my site's functionality. It seems silly for a framework so restrict you. -- You received this message because you are subscribed to

Why is there no view for sign up in django.contrib.auth.views?

2013-04-05 Thread Cody Scott
If I want users to sign up for my site, I need to make a register view, register form and a register template. Why is there a view and form for every other user account action (login, logout, etc.) -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: How to create a form list for a Model Form dynamically?

2013-04-03 Thread Cody Scott
ow at first. > > Is this line wrong "quiz = Quiz.objects.get(id=quiz_id)"? > > I don't think Django names the pk "id" by default. Maybe it should be: > > quiz = Quiz.objects.get(pk=quiz_id) > > On Monday, April 1, 2013 7:17:13 AM UTC-7, Cody Scot

Re: How to create a form list for a Model Form dynamically?

2013-04-03 Thread Cody Scott
The function I was calling there was in the urls.py file and it only took one parameter. I tried it again and with passing request and it still says quiz_id is unknown... On Monday, April 1, 2013 10:17:13 AM UTC-4, Cody Scott wrote: > > I am trying to make a simple quiz app. > > I

How to create a form list for a Model Form dynamically?

2013-04-01 Thread Cody Scott
I am trying to make a simple quiz app. I am trying to go to the URL /quiz/ and using the quiz_id which has a list of questions associated with the quiz id and create a list of forms to use in the model form. In the urls.py file I know you can pass a list of forms to be used, but I need to crea

Can't create an object with a foreign key

2013-03-19 Thread Cody Scott
I get the error when I try to make an object. Cannot assign "u'Category object'": "Course.category" must be a "Category" > instance. here is my admin form admin.py admin.site.register(Category, list_display = ('name',)) CATEGORIES = [(category, category.name) for category in Category.objects

Can't make an object with a foreign key

2013-03-19 Thread Cody Scott
Can't make an object with a foreign key. When I submit it says Cannot assign "u'Category object'": "Course.category" must be a "Category" > instance. > Here is my admin form admin.py > admin.site.register(Category, list_display = ('name',)) > CATEGORIES = [(category, category.name) for ca

Re: TemporaryFileUploadHandler leaving tempfiles behind on disk

2013-03-06 Thread Scott White
path'): os.unlink(obj.temp_file_path) # connect crazy hack to post_save post_save.connect(remove_temp_sample_file, sender=Sample) This is working for now, but I'd really like to know why sometimes the temp file gets stuck and sometimes it gets removed. Thanks, Scott On Wednesday, March 6,

Re: TemporaryFileUploadHandler leaving tempfiles behind on disk

2013-03-06 Thread Scott White
he FileField.file is no longer the temp version there. Any ideas? It was mentioned to write a custom file upload handler, but I'm a little unclear on how to do this or whether I could safely delete the temp file from there. Thanks, Scott On Monday, March 4, 2013 12:12:00 PM UTC-5, mso

Possible bug with Form Wizard and condition_dict?

2012-10-05 Thread Scott Woodall
I searched the bug tracker and the django users with no results, so is what I'm seeing a bug? I have a form wizard that is using a callable within condition_dict. If I try to access "wizard.steps.current" inside the callable, I get the following error: "maximum recursion depth exceeded in __in

A single file that contains common django imports

2012-07-06 Thread Scott Woodall
Would there be any issues with creating a single file contains common django modules I use, then importing that file into my views, models etc. Example: common_imports.py === from django.conf import settings from django.core.urlresolvers import reverse from django.shortcuts import re

Re: cannot access admin

2012-07-04 Thread Scott Somers
) urlpatterns += patterns('', url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'), url(r'^admin/', include(admin.site.urls)), <--- had a $ here url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'), On Wed

Re: cannot access admin

2012-07-04 Thread Scott Somers
Yes, and this is a little embarrassing I was missing a line from the debugging output. /home/tacobake/Source Code/Python (Komodo)/tacobakedotnet/../tacobakedotnet/dotnet_forms/views.py in home 1. article = Article.objects.get(menu__menu_title = menu, article_title__start

Re: cannot access admin

2012-07-04 Thread Scott Somers
19:18, Scott Somers wrote: > > > My urls > > > > urlpatterns = patterns('', > > (r'^media/(?P.*)$', 'django.views.static.serve', > {'document_root': settings.MEDIA_ROOT }), > > ) > > > > urlpatterns

cannot access admin

2012-07-04 Thread Scott Somers
So I don't normally spam forums/ mailing lists etc for help but I really screwed something up. Basically when I try and access my admin site, for example: DoesNotExist at /admin/auth/group/ Article matching query does not exist. DoesNotExist at /admin/dotnet_forms/article/ Article matching q

Re: Auto increase number number

2012-05-16 Thread Scott Gould
What is the purpose of the "no" field? If it's for display, it may be that you don't need to store it in the database at all. Something like: no, obj = enumerate(UserProfile.objects.all()) Even if it does need to be stored in the database, it's a calculated value that must be based upon the entir

Re: a very simple beginners question

2012-05-02 Thread Scott Gould
Are you looking for custom management commands? https://docs.djangoproject.com/en/dev/howto/custom-management-commands/ On May 2, 8:59 am, alon wrote: > running > > $python manager.py shell > > opens a python shell > is there any way (a parameter) to make the manager run a python file > with my

Re: Django log lines spamming syslog

2012-03-23 Thread Scott Gould
Nail, meet head. Thanks! I was thinking along similar lines but stupidly checked everywhere (my code, apache confs, etc.) except the django source on the server itself. On Mar 23, 11:36 am, Reinout van Rees wrote: > On 23-03-12 14:49, Scott Gould wrote: > > > > > Our syslog h

Django log lines spamming syslog

2012-03-23 Thread Scott Gould
Hi folks, Our syslog has been filling up for some time with this stuff and we only just noticed due to logrotate breaking on us. For what appears to be every django request across all virtual hosts, we are getting a pair of lines, like so (blank lines inserted by me): Jan 27 14:48:52 cloweb01 apa

Re: newbie django hosting question

2012-03-14 Thread Scott Macri
more options, visit this group at >> >http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. >

password_reset email template issue

2012-03-11 Thread Scott Macri
I'm having an issue with my email template for the password_reset view. For some reason I keep getting the following instead of my template text: You're receiving this e-mail because you requested a password reset for your user account at example.com. Please go to the following page and choose a

Re: built-in-views trouble

2012-03-11 Thread Scott Macri
ption Location: /Library/Python/2.6/site-packages/django/core/urlresolvers.py in _get_callback, line 170 Python Executable: /usr/bin/python Python Version: 2.6.1 On Sun, Mar 11, 2012 at 12:01 PM, Scott Macri wrote: > Django version is 1.3.1 final. > > If I call /accounts/passwo

Re: built-in-views trouble

2012-03-11 Thread Scott Macri
"Could not import %s.%s. View is not callable." % > "Could not import %s. View does not exist in module %s." % > "Could not import %s. Parent module %s does not exist." % > > Alan > > > On Saturday, March 10, 2012 6:56:30 PM UTC-5, hack wrote: >&g

Re: built-in-views trouble

2012-03-10 Thread Scott Macri
Strange. The same issue occurs with the password_reset view as well. On Sat, Mar 10, 2012 at 5:05 PM, Scott Macri wrote: > That's exactly what I was thinking.  So I changed > 'django.contrib.auth.views.change_password' to > 'django.contrib.auth.views.bullfrog&#

Re: built-in-views trouble

2012-03-10 Thread Scott Macri
2 PM, Bill Freeman wrote: > I would expect ViewDoesNotExist to not be sensitive to the template.  It > sounds like the urlconf is specifying a view function that does not exist > (at least in the way and in the place that it is specified). > > On Sat, Mar 10, 2012 at 3:07 PM, Scott

Re: built-in-views trouble

2012-03-10 Thread Scott Macri
Even explicitly setting the template name causes a ViewDoesNotExist error to occur. url(r'^accounts/password/change/$', 'django.contrib.auth.views.password_change',{'template_name':'registration/password_change_form.html',}), Anyone have any ideas? Thanks

built-in-views trouble

2012-03-09 Thread Scott Macri
t I can do, I've been struggling with getting these views to work for most of the day again today. When I try to access the logout_then_login via the following link: http://localhost:8000/myapp/accounts/out/in everything works perfectly. What could be some possible issues causing this pr

Re: urls.py and login forms

2012-03-09 Thread Scott Macri
Finally got it working. The issue was due to the url for the form method within the example template on the django site. I removed that and everything works great now. Thanks. On Fri, Mar 9, 2012 at 9:29 AM, Tom Evans wrote: > On Fri, Mar 9, 2012 at 2:11 PM, Scott Macri wrote: >>

Re: urls.py and login forms

2012-03-09 Thread Scott Macri
thon Executable: /usr/bin/python Python Version: 2.6.1 On Fri, Mar 9, 2012 at 9:02 AM, Scott Macri wrote: > Unfortunately changing that breaks my entire app so none of my views > work anymore. > > On Thu, Mar 8, 2012 at 11:34 PM, vikalp sahni wrote: >> Hi, >> >> Here

Re: urls.py and login forms

2012-03-09 Thread Scott Macri
part of > that pattern. > > https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix > > Hope this helped. > > > Regards, > //Vikalp > > On Fri, Mar 9, 2012 at 7:23 AM, Scott Macri wrote: >> >> How am I supposed to configure access to the buil

Re: send_mail problem

2012-03-08 Thread Scott Macri
I switched to make sure it wasn't the database. On Thu, Mar 8, 2012 at 5:49 PM, Dennis Lee Bieber wrote: > On Thu, 8 Mar 2012 13:59:02 -0500, Scott Macri > declaimed the following in gmane.comp.python.django.user: > > >> The strange thing is if I manually update the

urls.py and login forms

2012-03-08 Thread Scott Macri
Does anyone have any suggestions as to what I can try to fix this? Thanks. -- Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group,

Re: send_mail problem

2012-03-08 Thread Scott Macri
something like, 'I love my veggies', everything seems to work fine. On Thu, Mar 8, 2012 at 1:59 PM, Scott Macri wrote: > OK, I ran the debugger and here is what I came up with: > > -> print "CHECK MESSAGE :" > (Pdb) repr(email_message) > "u'test1'

Re: send_mail problem

2012-03-08 Thread Scott Macri
mmand prompt the email then works. This is a very strange issue. On Thu, Mar 8, 2012 at 1:25 PM, Scott Macri wrote: > Nope, I guess that only fixed it for a minute. > > On Thu, Mar 8, 2012 at 1:21 PM, Scott Macri wrote: >> I'm very new to python and django.  Thanks for the tip.  

Re: send_mail problem

2012-03-08 Thread Scott Macri
Nope, I guess that only fixed it for a minute. On Thu, Mar 8, 2012 at 1:21 PM, Scott Macri wrote: > I'm very new to python and django.  Thanks for the tip.  I was trying > to figure out how to set break points. > > I figured out what the problem was. > > In views.py I wa

Re: send_mail problem

2012-03-08 Thread Scott Macri
n Thu, Mar 8, 2012 at 12:47 PM, Tom Evans wrote: > On Thu, Mar 8, 2012 at 4:58 PM, Scott Macri wrote: >> I've come to the conclusion that send_mail and send_mass_mail cannot >> be used with sqlite due to a but with the message text. >> >> Attempting to pull a string

Re: send_mail problem

2012-03-08 Thread Scott Macri
012 at 10:49 PM, Scott Macri wrote: > UGH, I guess that wasn't the issue.  Its back again.  I don't know > what the deal is. > > On Wed, Mar 7, 2012 at 9:29 PM, Scott Macri wrote: >> I just figured this one out: >> >> Basically in the view I had the following

Re: send_mail problem

2012-03-07 Thread Scott Macri
UGH, I guess that wasn't the issue. Its back again. I don't know what the deal is. On Wed, Mar 7, 2012 at 9:29 PM, Scott Macri wrote: > I just figured this one out: > > Basically in the view I had the following just before calling the save > method on the database: &

Re: send_mail problem

2012-03-07 Thread Scott Macri
is that the data was actually being stored in the correct field in the database, and was coming out correctly, but something went haywire when I tried to wrap it in a message. On Wed, Mar 7, 2012 at 9:13 PM, Scott Macri wrote: > This one never sends the message: > > print object.e

Re: send_mail problem

2012-03-07 Thread Scott Macri
This one never sends the message: print object.email_message some test text mailer.sendMessage('subject3',object.email_message,user.email,[person.email]) This one works fine: mailer.sendMessage('subject3','a test message here',user.email,[person.email]) On Wed,

Re: send_mail problem

2012-03-07 Thread Scott Macri
.CharField(max_length = 750,blank=True) I then do the following call message = object.email_message and pass it to the send_mail function. For some reason the message never gets sent. If I do the call without getting the data from the database it works fine. On Wed, Mar 7, 2012 at 8:51 PM, Scott Ma

send_mail problem

2012-03-07 Thread Scott Macri
at an error is never thrown. Anyone ever see this before? Thanks. -- Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send e

Re: sending django email via gmail

2012-03-06 Thread Scott Macri
Got this resolved. The issue was that I needed to close my idle session and reopen it after changing my settings. On Tue, Mar 6, 2012 at 4:05 PM, Scott Macri wrote: > Here is my telnet response: > > Trying 74.125.45.109... > Connected to gmail-smtp-msa.l.google.com. > Esca

Re: sending django email via gmail

2012-03-06 Thread Scott Macri
the django app. Thus, I know it's not a port conflict. On Tue, Mar 6, 2012 at 1:09 PM, Tom Evans wrote: > On Tue, Mar 6, 2012 at 5:28 PM, Scott Macri wrote: >> I'm attempting to send a message from my django app via gmail and keep >> getting a connection refused error

sending django email via gmail

2012-03-06 Thread Scott Macri
/Versions/2.6/lib/python2.6/smtplib.py", line 273, in _get_socket return socket.create_connection((port, host), timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 512, in create_connection raise error, msg error: [Errno 61] C

Re: help with time

2012-03-02 Thread Scott Macri
er one form up to the attribute of the form . > > 2012/3/3 Scott Macri >> >> OK, I'm experimenting with time.  To be specific datetime.time.  My >> goal is to generate a list of times in a pull down menu so when the >> user saves the form it populates the db with

help with time

2012-03-02 Thread Scott Macri
was hoping for something similar to the SelectDateWidget, but it doesn't exist for time only. Thanks. -- Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.

Re: Automated Processes

2012-03-02 Thread Scott Macri
Awsome, cron it is! Thanks. :) On Fri, Mar 2, 2012 at 11:48 PM, Russell Keith-Magee wrote: > > On 03/03/2012, at 4:10 AM, Scott Macri wrote: > >> I'm trying to figure out the best way to create an automated in a >> python/django web application.  My intention is to s

Re: Automated Processes

2012-03-02 Thread Scott Macri
Sorry, that should read "create an automated process". On Fri, Mar 2, 2012 at 3:10 PM, Scott Macri wrote: > I'm trying to figure out the best way to create an automated in a > python/django web application.  My intention is to send an email > message in the future based

Automated Processes

2012-03-02 Thread Scott Macri
but I would rather have the process be part of my django application so I don't have to worry about extra stuff. Another thought was to use a time, but if the timer process stops before the message is sent, that's it KABAM. Any thoughts on how to handle this situation? Thanks.

Re: Admin Module

2012-02-25 Thread Scott Macri
Disregard this post. The issue was garbage urls I forgot to delete from the url.py file. On Sun, Feb 26, 2012 at 12:30 AM, scott macri wrote: > I'm having an issue getting my admin module to work.  I am getting the > following error.  Any thoughts?  Thanks. > > TemplateSyntaxEr

Admin Module

2012-02-25 Thread scott macri
Server time:Sat, 25 Feb 2012 23:24:28 -0600 Template error In template /Library/Python/2.6/site-packages/django/contrib/admin/templates/admin/base.html, error at line 31 Caught ViewDoesNotExist while rendering: Tried get_notes_health in module hcp.views. Error was: 'module' o

Re: import problem

2012-02-16 Thread Scott Macri
that later tonight. > > Furbee > > > On Thu, Feb 16, 2012 at 2:04 PM, Dennis Lee Bieber > wrote: >> >> On Thu, 16 Feb 2012 13:41:32 -0500, Scott Macri >> wrote: >> >> >I don't believe I have any circular imports in my code.  I have a >> &

Re: import problem

2012-02-16 Thread Scott Macri
_date = datetime.date(int(some_date[0:4]),int(some_date[5:7]),int(some_date[8:10])) As soon as the code gets to the line containing start_date it fails. On Thu, Feb 16, 2012 at 11:38 AM, DrBloodmoney wrote: > On Thu, Feb 16, 2012 at 9:20 AM, Scott Macri wrote: >> DrBloodmoney I not sure what you me

Re: import problem

2012-02-16 Thread scott macri
ting anything else that is importing an > overridden date method or datetime object? > > You can also try this (instead of "import datetime"): > > from datetime import date > > On Wed, Feb 15, 2012 at 7:48 PM, Scott wrote: >> >> Hello, >> I'm having

Re: import problem

2012-02-16 Thread Scott Macri
Oh, the other thing is that if I run the exact same code in my idle shell within the hcp app all the imports work fine. On Thu, Feb 16, 2012 at 9:20 AM, Scott Macri wrote: > DrBloodmoney I not sure what you mean by circular imports.  datetime > is the only import I have in this file. &

Re: import problem

2012-02-16 Thread Scott Macri
of "import datetime"): > > from datetime import date > > On Wed, Feb 15, 2012 at 7:48 PM, Scott wrote: >> >> Hello, >> I'm having a strange issue and have already spent an hour trying to >> figure it out. >> >> I created a python app call

import problem

2012-02-15 Thread Scott
Hello, I'm having a strange issue and have already spent an hour trying to figure it out. I created a python app called mn. Then I setup all my models and stuff to work under mn.hcp. Everything has been working fine until I tried to use date time in a py file in the hcp directory. I've imported

Re: Django 1.3 logging not working as I'd expect

2011-08-27 Thread Scott Danzig
7;t called until AFTER login.. Oops :) Thanks all. Gelonida N wrote: > > On 08/28/2011 12:00 AM, Scott Danzig wrote: >> >> >> Gelonida N wrote: >>> So before your three lines: >>>> import logging >>>> logger = logging.getLogger('

Re: Django 1.3 logging not working as I'd expect

2011-08-27 Thread Scott Danzig
Gelonida N wrote: > > On 08/20/2011 06:51 AM, Scott Danzig wrote: > You have to be sure, that logging is configured before actually logging > anything. > > So before your three lines: >> import logging >> logger = logging.getLogger('otherlogger') >

Re: Django 1.3 logging not working as I'd expect

2011-08-27 Thread Scott Danzig
s configured before > the apps models / views / whatever are imported. > > @Scott: Are you running the dev server ? If yes, the settings module > should be imported "only" twice so you may import it directly (ie: > "import settings") from your app. If yes, replace t

Re: login auth issue - beginner

2011-08-20 Thread Scott Danzig
It reports you're missing the key "username" from your POST... so the first thing I'd check for is ... do you have a line like this in your login template page?: -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the

Django 1.3 logging not working as I'd expect

2011-08-19 Thread Scott Danzig
I have Django 1.3 working with Python 2.7 and MySQL 5.5 on Mac OSX Lion... I'm betting I'm missing something straight forward, but: I have a simple Django app in development that uses a dictConfig setting simpler than the default in settings.py: LOGGING = { 'version': 1, 'disable_existi

Re: Time duration in django models

2011-08-09 Thread Scott Gould
Nothing native. I'd store it in seconds, as an int, and let the model convert to and from a timedelta. Looks like there's a snippet all ready to go: http://djangosnippets.org/snippets/1060/ On Aug 9, 6:32 am, Mohamed Ghoneim wrote: > Hey guys, > > I am just wondering if there is a time duration

Re: Accessing "request" from within an authentication backend

2011-07-26 Thread Scott Gould
I'd raise a custom exception (e.g. "PasswordExpiredError") and handle the message creation in the view. On Jul 26, 3:59 pm, Steven Smith wrote: > Is there a way to access the HttpResponse, or issue a redirect from > within a custom authentication backend? I have Django hooked up to our > Active D

Re: Selecting distinct months from a QuerySet

2011-05-19 Thread Scott Gould
I'd either add a manager with a method that did the query you describe in SQL, or (if you're wanting the whole queryset anyway) just calculate it via: months = list(set(x.datetime_field.month for x in queryset)) months.sort() On May 19, 1:03 am, Ian Turner wrote: > Hi, > > I would like t

Re: Looking For A Solid Learning Tutorial

2011-04-14 Thread Scott Foubister
There are some good screencasts on ShowMeDo.com http://showmedo.com/videotutorials/django On Apr 14, 6:01 am, grimmus wrote: > I just found a site full of great tutorials > -http://www.lightbird.net/dbe/index.html > > Learning lots of things and new techniques too ! > > On Apr 13, 5:49 pm, 小白

Re: forms.ChoiceField get displayed value

2011-01-20 Thread Scott Gould
Try something like this: field = form.fields['property'] data = form.cleaned_data['property'] if isinstance(data, (list, tuple)): # for multi-selects friendly_name = [x[1] for x in field.field.choices if x[0] in data] else:

Re: I get an error when I used urllib2.urlopen() to open a remote file in a ftp server

2011-01-07 Thread Scott Hebert (slaptijack)
>         file = 'ftp:/16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv' Looks like you are missing a second slash before the IP address there. file = 'ftp://16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv' -- Scott Hebert http://slaptijack.com/ -- You received this message bec

Re: Django admin - action on delete

2011-01-07 Thread Scott Hebert (slaptijack)
ride it. http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.delete -- Scott Hebert http://slaptijack.com -- 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

Re: Redirecting to last view after login.

2011-01-05 Thread Scott Hebert (slaptijack)
sors.request is in your TEMPLATE_CONTEXT_PROCESSORS settings variable. 2) That you aren't overwriting the request variable accidentally with your own. Good luck! -- Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: A few beginner questions

2011-01-05 Thread Scott Gould
On Jan 4, 9:38 pm, Shawn Milochik wrote: > Hi Ondřej. > > ... > #2: The validation should all be done during form validation[2], prior to > save. Using a Form or ModelForm. That way, the user can get friendly, useful > errors. Further to this, look into model validation if the logic is integral

Re: auth_user first_name and last_name editing

2010-11-24 Thread Scott Gould
A simple custom ModelForm should do the trick: from django.contrib.auth.models import User class UserChangeForm(forms.ModelForm): class Meta: fields = ('first_name', 'last_name',) model = User On Nov 24, 1:33 pm, BozoJoe wrote: > HI, > > I'm using django

Re: table namespace hygiene: should I try to rename auth_* tables, or should I use a separate database?

2010-11-01 Thread Scott Gould
> If not, I could create a new database, and devote it to the django > stuff. Is that a good solution? Are there significant disadvantages to > using a separate mysql database just for the django stuff? Is there > maintenance overhead for the dba? (I don't know.) Are there any > disadvantages, say,

Re: How to aggregate values by month

2010-10-28 Thread Scott Gould
Personally I hate writing raw SQL so I would probably try something like this (untested): sales = Sale.objects.filter(date_created__range=(init_date,ends_date)) .values(date_ created__month) .aggregate(total_sales=Sum('total_value')) sales_by_month = [(x.year, x.month, [y for y in sales i

Re: Access to field name in upload_to?

2010-10-26 Thread Scott Gould
> One idea would be to put 'fieldname' as the first parameter to the > function, then use functools.partial [1] to create partial functions > for each file field with the value set appropriately: > >         thumbnail_image = FileField(upload_to=partial(get_upload_path, > 'thumbnail_image')) Outst

Access to field name in upload_to?

2010-10-26 Thread Scott Gould
Hi folks, I've got all my file uploads (that go to S3 as it happens, but I don't think that's overly important) taking their path from one upload_to delegate: def get_upload_path(instance, filename=None): """ Defaults to appname/modelname/uuid. """ return "%s/%s/%s

Re: Query field across multiple django models

2010-10-26 Thread Scott Gould
> Second, I'm not sure I understood the last part about getting the > field within each model. Sorry, I misread, thinking you were talking about having different parameters of each model being responsible for what counted as "latest". Bruno's solution looks good to me. -- You received this messa

Re: Query field across multiple django models

2010-10-26 Thread Scott Gould
Maybe -- in fact, almost certainly not -- the best way, but this is how I do that kind of thing: a_queryset = ModelA.objects.all() another_queryset = ModelB.objects.filter.(by_something=True) yet_another_queryset = ModelC.objects.exclude(by_something_else=False) fr

Re: serving SOAP service with soaplib, consuming with suds

2010-10-23 Thread Scott Hebert (slaptijack)
response = client.service.hello_world(hello_string="hi") >>> print response (200, hi) Let us know if that works for you. -- Scott Hebert http://slaptijack.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To pos

<    1   2   3   4   5   >