Skip to content

Instantly share code, notes, and snippets.

@fitoria
fitoria / gist:29693
Created November 27, 2008 05:41 — forked from anonymous/gist:29690
----------------MODELO---------------------
class Paciente < ActiveRecord::Base
belongs_to :usuario
has_many :resultados
end
----------------CONTROLADOR --------------------
class PacienteController < ApplicationController
class AdminController < ApplicationController
layout 'admin'
def index
end
#----------------PACIENTES -----------------------
def crear_paciente
if request.post? # aca es para que no haga lo mismo con el get sino solo con el POST
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
#map.root :controller => "admin" proba asi para mientras :P
map.resources :admin, :collection => {:auto_complete_for_paciente_nombre => :get,:auto_complete_for_examen_nombre => :get }
<% for resultado in @resultado %>
<b>Fecha </b><%= resultado.fecha %><br>
<b>Examen </b><%= resultado.examen.nombre %><br>
<%end%>
def save_offer
if request.post?
@offer = Offer.new(params[:offer])
@offer.post = Post.find_by_id(session[:post_id])
@offer.save
redirect_to :controller => 'post', :action => 'show' , :id => params[:id]
end
end
def add_offer #accion para agregar oferta
<div>
<%= error_messages_for 'offer' %>
<fieldset>
<legend>Haga su oferta</legend>
<% form_for :offer, :url => {:action => :save_offer} do |form| %>
<p>
<%= label :offer, :name, "Name:" %>
<%= form.text_field :name, :size => 40%>
<p>
<b>Name:</b>
<%=h @post.name %>
</p>
<p>
<b>Email:</b>
<%=h @post.email %>
</p>
81c81
< if (this.logueado == true)
---
> /*if (this.logueado == true)
83c83
< query = "update usuarios set password = '@password', " +
---
> query = "update usuarios set password = '@password', " +
88c88
< {
Mi admin.py
--------------------------
from django.contrib import admin
from sitioprueba.books.models import Publisher, Author, Book, Tienda
import settings
media = settings.MEDIA_URL
class ArticleAdmin(admin.ModelAdmin):
# TinyMCE
js = ('../files/js/tiny_mce/tiny_mce.js','../files/js/editores/textareas.js',)
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7