Search Results

Search found 66 results on 3 pages for 'tam toucan'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Django ModelForm is giving me a validation error that doesn't make sense

    - by River Tam
    I've got a ModelForm based on a Picture. class Picture(models.Model): name = models.CharField(max_length=100) pub_date = models.DateTimeField('date published') tags = models.ManyToManyField('Tag', blank=True) content = models.ImageField(upload_to='instaton') def __unicode__(self): return self.name class PictureForm(forms.ModelForm): class Meta: model = Picture exclude = ('pub_date','tags') That's the model and the ModelForm, of course. def submit(request): if request.method == 'POST': # if the form has been submitted form = PictureForm(request.POST) if form.is_valid(): return HttpResponseRedirect('/django/instaton') else: form = PictureForm() # blank form return render_to_response('instaton/submit.html', {'form': form}, context_instance=RequestContext(request)) That's the view (which is being correctly linked to by urls.py) Right now, I do nothing when the form submits. I just check to make sure it's valid. If it is, I forward to the main page of the app. <form action="/django/instaton/submit/" method="post"> {% csrf_token %} {{ form.as_p }} <input type="submit" value"Submit" /> </form> And there's my template (in the correct location). When I try to actually fill out the form and just validate it, even if I do so correctly, it sends me back to the form and says "This field is required" between Name and Content. I assume it's referring to Content, but I'm not sure. What's my problem? Is there a better way to do this?

    Read the article

  • Creating a QuerySet based on a ManyToManyField in Django

    - by River Tam
    So I've got two classes; Picture and Tag that are as follows: class Tag(models.Model): pics = models.ManyToManyField('Picture', blank=True) name = models.CharField(max_length=30) # stuff omitted class Picture(models.Model): name = models.CharField(max_length=100) pub_date = models.DateTimeField('date published') tags = models.ManyToManyField('Tag', blank=True) content = models.ImageField(upload_to='instaton') #stuff omitted And what I'd like to do is get a queryset (for a ListView) given a tag name that contains the most recent X number of Pictures that are tagged as such. I've looked up very similar problems, but none of the responses make any sense to me at all. How would I go about creating this queryset?

    Read the article

  • How to copy x and y coordinate from one Flex component to another

    - by Tam
    Hi, I would like to base one component's x and y cooridnates according to another, I tried using the binding notation but it doesn't seem to work! <?xml version="1.0" encoding="utf-8"?> <s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:vld ="com.lal.validators.*" xmlns:effect="com.lal.effects.*" xmlns:components="com.lal.components.*" width="400" height="100%" right="0" horizontalAlign="right" verticalCenter="0"> ...... <s:VGroup width="125" height="100%" horizontalAlign="right" gap="0" width.normal="153" x.normal="247" width.expanded="199" x.expanded="201"> ...... <s:Panel includeIn="expanded" id="buttonsGroup" mouseOut="changeStateToNormal();" mouseOver="stopChangeToNormal();" skinClass="com.lal.skins.TitlelessPanel" title="hi" right="0" width="125" height="700" > ..... <s:Label text="Jump To Date" paddingTop="20" /> <s:TextInput id="wholeDate" width="100" mouseOver="stopChangeToNormal();" click="date1.visible = true" focusOut="date1.visible = false"/> ... </s:Panel> </s:VGroup> <mx:DateChooser id="date1" change="useDate(event); this.visible = false; " visible="false" mouseOver="stopChangeToNormal();" y="{wholeDate.y}" x="{wholeDate.x}" /> </s:VGroup>

    Read the article

  • How to make mysql accept connections externally

    - by Tam
    I have a VPS and I want to make mysql DB accept connection externally (from my PC for instance). I have Debian Linux installed on the server. I checked some tutorials online and they said to comment out: bind-address = 127.0.0.1 But this didn't seem to help! is there anything specific for VPSs? or Am I missing something else? The command that runs mysql is: /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock

    Read the article

  • Can I send a file to Flex using RubyAMF?

    - by Tam
    I'm generating a PNG file in Flex from graphics drawn by user. I would like to send the file to Ruby on Rails backend and I'm using RubyAMF in other parts of the application. I found ways to upload the file using FileReference which uses HTTP but I prefer to send using RubyAMF ,if possible, as it's more efficient. If this is possible what is your suggested method?

    Read the article

  • Emulate clicking a link with Javascript that works with IE

    - by Tam
    I want to have java script clicking a link on the page..I found something on the net that suggests adding a function like this: function fireEvent(obj,evt){ var fireOnThis = obj; if( document.createEvent ) { var evObj = document.createEvent('MouseEvents'); evObj.initEvent( evt, true, false ); fireOnThis.dispatchEvent(evObj); } else if( document.createEventObject ) { fireOnThis.fireEvent('on'+evt); } } Then call it using: fireEvent(document.getElementById('edit_client_link'),'click'); This seems to work fine for FF but with IE it doesn't work! Any ideas?

    Read the article

  • Flash Builder 4 is suggesting mx1 instead of mx! why?

    - by Tam
    I just bought and installed the Flash Builder 4 after having the Beta for a while. The same code is giving me compile-time errors and suggests using mx1 instead of mx! If I make it mx1 the compile error goes away. Here is the top of my component. <s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" I mentioned nothing about mx1.

    Read the article

  • Setting default_scope according to some criteria

    - by Tam
    I'm trying to set default scope according to some criteria determined by ana ActionController before_filter. In controller: before_filter :authorize ... def authorize if some_condition @default_scope_conditions = something elsif another_condition @default_scope_conditions = something_else end end Inside the ActiveRecord default_scope :conditions => @default_scope_conditions But it doesn't seem to work, the before filter gets called but the default_scope doesn't get set. Could you please advise me what I'm doing wrong and how to fix it or suggest me some other way of achieving that.

    Read the article

  • How to implement a mailing system with Rails that sends emails in the background

    - by Tam
    I want to implement a reliable mailing system with Ruby on Rails that sends emails in the background as sending email sometimes takes like 10 seconds or more so I don't want the user to wait. Some ideas I thought of: 1- Write to a table in DB a have a background process that go over and send email (concern: potential many reads/writes to DB slows down my application) 2- Messaging Queue background process / Rake task (concern: if server crashes queued mails will be lost also might eat up a lot of memory if many emails) I was wondering if you a know of a good solution that provides a balance between reliability and performance.

    Read the article

  • Weird exception with delayed_job

    - by Tam
    Trying to queue a job with delayed_job as follows: Delayed::Job.enqueue(BackgroundProcess.new(current_user, object)) current_user and object are not nil when I print them out. The weird thing is that sometimes refreshing the page or running the command again works! Here is the exception trace: Delayed::Backend::ActiveRecord::Job Columns (44.8ms) SHOW FIELDS FROM `delayed_jobs` TypeError (wrong argument type nil (expected Data)): /Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml.rb:391:in `emit' /Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml.rb:391:in `quick_emit' /Users/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/yaml/rubytypes.rb:86:in `to_yaml' vendor/plugins/delayed_job/lib/delayed/backend/base.rb:65:in `payload_object=' activerecord (2.3.9) lib/active_record/base.rb:2918:in `block in assign_attributes' activerecord (2.3.9) lib/active_record/base.rb:2914:in `each' activerecord (2.3.9) lib/active_record/base.rb:2914:in `assign_attributes' activerecord (2.3.9) lib/active_record/base.rb:2787:in `attributes=' activerecord (2.3.9) lib/active_record/base.rb:2477:in `initialize' activerecord (2.3.9) lib/active_record/base.rb:725:in `new' activerecord (2.3.9) lib/active_record/base.rb:725:in `create' vendor/plugins/delayed_job/lib/delayed/backend/base.rb:21:in `enqueue'

    Read the article

  • Does introducing foreign keys to MySQL reduce performance

    - by Tam
    I'm building Ruby on Rails 2.3.5 app. By default, Ruby on Rails doesn't provide foreign key contraints so I have to do it manually. I was wondering if introducing foreign keys reduces query performance on the database side enough to make it not worth doing. Performance in this case is my first priority as I can check for data consistency with code. What is your recommendation in general? do you recommend using foreign keys? and how do you suggest I should measure this?

    Read the article

  • Can I dynamically embed fonts in Flex?

    - by Tam
    I'm wondering if I can dynamically embed fonts in Flex. I want to embed different fonts for different users so I don't want to embed all possible fonts in the same Flex file. If it's possible could you please post sample code.

    Read the article

  • Query to add a column depending of outcome of there columns

    - by Tam
    I have a user table 'users' that has fields like: id first_name last_name ... and have another table that determines relationships: user_id friend_id user_accepted friend_accepted .... I would like to generate a query that selects all the users but also add another field/column say 'network_status' that depends on the values of user_accepted and fiend_accepted. For example, if user_accepted is true friend_accepted is false I want the 'network_status' field to say 'request sent'. Can I possibly do this in one query? (I would prefer not to user if/else inside the query but if that's the only way so be it)

    Read the article

  • How can I move deleting photos to the background with delayed_job and paperclip

    - by Tam
    I let my users create photo albums with many photos. Relationship as follows: has_many :album_photos, :dependent => :destroy i upload photos to S3 When the user delete album I want to delete all photos as the relationship shows but it takes time if the user has many photos. Can I automatically set photo deletion to happen in the background (delayed_job) without having to manually call 'send_later' on every photo?

    Read the article

  • How to prevent components from rendering in Flex

    - by Tam
    Is there a way to prevent a component from rendering in Flex (to save memory or processing power)? I tried doing something like: <components:AddNewItemGroup id="addItemGroup" visible="false" enabled="false" horizontalCenter="0" bottom="0" /> I noticed that the component gets rendered but it's just not visible or functional.

    Read the article

  • is it possible to combine will_paginate with find_by_sql?

    - by Tam
    In my rails application I want to use will_paginate plugin to paginate on my query. Is that possible? I tried doing something like this but it didn't work: @users = User.find_by_sql(" SELECT u.id, u.first_name, u.last_name, CASE WHEN r.user_accepted =1 AND (r.friend_accepted =0 || r.friend_accepted IS NULL) .........").paginate( :page => @page, :per_page => @per_page, :conditions => conditions_hash, :order => 'first_name ASC') If not, can you recommend a way around this or a way that might work as I don't want to write my own pagination.

    Read the article

  • DateChooser is behaving strangely

    - by Tam
    I'm writing a Flex application and I came across what I think is a weird problem. I want to create a text box and a DateChooser as the datefield didn't do what I wanted and it's Halo so I can't skin it easily. I want the DateChooser to show when I click on the text input. Here is an except from my code: <s:TextInput id="wholeDate" width="100" mouseOver="stopChangeToNormal();" paddingRight="10" click="date1.visible = true" focusOut="date1.visible = false"/> <s:Button label="Go" width="70" /> </s:Panel> <mx:DateChooser id="date1" visible = "false" change="useDate(event);" mouseOver="changeToNormalState = false;" y="{wholeDate.y + buttonsGroup.y + 20}" x="{wholeDate.x + buttonsGroup.x - 175 }" /> The weird thing is that it works as I wanted if I make it visible = "true" to start but if I have it visible="false" it doesn't work! It shows but the date I select doesn't show in the box as it does if I have it as visible="true", but I don't want it to be visible initially. Any ideas?

    Read the article

  • How to pass a property to an event with a Button

    - by Tam
    I'm generating buttons dynamically that I want it to call a method like this: private function fetchTheDay(day:String):void { ... } But I wasn't sure how to make the button pass the string to it button.addEventListener(MouseEvent.CLICK,fetchTheDay); buttonVGroup.addElement(button); trying to do something like this didn't work: button.addEventListener(MouseEvent.CLICK,fetchTheDay(myString)); How should I do this?

    Read the article

  • How to know the order of component rendering in Flex

    - by Tam
    I have a component that has a sub-component they both use a shared variable from the model. The shared variable needs to be set by the parent component before it can be used by the child component. I did like this in the parent component: <mx:Canvas xmlns:mx="library://ns.adobe.com/flex/mx" ... creationComplete="group1_completeHandler(event)" > .... protected function group1_activateHandler(event:Event):void { model.myVariable = something; } .... <components:myCustomComponent> ... <components:myCustomComponent> ... </mx:Canvas> But for some reason when the code inside myCustomComponent tries to use myVariable for the first time I get a "null" object error. This means I guess that the child component gets rendered before the group1_activateHandler gets called and consequently myVariable gets set. What should I do to ensure that the parent container initializes the variable before the child component gets created?

    Read the article

< Previous Page | 1 2 3  | Next Page >