Search Results

Search found 13838 results on 554 pages for 'disconnected model'.

Page 41/554 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Filtering manager for django model, customized by user

    - by valya
    Hi there! I have a model, smth like this: class Action(models.Model): def can_be_applied(self, user): #whatever return True and I want to override its default Manager. But I don't know how to pass the current user variable to the manager, so I have to do smth like this: [act for act in Action.objects.all() if act.can_be_applied(current_user)] How do I get rid of it by just overriding the manager? Thanks.

    Read the article

  • How can I assign more than one ValueProvider to ModelBindingContext when testing a custom model bind

    - by Byron Sommardahl
    I have a custom model binder that uses data from session, tempdata, and form collection (hypothetically, of course!). When testing my model binder, need to create a ModelBindingContext with a ValueProvider. Trouble is, I can't see how I can have one ValueProvider that serves multiple value provider types. Any words of wisdom? ValidModelBindingContext = new ModelBindingContext { ModelName = "SomeModel", ValueProvider = ValidFormValueCollection };

    Read the article

  • CakePHP - How to use onError in Model

    - by Richard
    I've created a custom datasource which fetches data from a web api, and I'm now looking at implementing error handling. In the datasource, I'm calling $model-onError(). In the model, I've created the onError method, and I can access error details with $this-getDataSource()-error; However I can't redirect or set a flash message because that can only take place in the controller, so what should I be doing here to communicate the error to the user?

    Read the article

  • Get all model details in zend.

    - by Prasanth P
    Hi, I have one doubt in zend framework. I need all model details from project which i have done in zend framework. Is there any possibility to get all model details in zend framework. Please help me.. Thanks and regards, Prasanth P

    Read the article

  • Django model: Reference foreign key table in __unicode__ function for admin

    - by pa
    Example models: class Parent(models.Model): name = models.CharField() def __unicode__(self): return self.name class Child(models.Model): parent = models.ForeignKey(Parent) def __unicode__(self): return self.parent.name # Would reference name above I'm wanting the Child.unicode to refer to Parent.name, mostly for the admin section so I don't end up with "Child object" or similar, I'd prefer to display it more like "Child of ". Is this possible? Most of what I've tried hasn't worked unfortunately.

    Read the article

  • Default value for hidden field in Django model

    - by Daniel Garcia
    I have this Model: class Occurrence(models.Model): id = models.AutoField(primary_key=True, null=True) reference = models.IntegerField(null=True, editable=False) def save(self): self.collection = self.id super(Occurrence, self).save() I want for the reference field to be hidden and at the same time have the same value as id. This code works if the editable=True but if i want to hide it it doesnt change the value of reference. how can i fix that?

    Read the article

  • Creating a Model using Stored Procedures with Zend Framework

    - by jwhat
    I'm using Zend Framework and I'd like to build a model to perform read/write operations on a database... using stored procedures. I know how stored procedures work, but I have yet to use them within Zend Framework. Is there any built in support for stored procedures that I should know about? What is the best practice way to create a model in this senario? Should I extend Zend_Db_Table_Abstract or some other class?

    Read the article

  • ForeignKey django 1.1.1 model

    - by Spikie
    i have class staff_name(models.Model): firstname = models.CharField(max_length=150) surname = models.CharField(max_length=150) class inventory_transaction(models.Model): staffs = models.ForeignKey(staff_name) i want to get or create staff surname and first name through inventory_transaction i used these code below inventory_transaction.objects.get_or_create(staffs_surname_contains=sname,staffs_firstname_contains=fname) i got this error "staffs_surname_contains can not be defined" what have i done wrong ? thanks

    Read the article

  • Rails Subdomain Model-Based

    - by ShenoudaB
    Dears, In My Rails Project i'm using subdomain_fu for subdomain support. but i was looking for the Model-Based Subdomain support in subdomain_fu as in my application 2 models have subdomain fields. and i would like to route the application according to the subdomain specified as check the subdomain is related to which model and start routing with representing them to the rails routes. Regards, Shenouda Bertel

    Read the article

  • DropDownList View Model

    - by Jemes
    I'm trying to produce a dropdownlist for GetAllRoles using the role provider. I can produce the drop down in a controller using ViewData but I would like to use a View Model to produce the dropdown, but I'm unsure of the best way to create the list using a View Model? public ActionResult GetAllRoles() { ViewData["Roles"] = new SelectList(Roles.GetAllRoles()); return View(); }

    Read the article

  • Model relationship types in cakePhP

    - by kwokwai
    I have checked out the cookbook web site of cakephp that there are four types Model relationship: http://book.cakephp.org/view/79/Relationship-Types Since the one I am more familiar with is belongsTo, I am not sure when I need to use hasManay and HABTM. What will be the result to my web site if I used a wrong Model relationship type? Please advise.

    Read the article

  • Rails - 1 entry in model per field, per day

    - by Elliot
    Lets say I have a food model in the model, every day, people enter how many lbs of pizza/vegetables/fruit they eat. each food is its own column my issue is, I'd like it so they can only enter that in once (for that food type) every 24 hours (based on created_at). This possible?

    Read the article

  • Flex-Mate, How To Back PopUp (Dialog) With A Model

    - by davidemm
    I'm using MATE on an Adobe Flex project for MVC. On one of our pages, we have a dialog window that is presented to the user that displays them information that comes from RPC. The pages where this dialog pops up is unrelated to the data being displayed so this is a separate model. How do I create a MATE mapping file that will create the dialog window, make it visible to the user, and then inject in data from a model? Thanks for reading.

    Read the article

  • Cover flow model screen adjust in iphone

    - by abdulsamad
    Hi All, Below is the link for making the cover flow model in iphone. This is a sample tutorial. http://www.chaosinmotion.com/flowcover.m Can any one tell me how can i make the cover flow model to adjust some where up on the screen. Currently it is in the centre of the screen i want if about 70 to 80pixels to move up in the screen. Your help will be highly appreciated.

    Read the article

  • USB cable model for Kodak EasyShare Z740

    - by Robert Munteanu
    I've lost the original USB cable for my Kodak EasyShare Z740, and I can't figure out which model I should replace it with. I did not find the original parts, as the camera is pretty old. I did find the cable on the Kodak site, but I I've tried both mini-USB and micro-USB and neither fit. Alternatively, bonus points for pointing out a dealer in Bucharest, Romania which has the original part. N.B. I do use a card reader now, but I find it more convenient to use the cable.

    Read the article

  • Would a model like this translate well to a document or graph database?

    - by Eric
    I'm trying to understand what types of models that I have traditionally persisted relationally would translate well to some kind of NoSQL database. Suppose I have a model with the following relationships: Product 1-----0..N Order Customer 1-----0..N Order And suppose I need to frequently query things like All Orders, All Products, All Customers, All Orders for Given Customer, All Orders for Given Product. My feeling is that this kind of model would not denormalize cleanly - If I had Product and Customer documents with embedded Orders, both documents would have duplicate orders. So I think I'd need separate documents for all three entities. Does a characteristic like this typically indicate that a document database is not well suited for a given model? Generally speaking, would a document database perform as well as a relational database in this kind of situation? I know very little about graph databases, but I understand that a graph database handles relationships more performantly than a document database - would a graph database be suited for this kind of model?

    Read the article

  • Drawing of a huge model - How to regain performance?

    - by marc wellman
    I have a huge model I want to draw in my XNA application but because of its size I am experiencing a tremendous loss of performance. The model has about ~50 000 000 edges and has a size on disk of 205 MB in DirectX Format. Please don't ask whether this model has to be that big - yes it has! Is there a way to transfer the model directly to my GPU in order to let the GPU do the drawing like when transferring a VertexBuffer like this: graphicsDevice.Vertices[1].SetSource(_instanceBuffers[i], 0, _sizeofMatrix); because when I try to fill a vertexBuffer with all the vertices I am getting a OutOfMemoryException.

    Read the article

  • Calling data from different model in Rails

    - by Danny McClelland
    Hi Everyone, I need to be able to call data from a different model - not just one field, but any of them. At the moment I have the following models: kase person company party I can call information from the company to the kase and from the person to the kase using this: <li>Client Company Address: <span class="address"><%=h @kase.company.companyaddress %></span></li> <li>Case Handler: <span><%=h @kase.person.personname %></span></li> Those two work, however if I add the following: <li>Client Company Fax: <span><%=h @kase.company.companyfax %></span></li> <li>Case Handler Tel: <span><%=h @kase.person.personmobile %></span></li> <li>Case Handler Email: <span><%=h @kase.person.personemail %></span></li> Any idea whats wrong? Thanks, Danny EDIT: I get the following error message: NoMethodError in Kases#show Showing app/views/kases/show.html.erb where line #37 raised: You have a nil object when you didn't expect it! The error occurred while evaluating nil.personname The lines that are noted are as follows: 34: <div id="clientinfo_showhide" style="display:none"> 35: <li>Client Company Address: <span class="address"><%=h @kase.company.companyaddress %></span></li> 36: <li>Client Company Fax: <span><%=h @kase.company.companyfax %></span></li> 37: <li>Case Handler: <span><%=h @kase.person.personname %></span></li> 38: <li>Case Handler Tel: <span><%=h @kase.person.personmobile %></span></li> 39: <li>Case Handler Email: <span><%=h @kase.person.personemail %></span></li> 40: </div> The model for the kase is as follows: class Kase belongs_to :company # foreign key: company_id belongs_to :person # foreign key in join table The model for the person is as follows: class Person has_many :kases # foreign key in join table belongs_to :company The model for the company is as follows: class Company has_many :kases has_many :people def to_s; companyname; end Hope this helps!

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >