Thursday, 15 May 2014

python - Django datatable view related fields -


I'm confused with this one I'm using to show data from the model However, I get an error: "There is no 'replacement' feature in the 'Tupal' object. Is this a model type or a conversion problem?

My lists

  class CustomerList (BaseDatatableView): Model = Profile column = [("id", 'user__id'), ("name", 'customer__ name'), 'abn', 'street', 'suburb', 'post_code', 'state', 'mobile' ] Order_class = = [("id", "user_id")] max _display_length = 500 def render_column (auto, line, column): pprint.pprint (globals ()) pprint.pprint (local ()) if column == 'mobile': return str (line.mobile) Other: return super (customerlist) , Self) .render_column (line, column) def get_initial_queryset (self): return customer.officefileter (client_id = self.request.user.profile.client id)  

my model

Customer class (models.Model): name = models.CharField (max_length = 100) Client = Model. ForeignKey (Client) Date_created = models.DateField (auto_now_add = true, n Ull = true, empty = True) history = historic Record () def __unicode __ (self): return self Name class profiles (models.Model): user = models.OneToOneField (user, primary_key = true, related_name = 'profile') abn = model.carfield (max_land = 11, help_text = "Australian business number") road = model Kharefild (maximum_long = 100) suburban = model. Kharifild (max_long = 100) client = model. Forinz (client, empty = true, default = 1, zero = true) customer = model. Foreign (customer, empty = true, zero = true) history = history history () postcode = model WorldField (maximum_language = 100) state = model.Churchfield (max_long = 10) country = as model to 2 decs # [estimated goal] mobile = PhoneNumberField (empty = true, empty = True) Avatar = Models .carfield (max_length = 255, default = "", empty = true) invite_token = models.CharField (max_length = 128, default = "", empty = true) def __unicode __ (self): return self.user.get_full_name ()


No comments:

Post a Comment