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
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
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
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
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
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):
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.
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
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:
>
>
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
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
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
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
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.
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
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
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
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
itial["password"]
>
> class MyUserAdmin(UserAdmin):
> form = UserChangeForm
> add_form = UserCreationForm
>
> list_display = ('email', 'is_admin')
> list_filter = ('is_admin',)
> fieldsets = (
>
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.
>>
&
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
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
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
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
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
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. 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
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,
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
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
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
)
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
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
19:18, Scott Somers wrote:
>
> > My urls
> >
> > urlpatterns = patterns('',
> > (r'^media/(?P.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT }),
> > )
> >
> > urlpatterns
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
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
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
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
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
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.
>
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
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
"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
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
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
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
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
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:
>>
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
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
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
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,
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'
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.
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
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
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
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:
&
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
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,
.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
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
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
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
/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
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
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.
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
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
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.
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
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
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
>> &
_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
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
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.
&
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
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
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('
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')
>
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
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
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
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
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
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
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, 小白
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:
> 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
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
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
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
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
> 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,
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
> 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
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
> 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
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
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
101 - 200 of 450 matches
Mail list logo