I want to create a model that brings user_id of the user_auth table as
foreign key , layer_id from layer table(defined by me) as also a
foreign key . Combine both to form a primary key . and have another
integer called perm .
My model looks like this


from django.contrib.gis.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from maps.models import  Sdr_Layer

class PermiLayer(models.Model):
    user = models.ForeignKey(User)
    table =
models.ForeignKey(ContentType,related_name='custom_permission_set')
    permi = models.IntegerField()



My view logic is this

if form.is_valid():
                        data = form.cleaned_data
                        rad1=form.cleaned_data['radio1']
                        rad2=form.cleaned_data['radio2']
                        user=User.objects.get(username = data['user'])

                        perm = PermiLayer()
                        perm.user = user
                        perm.table = user_type =
ContentType.objects.get_for_model('maps_parking')
                        perm.permi = rad1 + rad2
                        perm.save()

This gives me the error that I have mentioned above . How do I change
the model and the view to remove the error ?

-- 
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.

Reply via email to