Django Admin doesn't show all fields from model when registered.

2012-08-16 Thread Tundebabzy
Hi guys, here's bit of my code http://dpaste.com/hold/787292/

The problem is that my Answer model in admin is missing the 'is_correct', 
'date_added' and 'modified' fields.




I tried adding: 
fieldsets = [

(None,   {'fields': ['text','is_correct','explanation']}),

]
to my AnswerInLine definition but that throws an ImproperlyConfigured error 
saying:
'AnswerInline.fieldsets[0][1]['fields']' refers to field 'is_correct' that is 
missing from the form.

Can anyone help out?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/qK1kFc-11lQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: saving several models with one save() call

2011-08-24 Thread Tundebabzy


On Aug 24, 3:36 pm, Tom Evans  wrote:
> On Tue, Aug 23, 2011 at 11:28 PM, ernando  wrote:
> > Hi all,
>
> > maybe it's newbie question but I wasn't able to find clear answer/
> > solution on it.
>
> > For example, we have the following models:
>
> > class A(models.Model):
> >    id = models.AutoField(primary_key=True)
> >    title = models.CharField(max_length=30)
>
> > class B(models.Model):
> >    id = models.AutoField(primary_key=True)
> >    title = models.CharField(max_length=30)
> >    aItems = models.OneToOneField(A)
>
> > And try to save them in the following way:
>
> > a = A(title="123")
> > b = B(title="333", aItems = a)
> > b.save()
>
> > This code runs with the error: (1364, "Field 'aItems_id' doesn't have
> > a default value")
> > if I firstly save a object - everything goes smoothly. So, the
> > question is - should we always save all related objects manually?
> > According to django docs we have to create object at first. But that's
> > now always convenient - e.g. I receive full model from the 3rd part
> > service and want to save it into DB with one call and not do it for
> > each item.
>
> > Regards,
> > Dmitry
>
> Only objects that exist in the database can be related to each other.
> If you have a function which accepts an model instance, it should make
> it clear that it is an error to pass it an object that does not exist
> in the database. You really should not be overriding save() to save
> related objects that do not exist in the database.
>
> Mostly these kind of problems go away if you start using the create
> and get_or_create helpers on the model's manager, eg I would never
> have this in my code:
>
> a = A(title="123")
> b = B(title="333", aItems = a)
> b.save()
>
> it would look like this:
>
> a, created = A.objects.get_or_create(title='123')
> b = B.objects.create(title='333', aitems=a)
>
> Cheers
>
> Tom

+1

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using gedit for django development

2011-09-13 Thread Tundebabzy
I'm submit this on Hacker News

On Sep 13, 1:35 am, Mario Gudelj  wrote:
> This is awesome dude. I was looking for something like this since I moved to
> Ubuntu.
>
> On 13 September 2011 10:12, Micah Carrick  wrote:
>
>
>
>
>
>
>
> > I've written a blog post on using gedit, the default text editor in GNOME,
> > as a Django IDE. If you're a Linux user and you've never considered using
> > gedit for development then this may be an interesting read for you.
>
> >http://www.micahcarrick.com/gedit-as-a-django-ide-for-linux.html
>
> >  --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For 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.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Staticfiles on shared hosting using FCGI

2012-01-13 Thread Tundebabzy
I am stuck after running collectstatic. I don't know how to point the
server to STATIC_ROOT.
Can someone give assistance.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Form Wizard: wizard_form.html

2013-01-04 Thread Tundebabzy
Hi, is there any reason why there is no form tag in wizard_form.html so I 
can upload a fix? I tried to use the Form Wizard for the first time today 
and discovered that I never got past the first page after submitting. 
Forensic investigations showed that nothing was getting submitted because 
there was no form tag.

I'm asking because the last change to contrib.formtools' wizard_form.html 
was a year ago and my brain can only comprehend that the missing form tag 
is a bug. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/7Pxg48_clnoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Please explain this django admin code

2013-01-25 Thread Tundebabzy
I'll be really grateful if someone can take the time to explain these lines 
of code. Its from contrib.admin.options

def wrap(view):
def wrapper(*args, **kwargs):
return self.admin_site.admin_view(view)(*args, **kwargs)
# This is the brain twisting line
return update_wrapper(wrapper, view)

The syntax foo.bar()(*osama **obama) is just blowing fuses in my brain and 
then from the code above, I can't even find where admin_view is defined.

Thanks for your time.

-- 
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 
django-users+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django and favicon.ico

2013-08-04 Thread Tundebabzy
Hi,
Is there any documentation on how django behaves during a GET /favicon.ico? 
In my django 1.4.5 installation with runserver, GET /favicon.ico redirects 
to /media/img/favicon; on OpenShift, it redirects to /media/favicon.ico.

My googlefu has failed me.

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Formset:What's INITIAL_FORMS for?

2016-04-09 Thread Tundebabzy
Hello, 
When using formset, what's the use of the management form's INITIAL_FORMS and 
why is it always set as 0.

Does INITIAL_FORMS need to be incremented when new forms are added?

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e24d4ca4-f1d0-4fd5-9f1c-26954973663d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.