> from django.shortcuts import get_object_or_404
>
> get_object_or_404(User,username = request.user)
>
--
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
If the user is marked as deleted and we want to do soft delete.What can we
do to have the username available again for use.
Can we just mask the deleted usernames with some random string so that the
actual username can be used?
On Sunday, June 24, 2012 10:36:02 AM UTC-4, Dhivya wrote:
>
> Hi,
Hi,
username field in django.contrib.auth.User model is unique.
Probably, the username you are trying to save already exists.
In your view, you might want to check,
try:
username = User.objects.get(username=form.cleaned_data['username'])
except ObjectDoesNotExist:
#create user new
Glad I could help!
Le 26 août 2011 12:53, "Torsten" a écrit :
> Thanks Thomas you helped me a lot these are my first step in python
> and django.
> And I really starting to like it
>
> Torsten
>
> On 26 Aug., 12:23, Thomas Orozco wrote:
>>
Thanks Thomas you helped me a lot these are my first step in python
and django.
And I really starting to like it
Torsten
On 26 Aug., 12:23, Thomas Orozco wrote:
> While we're at it, here are a few suggestions.
> So long as you can, you should use unicode inside python
While we're at it, here are a few suggestions.
So long as you can, you should use unicode inside python code. The main
logic would be that input should be converted to unicode as soon as
possible, and that output should be encoded (likely to UTF-8) as late as
possible.
Consequently, you might
Actually, the line "invoice = models.ForeignKey(Invoice)" tells Django "An
invoice item should always be attached to an invoince".
You must realize that models are what they claim to be... models. They are
not items of their own, they just define how you would model a particular
item in your
Thanks Thomas
your are right concerning the sum there is no need for that.
But you say:
Your invoice items have no invoice attribute, as the error says.
Isn't this line which defines the attribute ?
invoice = models.ForeignKey(Invoice)
Thanks
Torsten
On 26 Aug., 11:41, Thomas Orozco
That would be blank = True
Le 26 août 2011 11:58, "Kejun He" a écrit :
> Sometime, set null = true would allow a field to be empty
>
> On Fri, Aug 26, 2011 at 5:41 PM, Thomas Orozco wrote:
>
>> Your invoice items have no invoice attribute, as the
Sometime, set null = true would allow a field to be empty
On Fri, Aug 26, 2011 at 5:41 PM, Thomas Orozco wrote:
> Your invoice items have no invoice attribute, as the error says.
>
> By the way, although I'm not sure of what you're trying to achieve, let me
> point out
Your invoice items have no invoice attribute, as the error says.
By the way, although I'm not sure of what you're trying to achieve, let me
point out that there is not really a need for a sum field in your invoice as
you can just sum all the invoice items' amount (and respect the DRY
principle -
Well, there are some ways around it if you use dumpdata/loaddata
statements. But for initial fixtures, it causes trouble.
When the DB is created, django will dynamically try to populate the
content-types table. But if you are already putting data into that
table, the primary keys will clash.
When
On Tue, Jun 14, 2011 at 8:00 PM, christian.posta
wrote:
> Yes, it is. Any reason why you want the content-types to be part of
> your fixtures? Why not let django build that up by itself?
>
Well essentially it was just a dumpdata from earlier that is being
used. But why
Yes, it is. Any reason why you want the content-types to be part of
your fixtures? Why not let django build that up by itself?
On Jun 14, 1:21 am, Amit Sethi wrote:
> On Tue, Jun 14, 2011 at 1:41 AM, christian.posta
> wrote:
> > Are you
On Tue, Jun 14, 2011 at 1:41 AM, christian.posta
wrote:
> Are you using your own fixtures (like initial_data.json)?
> Is it possible that in your initial_data.json ( or whatever fixture
> you're using) that you're including entries into the content_types
[..]
Well i do
Are you using your own fixtures (like initial_data.json)?
Is it possible that in your initial_data.json ( or whatever fixture
you're using) that you're including entries into the content_types
table? You should probably remove that from your fixtures and let
django build the content types
Daniel,
thanks for pointing that out, the amended code now does what it was
supposed to do. makes perfect sense when you explained it.
i already had the slug and user excluded, which is why it allowed me
to add them but didn't validate them im guessing.
chained fk's was down to the error
On Sunday, March 27, 2011 9:41:53 AM UTC+1, shofty wrote:
>
> this is the view code...
>
> u = get_object_or_404(UserProfile, user=request.user)
> if request.method == "POST":
> # submitted the add venue form
> venue_form = VenueForm(request.POST)
>
been playing with this some more and i still can't work out what ive
done to cause this issue.
as i see it, when saving a Venue, the Survey model which is FK'd to
the Venue is complaining that the user_id isn't set.
However there is nothing being saved by the Survey model, so why is it
even
this is the view code...
u = get_object_or_404(UserProfile, user=request.user)
if request.method == "POST":
# submitted the add venue form
venue_form = VenueForm(request.POST)
venue_form.user = u
venue_form.slug = slugify(request.POST['name'])
if
The error you are getting has something to do with your user field in
the Venue model, which based from your models cannot be null. How are
you associating a user to it?
On Mar 25, 7:45 pm, shofty wrote:
> I've got the following models.
>
> class UserProfile(models.Model):
>
Hello again,
well i am stupid:
the code above works,null=True should work
but when changin the model a simple "manage.py syncdb"
is sometimes not enough as it does not alter created tables
so i "manage.py reset" the whole thing and that's it...
sorry for the spam
kalinsko
On Jun 2, 8:34 pm,
2009/6/21 Alessandro Ronchi
>
> it gets into the except and tries to open another User with the same id!
>
It seemed to be a very big int for uid that caused a truncation when saving
into database.
--
Alessandro Ronchi
Skype: aronchi
SOASI Soc.Coop. -
2009/6/21 Alessandro Ronchi
> I have a very strange problem.
>
> With this function:
>
> def get_current(self):
>
> facebook = get_facebook_client()
> user, created = self.get_or_create(id=int(facebook.uid))
> if created:
> #
In your form sub-class class you'll need to override the clean method
to check for duplicate entries and raise a validation error if they
exists:
from somewhere import models
from somewhere import forms
class myForm(forms.ModelForm):
some_unique_field = forms.CharField()
class
any ideas?
--~--~-~--~~~---~--~~
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 email to
I've looked into this further, and it looks like it's actually an issue with
PostgreSQL, not django. The field I'm querying is of type inet, and I'm
inputting an IPv6 address. However, it appears that in PostgreSQL (running
version 8.3.5) IPv6 addresses only match a query when the string being
Well, after validating, syncing, re-validating and re-syncing, I ended
up just dropping the entire database and now it works fine.
On Sep 14, 10:10 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error for
> the first
>From the http://code.djangoproject.com/wiki/NewbieMistakes
Problem ¶
When you have a Field: current_zip =
meta.IntegerField(maxlength=5,blank=True)
django will create a not nullable field in the DB. However leaving the
field blank (in admin/web) django will try and insert a NULL value in
the
Hey Tim,
Yeah, I understand what you mean, but I thought that django used "" by
default and not NULL. That's why I defined in my model to allow blank,
and not include null=True.
Part of the model is this:
class Factor(meta.Model):
20 first_name = meta.CharField(maxlength=25)
30 matches
Mail list logo