Re: delete obsolete content type entries...

2013-03-25 Thread chris
It seems that stale content types return `None` for 
`ContentTpye.model_class()` , so the following deletes all stale content 
types. I would back up and test this extensively first though because 
deleting content type you don't want to is dangerous.

for c in ContentType.objects.all():
   if not c.model_class():
 print "deleting %s"%c
 c.delete()

On Monday, February 11, 2013 1:13:42 AM UTC-6, vijay shanker wrote:
>
> we can delete all obsolete ContentType entries manually.
> >>>for each in ContentType.objects.filter(app_label=appname): each.delete()
>  thanks
>
> On Friday, May 4, 2007 8:42:51 PM UTC+5:30, Jens Diemer wrote:
>>
>>
>> I have delete some app models. So, in the internal django tables 
>> "django_content_type" and "auth_permission" are some old content types 
>> entries.
>>
>> So i received errors like: "ContentType matching query does not exist." 
>> (When i create a new user group).
>>
>> Is there a way to update the django tables automatically?
>>
>> -- 
>> Mfg.
>>
>> Jens Diemer
>>
>>
>> 
>> A django powered CMS: http://www.pylucid.org
>>
>>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: delete obsolete content type entries...

2013-02-10 Thread vijay shanker
we can delete all obsolete ContentType entries manually.
>>>for each in ContentType.objects.filter(app_label=appname): each.delete()
 thanks

On Friday, May 4, 2007 8:42:51 PM UTC+5:30, Jens Diemer wrote:
>
>
> I have delete some app models. So, in the internal django tables 
> "django_content_type" and "auth_permission" are some old content types 
> entries.
>
> So i received errors like: "ContentType matching query does not exist." 
> (When i create a new user group).
>
> Is there a way to update the django tables automatically?
>
> -- 
> Mfg.
>
> Jens Diemer
>
>
> 
> A django powered CMS: http://www.pylucid.org
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: delete obsolete content type entries...

2007-06-19 Thread Jens Diemer

Gabriel Farrell schrieb:
> On May 7, 4:32 am, Jens Diemer <[EMAIL PROTECTED]> wrote:
>> That surprises me. Does nobody have the same problems?
>> Still nobody delete a model class?
>>
>> How to clean up the django tables? With phpMyAdmin?
>>
> 
> I've just run into a similar issue when I removed an app from a
> project.  After some attempt to fix the tables myself, I held my
> breath, dropped the tables (auth_permission and django_content_type),
> then ran "python manage.py syncdb".  Voila, the tables were re-created
> correctly, without the app I had removed.

Yes, you can drop and recreate the tables.
But if you setup users and permissions, then IMHO you lost this :(

For PyLucid i have made a small tool to fix this:
http://pylucid.net/trac/browser/branches/0.8%28django%29/PyLucid/tools/clean_tables.py?rev=1085


-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: delete obsolete content type entries...

2007-06-18 Thread Gabriel Farrell

On May 7, 4:32 am, Jens Diemer <[EMAIL PROTECTED]> wrote:
> That surprises me. Does nobody have the same problems?
> Still nobody delete a model class?
>
> How to clean up the django tables? With phpMyAdmin?
>

I've just run into a similar issue when I removed an app from a
project.  After some attempt to fix the tables myself, I held my
breath, dropped the tables (auth_permission and django_content_type),
then ran "python manage.py syncdb".  Voila, the tables were re-created
correctly, without the app I had removed.

> --
> Mfg.
>
> Jens Diemer
>
> 
> A django powered CMS:http://www.pylucid.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: delete obsolete content type entries...

2007-05-08 Thread Jens Diemer


Here a stand alone cleanup script, for discussion:

http://paste.pocoo.org/show/1482/


btw. you should have the same problem, if you test a separate django 
app. And "deinstall" it later.

If you use "django.contrib.auth" and "django.contrib.contenttypes" there 
must be exist obsolete contenttypes and permission entries, after you 
deactivate the test-App.

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: delete obsolete content type entries...

2007-05-07 Thread Jens Diemer

That surprises me. Does nobody have the same problems?
Still nobody delete a model class?

How to clean up the django tables? With phpMyAdmin?

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



delete obsolete content type entries...

2007-05-04 Thread Jens Diemer


I have delete some app models. So, in the internal django tables 
"django_content_type" and "auth_permission" are some old content types 
entries.

So i received errors like: "ContentType matching query does not exist." 
(When i create a new user group).

Is there a way to update the django tables automatically?

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---