Search Results

Search found 15137 results on 606 pages for 'global state'.

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

  • Accessing global variables in a flash[:notice]

    - by Trip
    This is deals_controller.rb. And it works like this, except two things. Not sure how to call Deal.count to add in my flash[:notice] . I get the hunch that its not calling something global. I need that contional statement back, as I'm pretty sure its responsible for actually adding the new @deal . So I assume my syntax is off. Do note, I added an extra 'end' when I uncomment this block. def create -# This will use the disclaimer_ids submitted from the check boxes in the view -# to add/delete deal.disclaimers entries to matched the list of checked boxes. @deal = Deal.new(params[:deal]) -# <------I Need this commented out IF statement back ------- -#if @deal.valid? && @organization.deals << @deal flash[:notice] = 'Your promotion is published! You may find it in the number 1 position of our #{deal.count} previously posted promotions. To see your promotion, click here."' respond_to do |format| format.html { redirect_to organization_deals_path(@organization) } format.js -# I Need this IF Statement Back! -#else -#@disclaimers = Disclaimer.all -#render :action = 'new' end end Thanks!

    Read the article

  • cookieless sessions with ajax

    - by thezver
    ok, i know you get sick from this subject. me too :( I've been developing a quite "big application" with PHP & kohana framework past 2 years, somewhat-successfully using my framework's authentication mechanism. but within this time, and as the app grown, many concerning state-preservation issues arisen. main problems are that cookie-driven sessions: can't be used for web-service access ( at least it's really not nice to do so.. ) in many cases problematic with mobile access don't allow multiple simultaneous apps on same browser ( can be resolved by hard trickery, but still.. ) requires many configurations and mess to work 100% right, and that's without the --browser issues ( disabled cookies, old browsers bugs & vulnerabilities etc ) many other session flaws stated in this old thread : http://lists.nyphp.org/pipermail/talk/2006-December/020358.html After a really long research, and without any good library/on-hand-solution to feet my needs, i came up with a custom solution to majority of those problems . Basically, i'ts about emulating sessions with ajax calls, with additional security/performance measures: state preserved by interchanging SID(+hash) with client on ajax calls. state data saved in memcache(or equivalent), indexed by SID security achieved by: appending unpredictible hash to SID egenerating hash on each request & validating it validating fingerprint of client on each request ( referrer,os,browser etc) (*)condition: ajax calls are not simultaneous, to prevent race-condition with session token. (hopefully Ext-Direct solves that for me) From the first glance that supposed to be not-less-secure than equivalent cookie-driven implementation, and at the same time it's simple, maintainable, and resolves all the cookies flaws.. But i'm really concerned because i often hear the rule "don't try to implement custom security solutions". I will really appreciate any serious feedback about my method, and any alternatives. also, any tip about how to preserve state on page-refresh without cookies would be great :) but thats small technical prob. Sorry if i overlooked some similar post.. there are billions of them about sessions . Big thanks in advance ( and for reading until here ! ).

    Read the article

  • Possible to Dynamic Form Generation Using PHP global variables

    - by J M 4
    I am currently a fairly new programmer but am trying to build a registration page for a medical insurance idea we have which captures individual information and subsequent pieces of information about that individual's sub parts. In this case, it is a fight promoter enrolling his 15+ boxers for fight testing services. Right now, I have the site fully laid out to accept 7 fighters worth of information. This is collected during the manager's enrollment. However, each fighter's information is passed and stored in session super globals such as: $_SESSION['F1Firstname']; and $_SESSION['F3SSN3'];. The issue I am running into is this, I want to create a drop down menu selector for the manager to add information for up to 20-30 fighters. Right now I use PHP to state: if ($_SESSION['Num_Fighters'] 6) ... then display the table form fields to collect consumer data. If I have to build hidden elements for 30 fighters AND provide javascript/php validation (yes I am doing both) then I fear the file size for the document will be unnecessarily large for the maanger who only wants to enroll 2 fighters. Can anybody help?

    Read the article

  • Can't override a global WPF style that is set by TargetType on a single specific control

    - by Matt H.
    I have a style applied to all my textboxes, defined in a resource dictionary.. <Style TargetType="TextBlock"> <Setter Property="TextBlock.FontSize" Value="{Binding Source={StaticResource ApplicationUserSettings}, Path=fontSize, Mode=OneWay}" /> <Setter Property="TextBlock.TextWrapping" Value="Wrap" /> <Setter Property="TextBlock.VerticalAlignment" Value="Center"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="TextBox.FontFamily" Value="{Binding Source={StaticResource ApplicationUserSettings}, Path=fontName, Mode=OneWay}"/> </Style>\ The fontsize and fontstyle properties are bound to a special user settings class that implements iNotifyPropertyChanged, which allows changes to font size and fontfamily to immediately propogate throughout my application. However, in a UserControl I've created (Ironically, the screen that allows the user to customize their font settings), I want the font size and fontfamily to remain static. No matter what I try, my global font settings override what I set in my user control: <UserControl x:Class="ctlUserSettings" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:R2D2" Height="400" Width="600"> <Grid> <Grid.Resources> <Style x:Key="tbxStyle" TargetType="TextBox"> <Style.Setters> <Setter Property="FontSize" Value="14"/> <Setter Property="FontFamily" Value="Tahoma"/> </Style.Setters> </Style> ... etc... <StackPanel Margin="139,122.943,41,0" Orientation="Horizontal" Height="33" VerticalAlignment="Top"> <TextBox Style="{x:Null}" FontSize="13" FontFamily="Tahoma" HorizontalAlignment="Left" MaxWidth="500" MinWidth="350" Name="txtReaderPath" Height="Auto" VerticalAlignment="Top" /> <TextBox Style="{x:tbxStyle}" Margin="15,0,0,0" HorizontalAlignment="Left" Name="txtPath" Width="43" Height="23" VerticalAlignment="Top">(some text)</Button> </StackPanel> I've tried setting Style to {x:Null}, setting custom font sizes inline, and setting a style in the resources of this control. None take precedence over the styles in my resource dictionary. As you can see, I show a sprinkling of all the things I've tried in the XAML sample above... What am I missing?

    Read the article

  • how to pass structure variables

    - by deep
    Am having a set of structure variable in one form, i want to use that structure variable as a global variables. i need to use those structure variable in through out my whole application, how to use structure as global variable??

    Read the article

  • How to do something firstly when the asp.net server start

    - by Edwin Tai
    Hi all I need an interface that can be run firstly when the application start. We can write some code in Application_Start of global.ascx. Is there any other method to finish it after some configurations in web.config,i don't wanna write any code in global.ascx You know,we can implement the Interface 'IHttpModule' to diy each request. But the interface is not fix to application start. which one is i wanna? Thanks

    Read the article

  • small scale web site - global javascript file style/format/pattern - improving maintainability

    - by yaya3
    I frequently create (and inherit) small to medium websites where I have the following sort of code in a single file (normally named global.js or application.js or projectname.js). If functions get big, I normally put them in a seperate file, and call them at the bottom of the file below in the $(document).ready() section. If I have a few functions that are unique to certain pages, I normally have another switch statement for the body class inside the $(document).ready() section. How could I restructure this code to make it more maintainable? Note: I am less interested in the functions innards, more so the structure, and how different types of functions should be dealt with. I've also posted the code here - http://pastie.org/999932 in case it makes it any easier var ProjectNameEnvironment = {}; function someFunctionUniqueToTheHomepageNotWorthMakingConfigurable () { $('.foo').hide(); $('.bar').click(function(){ $('.foo').show(); }); } function functionThatIsWorthMakingConfigurable(config) { var foo = config.foo || 700; var bar = 200; return foo * bar; } function globallyRequiredJqueryPluginTrigger (tooltip_string) { var tooltipTrigger = $(tooltip_string); tooltipTrigger.tooltip({ showURL: false ... }); } function minorUtilityOneLiner (selector) { $(selector).find('li:even').not('li ul li').addClass('even'); } var Lightbox = {}; Lightbox.setup = function(){ $('li#foo a').attr('href','#alpha'); $('li#bar a').attr('href','#beta'); } Lightbox.init = function (config){ if (typeof $.fn.fancybox =='function') { Lightbox.setup(); var fade_in_speed = config.fade_in_speed || 1000; var frame_height = config.frame_height || 1700; $(config.selector).fancybox({ frameHeight : frame_height, callbackOnShow: function() { var content_to_load = config.content_to_load; ... }, callbackOnClose : function(){ $('body').height($('body').height()); } }); } else { if (ProjectNameEnvironment.debug) { alert('the fancybox plugin has not been loaded'); } } } // ---------- order of execution ----------- $(document).ready(function () { urls = urlConfig(); (function globalFunctions() { $('.tooltip-trigger').each(function(){ globallyRequiredJqueryPluginTrigger(this); }); minorUtilityOneLiner('ul.foo') Lightbox.init({ selector : 'a#a-lightbox-trigger-js', ... }); Lightbox.init({ selector : 'a#another-lightbox-trigger-js', ... }); })(); if ( $('body').attr('id') == 'home-page' ) { (function homeFunctions() { someFunctionUniqueToTheHomepageNotWorthMakingConfigurable (); })(); } });

    Read the article

  • Static variables in C and C++

    - by Naveen
    Is there any difference between a variable declared as static outside any function between C and C++. I read that static means file scope and the variables will not be accessible outside the file. I also read that in C, global variables are static . So does that mean that global variables in C can not be accessed in another file?

    Read the article

  • c++ global operator not playing well with template class

    - by John
    ok, i found some similar posts on stackoverflow, but I couldn't find any that pertained to my exact situation and I was confused with some of the answers given. Ok, so here is my problem: I have a template matrix class as follows: template <typename T, size_t ROWS, size_t COLS> class Matrix { public: template<typename, size_t, size_t> friend class Matrix; Matrix( T init = T() ) : _matrix(ROWS, vector<T>(COLS, init)) { /*for( int i = 0; i < ROWS; i++ ) { _matrix[i] = new vector<T>( COLS, init ); }*/ } Matrix<T, ROWS, COLS> & operator+=( const T & value ) { for( vector<T>::size_type i = 0; i < this->_matrix.size(); i++ ) { for( vector<T>::size_type j = 0; j < this->_matrix[i].size(); j++ ) { this->_matrix[i][j] += value; } } return *this; } private: vector< vector<T> > _matrix; }; and I have the following global function template: template<typename T, size_t ROWS, size_t COLS> Matrix<T, ROWS, COLS> operator+( const Matrix<T, ROWS, COLS> & lhs, const Matrix<T, ROWS, COLS> & rhs ) { Matrix<T, ROWS, COLS> returnValue = lhs; return returnValue += lhs; } To me, this seems to be right. However, when I try to compile the code, I get the following error (thrown from the operator+ function): binary '+=' : no operator found which takes a right-hand operand of type 'const matrix::Matrix<T,ROWS,COLS>' (or there is no acceptable conversion) I can't figure out what to make of this. Any help if greatly appreciated!

    Read the article

  • Javascript problem with a global external link confirmation alert

    - by OverDrive
    Below is the code from a plugin for Joomla. It works on it's own and it's purpose is to detect external links on the page and force them into new browser windows using _blank. I've tried for about an hour (I don't know javascript well) but I can't seem to figure out how to get an onclick function working. End result, I want to add to this script the ability of a confirmation dialog, shown in the 2nd code section. An external link, when clicked, will pop up the confirmation dialog, and if it says yes, they will be able to get to the external URL, opening in a new window. Otherwise, it cancels, and does nothing. When I create a link with onclick="return ExitNotice(this.href);" within it it works perfectly, but since my website has multiple people submitting input, I'd like the confirmation box global. this.blankwin = function(){ var hostname = window.location.hostname; hostname = hostname.replace("www.","").toLowerCase(); var a = document.getElementsByTagName("a"); this.check = function(obj){ var href = obj.href.toLowerCase(); return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false; }; this.set = function(obj){ obj.target = "_blank"; obj.className = "blank"; }; for (var i=0;i<a.length;i++){ if(check(a[i])) set(a[i]); }; }; this.addEvent = function(obj,type,fn){ if(obj.attachEvent){ obj['e'+type+fn] = fn; obj[type+fn] = function(){obj['e'+type+fn](window.event );} obj.attachEvent('on'+type, obj[type+fn]); } else { obj.addEventListener(type,fn,false); }; }; addEvent(window,"load",blankwin); Second Part /* ---------- OnClick External Link Notice ---------- */ function ExitNotice(link,site,ltext) { if(confirm("-----------------------------------------------------------------------\n\n" + "You're leaving the HelpingTeens.org website. HelpingTeens.org\ndoes not " + "control this site and its privacy policies may differ\nfrom our own. " + "Thank you for using our site.\n\nYou will now access the following link:\n" + "\n" + link + "\n\nPress \'OK\' to proceed, or press \'Cancel\' to remain here." + "\n\n-----------------------------------------------------------------------")) { return true; } history.go(0); return false; } A) Can anyone help me fix this problem? or B) Is there a better solution?

    Read the article

  • Zend_Registry: real life examples

    - by takeshin
    Do you find Zend_Registry useful? For which tasks it should be used? For which not? Global state for variables is not a good practice. Main objects may have global state injected via $front->setParam('paramName', $object), so what's the purpose of Zend_Registry?.

    Read the article

  • Android ImageButton with a selected state?

    - by Joren
    If I was using an ImageButton with a selector for its background, is there a state I can change which will make it change its appearance? Right now I can get it to change images when pressed, but there seems to be no "highlighted" or "selected" or similar state which lets me toggle it's appearance at will. Here's my XML, it only changes appearance when pressed. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/map_toolbar_details_selected" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" /> <item android:drawable="@drawable/map_toolbar_details" />

    Read the article

  • Elasticsearch Shard stuck in INITIALIZING state

    - by Peeyush
    I stopped one of my elastic search node & as a normal behavior elastic search started relocating my shard on that node to another node. But even after 15 hours it is still stuck in INITIALIZING state. Also that shard is fluctuating between two nodes,for some time it stays on one node then automatically shift to another node & keep on doing that after every few hours. Main issue is it is still in INITIALIZING state after so many hours. I am using version 1.2.1. This shard which is stuck, it is a replica. I am getting this error in logs: [ERROR][index.engine.internal ] [mynode] [myindex][3] failed to acquire searcher, source delete_by_query java.lang.NullPointerException [WARN ][index.engine.internal ] [mynode] [myindex][3] failed engine [deleteByQuery/shard failed on replica] [WARN ][cluster.action.shard ] [mynode] [myindex][3] sending failed shard for [myindex][3], node[Sp3URfNVQlq2i4i3EjCakw], [R], s[INITIALIZING], indexUUID [kTikCHshQMKEQ_jAuWWWnw], reason [engine failure, message [deleteByQuery/shard failed on replica][EngineException[[myindex][3] failed to acquire searcher, source delete_by_query]; nested: NullPointerException; ]]

    Read the article

  • ASP.NET Session State Error only on default document

    - by schmidty
    I have a site where when accessing via site.com/default.aspx everything is fine, however when accessing via site.com/ I get a session error as follows: "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration." I have confirmed that default.aspx is the highest priority default document and that it is the page being loaded. However why is this session error only occurring when accessing via the default document? The server is 2008 R2 and IIS 7.5.

    Read the article

  • Global Entity Framework Context in WPF Application

    - by OffApps Cory
    Good day, I am in the middle of development of a WPF application that is using Entity Framework (.NET 3.5). It accesses the entities in several places throughout. I am worried about consistency throughout the application in regard to the entities. Should I be instancing separate contexts in my different views, or should I (and is a a good way to do this) instance a single context that can be accessed globally? For instance, my entity model has three sections, Shipments (with child packages and further child contents), Companies/Contacts (with child addresses and telephones), and disk specs. The Shipments and EditShipment views access the DiskSpecs, and the OptionsView manages the DiskSpecs (Create, Edit, Delete). If I edit a DiskSpec, I have to have something in the ShipmentsView to retrieve the latest specs if I have separate contexts right? If it is safe to have one overall context from which the rest of the app retrieves it's objects, then I imagine that is the way to go. If so, where would that instance be put? I am using VB.NET, but I can translate from C# pretty good. Any help would be appreciated. I just don't want one of those applications where the user has to hit reload a dozen times in different parts of the app to get the new data. Update: OK so I have changed my app as follows: All contexts are created in Using Blocks to dispose of them after they are no longer needed. When loaded, all entities are detatched from context before it is disposed. A new property in the MainViewModel (ContextUpdated) raises an event that all of the other ViewModels subscribe to which runs that ViewModels RefreshEntities method. After implementing this, I started getting errors saying that an entity can only be referenced by one ChangeTracker at a time. Since I could not figure out which context was still referencing the entity (shouldn't be any context right?) I cast the object as IEntityWithChangeTracker, and set SetChangeTracker to nothing (Null). This has let to the current problem: When I Null the changeTracker on the Entity, and then attach it to a context, it loses it's changed state and does not get updated to the database. However if I do not null the change tracker, I can't attach. I have my own change tracking code, so that is not a problem. My new question is, how are you supposed to do this. A good example Entity query and entity save code snipped would go a long way, cause I am beating my head in trying to get what I once thought was a simple transaction to work. Any help would elevate you to near god-hood.

    Read the article

  • Load Country/State/City

    - by Abu Hamzah
    I have chain of drop down like Country / state and City. Is there is any way to wait until the drop down population then proceed further? like first load the country and then based on the select of an country then load the state and same as city.... function populateLists(listType) { // on success do this:<br> $.ajax({ type:"POST", url:"Wizard_Using_PageMethod.aspx/GetCountry", data: "{}", contentType: "application/json; charset=utf-8", dataType:"json" } }); [WebMethod] public static CountryList GetCountry() { CountryList country = new CountryList(); ///go to db and get the data return country; }

    Read the article

  • JS: using 'var me = this' to reference an object instead of using a global array

    - by Marco Demaio
    The example below, is just an example, I know that I don't need an object to show an alert box when user clicks on div blocks, but it's just a simple example to explain a situation that frequently happens when writing JS code. In the example below I use a globally visible array of objects to keep a reference to each new created HelloObject, in this way events called when clicking on a div block can use the reference in the arry to call the HelloObject's public function hello(). 1st have a look at the code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Test </title> <script type="text/javascript"> /***************************************************** Just a cross browser append event function, don't need to understand this one to answer my question *****************************************************/ function AppendEvent(html_element, event_name, event_function) {if(html_element) {if(html_element.attachEvent) html_element.attachEvent("on" + event_name, event_function); else if(html_element.addEventListener) html_element.addEventListener(event_name, event_function, false); }} /****************************************************** Just a test object ******************************************************/ var helloobjs = []; var HelloObject = function HelloObject(div_container) { //Adding this object in helloobjs array var id = helloobjs.length; helloobjs[id] = this; //Appending click event to show the hello window AppendEvent(div_container, 'click', function() { helloobjs[id].hello(); //THIS WORKS! }); /***************************************************/ this.hello = function() { alert('hello'); } } </script> </head><body> <div id="one">click me</div> <div id="two">click me</div> <script type="text/javascript"> var t = new HelloObject(document.getElementById('one')); var t = new HelloObject(document.getElementById('two')); </script> </body></html> In order to achive the same result I could simply replace the code //Appending click event to show the hello window AppendEvent(div_container, 'click', function() { helloobjs[id].hello(); //THIS WORKS! }); with this code: //Appending click event to show the hello window var me = this; AppendEvent(div_container, 'click', function() { me.hello(); //THIS WORKS TOO AND THE GLOBAL helloobjs ARRAY BECOMES SUPEFLOUS! }); thus would make the helloobjs array superflous. My question is: does this 2nd option in your opinion create memoy leaks on IE or strange cicular references that might lead to browsers going slow or to break??? I don't know how to explain, but coming from a background as a C/C++ coder, doing in this 2nd way sounds like a some sort of circular reference that might break memory at some point. I also read on internet about the IE closures memory leak issue http://jibbering.com/faq/faq_notes/closures.html (I don't know if it was fixed in IE7 and if yes, I hope it does not come out again in IE8). Thanks

    Read the article

  • saving iPhone program state with a deep UINavigationController

    - by jr
    Can someone a good way to save the program state (UINavigationController stack, etc) of an iPhone application. My application obtains a bunch of information from the network and I want to return the person back to the last screen they were on, even if it was 3 or 4 screens deep. I assume that I will need to reload the data from the network along the way as I recreate the UINavigation controllers. I don't necessarily have a problem with this. I'm thinking about maybe having my UINavigationController objects implement some type of protocol which allow me to save/set their state? I'm looking to hear from others who may have needed to implement a similar scenario and how they accomplished it. My application has a UITabbarController at the root and UINavigationController items for each tab bar item. thanks!

    Read the article

  • Bug when adding a sprite to 1 <s:State>

    - by lostincode
    I'm working within a skin for a button that has some <s:State> normal over In the tag, I'm drawing a circle private var theshape:Sprite; private function drawShape():void { theshape = new Sprite(); theshape.graphics.beginFill(0x666666); theshape.graphics.drawCircle(3,5,10); theshape.graphics.endFill(); //i then add it to a Spite Visual Element that's defined in mxml canv.addChild(theshape); } This works fine, until I try to control under which states that canv SpriteVisualElement appears. If I just add an includeIn like this <s:SpriteVisualElement id="canv" includeIn="over" /> I get a run-time error TypeError: Error #1009: Cannot access a property or method of a null object reference. Any ideas what the problem is, or a different way I can accomplish the same thing. What I need is to simply include the circle in the button when it's in the hover state.

    Read the article

  • iphone - how to mentain the state of UIWebView ?

    - by g.revolution
    Hi, i am having a UIWebView showing and HTML page that has some checkboxes, radio buttons. My Application has tabbar controller that switches b/w two controllers. How i can maintain the current state of UIWebView. ( e.g. i have selected a checkbox and i change the tab and go to other ViewController and again come back to UIWebView. the WebView resets itself and goes to the start... i want to maintain the state of UIWebView ( all the checkboxes clicked) .. how i will do that ?? any idea ?? thanks in advance

    Read the article

  • Sessionstate not being saved between pages

    - by Grant
    Hi, i am having problems with an asp.net c# site whereby i am setting a session state object to true and then redirecting to another page that needs to check the value of the session state object and it is null. Sometimes it is set correctly and other times is is simply null. When i debug on my local machine it works perfectly every time. Only when i upload to my web server does this temperamental behaviour happen. As it is based around the security of the site it is obviously important that the session data be valid and accurate every time. Is session state data unreliable? AFAIK its set to inproc, cookieless, 30 min timeout, vanilla installation of IIS. Does anyone have any suggestions? Perhaps i need to thread.sleep inbetween the storing of the session data and the reading? NB: the time between the write and the read is about 70ms.. ample time for the data to be written to RAM.....

    Read the article

  • [Django] Change state of obiects

    - by gameboy
    hi I have following problem. I have model: class Towar(models.Model): nrSeryjny=models.CharField(max_length=100) opis=models.CharField(max_length=255) naStanie=models.NullBooleanField(null=True) def __unicode__(self): return "%s" % self.opis def lowerName(self): return self.__class__.__name__.lower() def checkState(self): return self.naStanie def changeState(self,state): self.naStanie=state class Meta: ordering=['nrSeryjny'] app_label = 'baza' permissions=(("view_towar","mozna miec podglad dla towar"),) and model : class Wypozyczenie(models.Model): dataPobrania=models.DateField() pracownik=models.ForeignKey(User,null=True) kontrahent=models.ForeignKey(Kontrahenci,null=True) towar=models.ForeignKey(Towar,null=True) objects=WypozyczenieManager() default_objects=models.Manager() ZwrotyObjects=WypozyczenieZwrotyManager() def lowerName(self): return self.__class__.__name__.lower() def __unicode__(self): if self.towar == None: return "Dla:%s -- Kto:%s -- Kiedy:%s -- Co:%s" % (self.kontrahent,self.pracownik,self.dataPobrania,"Brak") else: return "Dla:%s -- Kto:%s -- Kiedy:%s -- Co:%s" % (self.kontrahent,self.pracownik,self.dataPobrania,self.towar) class Meta: ordering=['dataPobrania'] app_label = 'baza' permissions=(("view_wypozyczenie","mozna miec podglad dla wypozyczenie"),) and view to adding models: def modelAdd(request,model,modelForm): mod=model() if request.user.has_perm('baza.add_%s' % mod.lowerName()): if request.method=='POST': form=modelForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/'+ mod.lowerName() + '/') else: form=modelForm() v=RequestContext(request,{'form':form}) return render_to_response('add_form.html',v) and i whant do that, when i add Wypozyczenie and save it then the Towar that is stored by Wypozyczenie change his na stanie from True to False Greets

    Read the article

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