'FormSet' object has no attribute 'save'

2013-06-23 Thread Mário Idival
Hi guys,

I need of little help with formsets. I want save 3 instances of an form in 
databases.
E.G : 
name
lastname
-
name
lastname
-
name
lastname
-
I try use formset but I'm not getting save, expected this error for me :' 
ClassNameForSet' object has no attribute 'save'
Somebody know how i can pass for this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How i can get real value of ForeingKey?

2013-06-26 Thread Mário Idival
Good morning,
Guys, how can I get the real value of a ForeignKey?
Examples:
class A (models.Model):
 field1 = models.CharField (max_length = 10)

class B (models.Model):
  field_b1 = models.CharField (max_length = 10)
  a_field = models.ForeingKey (A)

right, now imagine that on the bench, table A has saved:
field1 = "world"
and B is saved in the table:
field_b1 = "hello"
a_field = 1

Well, how can I get the real value of a_field (which is world)? But there's
a catch, I wanna do this for the entire table B, if there is more fields
saved in the bank.


Sincerely,

-- 
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How i can get real value of ForeignKey?

2013-06-26 Thread Mário Idival
Good morning,
Guys, how can I get the real value of a ForeignKey?
Examples:
class A (models.Model):
 field1 = models.CharField (max_length = 10)

class B (models.Model):
  field_b1 = models.CharField (max_length = 10)
  a_field = models.ForeingKey (A)

right, now imagine that on the bench, table A has saved:
field1 = "world"
and B is saved in the table:
field_b1 = "hello"
a_field = 1

Well, how can I get the real value of a_field (which is world)? But there's 
a catch, I wanna do this for the entire table B, if there is more fields 
saved in the bank.


Sincerely,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Add dynamically form to Formset

2013-06-27 Thread Mário Idival
Hello,
How you do for add more formset in form with Django 1.5?

-- 
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Views, Forms not working.

2013-07-01 Thread Mário Idival
"""
form.is_valid():
model_instance.save()

"""

form.is_valid():
form.save()




2013/7/1 Nigel Legg 

> So I have:
> views.py:
> def datatables(request):
> if request.method == 'POST':
> form = DataTableForm(request.POST)
> if form.is_valid():
> model_instance.save()
> return redirect('myapp/tabspec.html')
> else:
> form = DataTableForm()
> return render(request, 'myapp/datatables.html', {
> 'form': form,
> })
>
> template datatables.html:
> 
> 
> 
> Make Tables
> 
> 
>  enctype="multipart/formdata">{% csrf_token %}
>
>  {{ form.datFile.label_tag }} {{ form.datFile }} 
>  {{ form.structFile.label_tag }} {{ form.structFile }} 
>  {{ form.bannerVar.label_tag}} {{ form.bannerVar }} 
>  {{ form.stubVar.label_tag}} {{ form.stubVar }} 
>  {{ form.stubNets.label_tag }} {{ form.stubNets }} 
>
> 
>
> 
> 
>
> models.py:
> class DataTable(models.Model):
> datFile = models.CharField(max_length = 200)
> structFile = models.CharField(max_length = 200)
> bannerVar = models.CharField(max_length = 50)
> stubVar = models.CharField(max_length = 50)
> stubNets = models.BooleanField()
>
> and forms.py:
> class DataTableForm(forms.ModelForm):
> class Meta:
> model = DataTable
>
> The form shows fine (see image), but when I click the button it goes back
> to the index page, which isn't what I wanted to happen.  Any thoughts on
> where I am going wrong?
> Cheers N //
>
> Regards,
> Nigel Legg
> 07914 740972
> http://twitter.com/nigellegg
> http://uk.linkedin.com/in/nigellegg
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Views, Forms not working.

2013-07-01 Thread Mário Idival
Oh, but the url 'list'? remove the url 'list' of actions in forms


2013/7/1 Nigel Legg 

> Tried that, still going back to the index page.
>
> Regards,
> Nigel Legg
> 07914 740972
> http://twitter.com/nigellegg
> http://uk.linkedin.com/in/nigellegg
>
>
>
> On 1 July 2013 15:33, Mário Idival  wrote:
>
>> """
>> form.is_valid():
>> model_instance.save()
>>
>> """
>>
>> form.is_valid():
>> form.save()
>>
>>
>>
>>
>> 2013/7/1 Nigel Legg 
>>
>>>  So I have:
>>> views.py:
>>> def datatables(request):
>>> if request.method == 'POST':
>>> form = DataTableForm(request.POST)
>>> if form.is_valid():
>>> model_instance.save()
>>> return redirect('myapp/tabspec.html')
>>> else:
>>> form = DataTableForm()
>>> return render(request, 'myapp/datatables.html', {
>>> 'form': form,
>>> })
>>>
>>> template datatables.html:
>>> 
>>> 
>>> 
>>> Make Tables
>>> 
>>> 
>>> >> enctype="multipart/formdata">{% csrf_token %}
>>>
>>>  {{ form.datFile.label_tag }} {{ form.datFile }} 
>>>  {{ form.structFile.label_tag }} {{ form.structFile }} 
>>>  {{ form.bannerVar.label_tag}} {{ form.bannerVar }} 
>>>  {{ form.stubVar.label_tag}} {{ form.stubVar }} 
>>>  {{ form.stubNets.label_tag }} {{ form.stubNets }} 
>>>
>>> 
>>>
>>> 
>>> 
>>>
>>> models.py:
>>> class DataTable(models.Model):
>>> datFile = models.CharField(max_length = 200)
>>> structFile = models.CharField(max_length = 200)
>>> bannerVar = models.CharField(max_length = 50)
>>> stubVar = models.CharField(max_length = 50)
>>> stubNets = models.BooleanField()
>>>
>>> and forms.py:
>>> class DataTableForm(forms.ModelForm):
>>> class Meta:
>>> model = DataTable
>>>
>>> The form shows fine (see image), but when I click the button it goes
>>> back to the index page, which isn't what I wanted to happen.  Any thoughts
>>> on where I am going wrong?
>>> Cheers N //
>>>
>>> Regards,
>>> Nigel Legg
>>> 07914 740972
>>> http://twitter.com/nigellegg
>>> http://uk.linkedin.com/in/nigellegg
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Mário Idival
>>
>> *Twitter *: *@marioigd*
>> *Facebook*: *mario.idival*
>> *User Linux : **#554446*
>> Skype*: marioidival*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: server error (500)

2013-07-25 Thread Mário Idival
use this in your settings.py
ALLOWED_HOSTS = []

where are you envirioment? you app there in production or development?
Em 25/07/2013 04:35, "victoria"  escreveu:
>
> Hi,
>
> On Thu, Jul 25, 2013 at 4:30 AM, Oliver  wrote:
> > If I set DEBUG = False, I get this
> >
> > It worked!
> >
> > Congratulations on your first Django-powered page.
> >
> > Of course, you haven't actually done any work yet. Here's what to do
next:
> >
> > If you plan to use a database, edit the DATABASES setting in
> > mysite/settings.py.
> > Start your first app by running python manage.py startapp [appname].
> >
> > You're seeing this message because you have DEBUG = True in your Django
> > settings file and you haven't configured any URLs. Get to work!
> >
> >
> >
> >
> >
> > If I set it to true, I get the server error (500).  I created the
template
> > and static folder inside mysite folder.  Here is my setting.py.
> >
>
> Can  you check the apache error log to see if you can find more
> information there? It is located in
> C:\BitNami\djangostack-1.5.1-0\apache2\logs
>
>
> > I run the inspectdb and it went fine, no errors.   I'm new and
following the
> > tutorials at Django website documentation.
> >
> > I appreciate any help.
> >
> >
> >
> >
> >
> >
> >
> > # Django settings for mysite project.
> >
> > DEBUG = True
> > TEMPLATE_DEBUG = DEBUG
> >
> > ADMINS = (
> > # ('mysite', 'em...@email.com'),
> > )
> >
> > MANAGERS = ADMINS
> >
> > DATABASES = {
> > 'default': {
> > 'ENGINE': 'django.db.backends.mysql', # Add
'postgresql_psycopg2',
> > 'mysql', 'sqlite3' or 'oracle'.
> > 'NAME': 'mysitedb',  # Or path to database
file
> > if using sqlite3.
> > # The following settings are not used with sqlite3:
> > 'USER': 'root',
> > 'PASSWORD': '',
> > 'HOST': '',  # Empty for localhost through
> > domain sockets or '127.0.0.1' for localhost through TCP.
> > 'PORT': '',  # Set to empty string for
default.
> > }
> > }
> >
> > # Hosts/domain names that are valid for this site; required if DEBUG is
> > False
> > # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
> > ALLOWED_HOSTS = ['localhost']
> >
> > # Local time zone for this installation. Choices can be found here:
> > # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> > # although not all choices may be available on all operating systems.
> > # In a Windows environment this must be set to your system time zone.
> > TIME_ZONE = 'EST'
> >
> > # Language code for this installation. All choices can be found here:
> > # http://www.i18nguy.com/unicode/language-identifiers.html
> > LANGUAGE_CODE = 'en-us'
> >
> > SITE_ID = 1
> >
> > # If you set this to False, Django will make some optimizations so as
not
> > # to load the internationalization machinery.
> > USE_I18N = True
> >
> > # If you set this to False, Django will not format dates, numbers and
> > # calendars according to the current locale.
> > USE_L10N = True
> >
> > # If you set this to False, Django will not use timezone-aware
datetimes.
> > USE_TZ = True
> >
> > # Absolute filesystem path to the directory that will hold user-uploaded
> > files.
> > # Example: "/var/www/example.com/media/"
> > MEDIA_ROOT = ''
> >
> > # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> > # trailing slash.
> > # Examples: "http://example.com/media/";, "http://media.example.com/";
> > MEDIA_URL = ''
> >
> > # Absolute path to the directory static files should be collected to.
> > # Don't put anything in this directory yourself; store your static files
> > # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> > # Example: "/var/www/example.com/static/"
> > #STATIC_ROOT = ''
> >
> > # URL prefix for static files.
> > # Example: "http://example.com/static/";, "http://static.example.com/";
> > STATIC_URL = '/static/'
> >
> > # Additional locations of static files
> > STATICFILES_DIRS = (
> > # Put strings here, like "/home/html/static" or
"C:/www/django/static".
> > # Always use forward slashes, even on Windows.
> > # Don't forget to use absolute paths, not relative paths.
> > )
> >
> > # List of finder classes that know how to find static files in
> > # various locations.
> > STATICFILES_FINDERS = (
> > 'django.contrib.staticfiles.finders.FileSystemFinder',
> > 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> > #'django.contrib.staticfiles.finders.DefaultStorageFinder',
> > 'C:\BitNami\djangostack-1.5.1-0\mysite\mysite\static',
> > )
> >
> > # Make this unique, and don't share it with anybody.
> > SECRET_KEY = '358gds4dg4s0*&^&^lkN0g4ses4rt6strssgs'
> >
> > # List of callables that know how to import templates from various
sources.
> > TEMPLATE_LOADERS = (
> > 'django.template.loaders.filesystem.Loader',
> > 'django.template.loaders.app_directories.Loader',
> > # 'django.template.loaders.eggs.Loader',
> > )
> >
> > MIDDLEWAR

How template tag can receive values JS

2013-08-01 Thread Mário Idival
Good morning everyone,
I wonder how I can do (and if it is possible), pass a value of javascript
variable to a template tag Django.

eg
how it works:
{{Document.id | split_filter}} -> split_filter is just a random method,
receives an ID

as would
{{"Value Var JS" | split_filter}} -> pass the id that comes from a JS
variable to the template tag.

Thanks.
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*
*Blog:  *https://conconcus.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Engineering Roles At a startup

2013-08-03 Thread Mário Idival
Home Work can?

Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*
*Blog:  *https://conconcus.wordpress.com


2013/8/3 yoibr 

> I am a freelance recruiter currently hiring Product Engineer,Dev-Ops
> engineer
> and Infrastructure engineer  for a product startup backed by the same
> investors as Facebook, Google, Skype, Groupon.
>
> Location:Bangalore
>
> For more info visit:http://wehire4u.blogspot.in/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Bring real data tables with FK

2013-08-05 Thread Mário Idival
Good morning,
I have this situation:

I have 3 classes, Document, Layout and Company

1 Document has 1 Layout 1 and Company ..
Document class:
layout = models.ForeignKey (Layout)
company = models.ForeignKey (Company)

I have a search page that is being filled by JSON, then the data layout and
the company is returning the ID of them respectively, and the ideal would
be to show the names of each data (Name and Company Name Layout) ..

How can I accomplish this query so that I quoted above?

Sincerely, o /
Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*
*Blog:  *https://conconcus.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Bring real data tables with FK

2013-08-05 Thread Mário Idival
thanks for answering my question... But i find an way better for this.

I create an gist explaining how to do :
https://gist.github.com/marioidival/6156074


Thanks!

Mário Idival

*Twitter *: *@marioigd*
*Facebook*: *mario.idival*
*User Linux : **#554446*
Skype*: marioidival*
*Blog:  *https://conconcus.wordpress.com


2013/8/5 Giulio Calacoci 

>  Hi,
>
> How do you fill the JSON?
> You use the Document class as Main entity ?
>
> Because if you have a Document entity, simply use the internal reference
> to the related object.
>
> example:
>
> Assuming that you are filling a Map and then use the map for a quick JSON
> transform.
>
> {
> 'Document id': document.id,
> 'Related Layout id': document.layout.id,
> 'Related Layout Name', document.layout.name,
> }
>
> or you can perform a query using the Django orm, using the document_id as
> filter.
> Example:
>
> layout =
> Layout.objects.get(document_id=)
>
> This is just a guess of how things works on your program... but maybe it's
> a starting idea.
> Or maybe I've misunderstood you problem and I'm totally wrong :D
>
> Regards
> Giulio.
>
>
>
> Il 05/08/2013 14:49, Mário Idival ha scritto:
>
>  Good morning,
> I have this situation:
>
>  I have 3 classes, Document, Layout and Company
>
>  1 Document has 1 Layout 1 and Company ..
> Document class:
> layout = models.ForeignKey (Layout)
> company = models.ForeignKey (Company)
>
>  I have a search page that is being filled by JSON, then the data layout
> and the company is returning the ID of them respectively, and the ideal
> would be to show the names of each data (Name and Company Name Layout) ..
>
>  How can I accomplish this query so that I quoted above?
>
>  Sincerely, o /
>  Mário Idival
>
>   *Twitter *: *@marioigd*
> *Facebook*: *mario.idival*
> *User Linux : **#554446*
>  Skype*: marioidival*
>  *Blog:  *https://conconcus.wordpress.com
>   --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.