Re: I really about to give up Django

2013-08-30 Thread Aaron C. de Bruyn
Feel free to use whatever names you'd like in models.

def Ikhouvanjou(models.Model):
  #whatever field names you want...

-A


On Fri, Aug 30, 2013 at 6:23 PM, Dan Gentry  wrote:

>
> Just my opinion, but I see no reason to use English names in models.  Use
> whatever you wish.  English speaking programmers have been using cryptic
> variable names for decades.
>
> --
> 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.


Re: I really about to give up Django

2013-08-30 Thread Dan Gentry

Just my opinion, but I see no reason to use English names in models.  Use 
whatever you wish.  English speaking programmers have been using cryptic 
variable names for decades.

-- 
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: list(form) makes my form not safe anymore

2013-08-30 Thread Gerd Koetje
anyone?

-- 
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: Script to move django 1.4.3 to 1.5.1

2013-08-30 Thread Dan Gentry
I've been using Django since v1.0, and when each major version is released, 
I run through the release notes to see what I need to change.  Russell is 
correct that most things will work from one version to the next, but I like 
to keep as up to date as possible to minimize my risk of hitting a 
deprecated feature.  Once I build a checklist, I can go through it for each 
app I support.  Doesn't take too long, and I feel I gain a better 
understanding of the new features this way.


>  

-- 
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: OperationalError: unable to open database file

2013-08-30 Thread Dan Gentry
When using sqlite3, one has to provide a full path to the database file. 
 For my projects I use something like this on my development machines (for 
a database file named 'db'):

import os 
PROJECT_DIR = os.path.dirname(__file__) 

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', 
'NAME': os.path.join(PROJECT_DIR, 'db'),
}
}


On Monday, July 22, 2013 1:48:43 PM UTC-4, Stian Sjøli wrote:
>
> i get this error while going throught the tutorial from the django 
> website. I am a mac user, and have modified my settings-file to use sqlite3 
> and the name variable to say "./mysite". Any suggestions why I get this 
> error?
>

-- 
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: JSON or YAML?

2013-08-30 Thread Andre Terra
It depends on where your data is coming from. YAML has less cruft in it, so
if you're writing your own serializer you can consider it to have an
advantage over JSON.

OTOH, many applications can already export to JSON, so you can leverage
that if that's the case.

Finally, If you're writing anything by hand, YAML is much faster.


Cheers,
AT


On Fri, Aug 30, 2013 at 4:55 PM, Rich Haase  wrote:

> Personal preference.  Python has excellent libraries to support parsing
> both JSON and YAML.
>
> Sent from my iPhone
>
> On Aug 30, 2013, at 7:34 AM, Floor Tile  wrote:
>
> Helle everybody,
>
> Just a short and simple question:
>
> It seams that both JSON and YAML can be used for initial data loading.
> (among other data types but I don't care about them for the moment)
> But can't figure out what the up and/or downsides of them are.
> Is it purely a matter of personal preference or there one better to use
> than the other for initial data loading. And which one would be the most
> preferred, if this is the case?
>
> Many thanks in advance!
>
> --
> 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.


Re: Admin: Add new dataset with a pre-selected foreign key?

2013-08-30 Thread Kelvin Wong
Take a look at filters in the admin. You might be able to add log entries 
to recent items using an appropriate ModelAdmin on 'entry_created'

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter

Then use an InlineModelAdmin

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin

You could then select the sample by finding recently added samples, 
clicking on it, then add the log entry

K



On Friday, August 30, 2013 7:45:14 AM UTC-7, Katja wrote:
>
> Hi,
>
> I have a data model like this:
> class Samples(models.Model):  
>   sample_id = models.CharField(max_length=128, help_text='Id of the 
> sample')
>   entry_created = models.DateTimeField(auto_now_add=True)
>   sample_status = models.CharField(choices=SAMPLE_STATUS_CHOICES, 
> max_length=128)
>   comments = models.TextField(null=True, blank=True)
>   def __unicode__(self):
> return ("%s" % (self.sample_id))
>
> class StatusLog(models.Model):
>   sample_id = models.ForeignKey(Samples)
>   lsu_proc_id = models.IntegerField()
>   orig_lab = models.ForeignKey(OriginatingLab)
>   cruise_id = models.ForeignKey(Cruises)
>   tier = models.ForeignKey(Tiers)
>   orig_tier_tote_nr = models.IntegerField()
>   gear_type = models.ForeignKey(GearType)
>   orig_number_jars = models.IntegerField()
>   all_consumed = models.CharField(max_length=3, choices=YES_NO_CHOICE)
>   def __unicode__(self):
> return ("%s %s" %(self.sample_id, self.lsu_proc_id))
>
> 
>
> So first I add a Sample, and later I want to add a status log entry - 
> using the admin interface.
> Problem: My list of samples will be LONG (right now roughly 1000 entries, 
> more are coming). 
>
> Is there any way that I can call the "add" page (
> http://MYSERVER/admin/statuslog/statuslog/add/) with the sample already 
> preselected, so I don't have to go through the whole list?
>
> Any ideas?
>
> Thanks!
> Katja
>

-- 
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: list(form) makes my form not safe anymore

2013-08-30 Thread Gerd Koetje
In my view i do this form, and it only works when i use list



{% csrf_token %}
{{ form.media }}


Kies een profielnaam



{% for field in form|slice:":1" %}

{{ field.label_tag }}
{{ field }}
{% if field.errors %}{{ field.errors }}{% endif %}

{% endfor %}










Profielgegevens



{% for field in form|slice:"1:8" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}









Persoonsgegevens



{% for field in form|slice:"8:18" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Burgelijkestaat



{% for field in form|slice:"18:19" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Opleidingsniveau



{% for field in form|slice:"19:20" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Levensstijl



{% for field in form|slice:"20:21" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Uiterlijkekenmerken



{% for field in form|slice:"21:22" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Belangstellingvoor



{% for field in form|slice:"22:23" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}












Sexvoorkeuren



{% for field in form|slice:"23:24" %}

{{ field.label_tag }}
{{ field }}

{% endfor %}










-- 
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.


list(form) makes my form not safe anymore

2013-08-30 Thread Gerd Koetje

Why does list(form) make my form not safe anymore?





@login_required
def create(request):

if request.POST:
logger.debug('>>>POST POST POST<<<')
form = ProfielenForm(request.POST, instance=request.user.profile)
if form.is_valid():
form.save()

return HttpResponseRedirect('/profielen/all')
else:

user = request.user
profile = user.profile
form = ProfielenForm(instance=profile)

args = {}
args.update(csrf(request))
args['context_instance'] = RequestContext(request)
args['form'] = list(form)

return render(request, 'create_profiel.html', args)


-- 
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: JSON or YAML?

2013-08-30 Thread Rich Haase
Personal preference.  Python has excellent libraries to support parsing both 
JSON and YAML.

Sent from my iPhone

On Aug 30, 2013, at 7:34 AM, Floor Tile  wrote:

> Helle everybody,
> 
> Just a short and simple question:
> 
> It seams that both JSON and YAML can be used for initial data loading. (among 
> other data types but I don't care about them for the moment)
> But can't figure out what the up and/or downsides of them are.
> Is it purely a matter of personal preference or there one better to use than 
> the other for initial data loading. And which one would be the most 
> preferred, if this is the case?
> 
> Many thanks in advance!
> -- 
> 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.


Why no locale (formats.py) for Australia en_AU or Canada en_CA?

2013-08-30 Thread Justin Hill
https://github.com/django/django/tree/master/django/conf/locale

Does anyone have an idea as to why Australia doesn't have a locale format? 
 en_GB is there, but no en_CA, or en_AU.  My code is in seven countries and 
my forms are working in all of them except Australia and Canada.  It's 
looking for an en_AU format folder that doesn't exists and falling back to 
the defaults.  My users wonder why they can't enter dates in their native 
date format.

Translations are working for things that are different like US: 'zip code', 
CA: 'postal code', AU: 'postcode'

Same would apply to Canada en_CA. But they aren't complaining because their 
date format matches the default -mm-dd.

I'm going to go the route of making my own format file 
(https://docs.djangoproject.com/en/dev/topics/i18n/formatting/#creating-custom-format-files),
 
but just seems odd that this would be necessary for such well known 
countries.

Am I doing it wrong?

Justin

-- 
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.


Skip form field when its filled in

2013-08-30 Thread Gerd Koetje
Hi all,


I got a form filed called : profilename
When this field is filled in i want to skip if in my form, but i want to 
shot it when its empty.

any easy way todo 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.


Re: Skip form field when its filled in

2013-08-30 Thread Gerd Koetje
thats doesnt work like i tought do :D

class ProfielenForm(forms.ModelForm):

#kleurogen = 
forms.ModelMultipleChoiceField(queryset=Keuzes.objects.filter(groep_id='kleurogen'))
#lengtehaar = 
forms.ModelMultipleChoiceField(queryset=Keuzes.objects.filter(groep_id__name='lengtehaar'))


class Meta:
model = Profielen
exclude = ('user',)

def get_form(self, request, obj=None, **kwargs):
kwargs['exclude'] = ['profielnaam',]

return super(ProfielenForm, self).get_form(request, obj, **kwargs)

-- 
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: Skip form field when its filled in

2013-08-30 Thread Gerd Koetje
proberly something like this?


def get_form(self, request, obj=None, **kwargs):
if request.user.is_superuser:
kwargs['exclude'] = ['foo',]

return super(CategoryModelAdmin, self).get_form(request, obj, 
**kwargs)

-- 
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: Removing the logged in user's name from the list of users in django

2013-08-30 Thread C. Kirby
I think you can use "is", but try this:
{% if not likes.user == request.user %}

On Friday, August 30, 2013 12:21:41 PM UTC-5, Robin Lery wrote:
>
>
> I am getting an error:
>
> TemplateSyntaxError at /forum/ 
>
> Unused 'is' at end of if expression.
>
>
>
> On Fri, Aug 30, 2013 at 10:05 PM, C. Kirby 
> > wrote:
>
>> To remove the current user from your list just use an if statement in 
>> your template that tests the user instance you are iterating over against 
>> request.user
>> i.e.
>>
>> {% for likes in forum.likes.all %}
>>  {% if not likes.user is request.user %}> href="/get/{{likes.user}}">{{l**ikes.get_full_name}}{% endif %}
>> {% endfor %}
>>
>> To reverse the list I think you can do:
>>
>> {% for likes in forum.likes.all.reverse %}
>>
>>
>> On Friday, August 30, 2013 10:35:46 AM UTC-5, Robin Lery wrote:
>>>
>>> I have a template that displays the numbers of likes and name of the 
>>> users liked the forum. But I don't want the request.user's (logged in 
>>> user's) name in the list, I just want the other user's name and not the 
>>> user itself. How do I achieve this? And also I want the list of the names 
>>> in the reverse order in the template (now its showing the latest liked user 
>>> in the last of the list.). Please guide me. Thank you.[image: Inline 
>>> image 1]
>>>
>>> forums.html:
>>>
>>> {% extends "base.html" %}{% load forum_tags %}
>>> {% block content %}Logged in as -- {{request.user}}Forums:
>>> {% if forums.count > 0 %}
>>> {% for forum in forums %}
>>> >> href="/forum/get/{{forum.id}}/**">{{forum.question}}
>>> {{forum.body | truncatewords:"30"}}
>>> {% if user in forum.likes.all and forum.likes.count > 1 %}
>>> http://forum.id>}}/">Unlike You and {{forum.likes.count | 
>>> substract:1}} others liked
>>> {% elif user in forum.likes.all %}
>>> You liked it
>>> {% else %}
>>> http://forum.id>}}/">Like
>>> {% endif %}
>>> {% for likes in forum.likes.all %}
>>> >> href="/get/{{likes.user}}">{{l**ikes.get_full_name}}
>>> {% endfor %}
>>> {% endfor %}
>>> {% else %}
>>> Sorry! No forum to display.
>>> {% endif %}
>>> {% endblock %}
>>>
>>>
>>> snippet of views.py:
>>>
>>> def forums(request):
>>> forums = Forum.objects.all()
>>> c = {'forums': forums}
>>> return render(request, 'forums.html', c)
>>>
>>>   -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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.


Re: A quick Question about ManyRelatedManager.

2013-08-30 Thread Laurent Meunier

On 30/08/2013 18:53, Abhishek Vaid wrote:

Now I want to define *__unicode__(self)* method, in which I'll be
creating a string representation for the *BacklogEntry* object. In doing
so, I need to access all *users *which are referenced by
*ManyRelatedManager*. Basically, I want to access name attribute of each
User, referenced in a foreign key manner. But I'm not sure how to do that.


Your users are available through the RelatedManager on your BacklogEntry 
object, this means that you can have access to users with `self.users`.


`self.users` is a manager, so to access all users in the relationship, 
use something like `self.users.all()`



def __unicode__(self):
for user in self.users.all():
# do whatever you want with the `user` object
username = user.username


--
Laurent Meunier 

--
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: Removing the logged in user's name from the list of users in django

2013-08-30 Thread C. Kirby
To remove the current user from your list just use an if statement in your 
template that tests the user instance you are iterating over against 
request.user
i.e.

{% for likes in forum.likes.all %}
 {% if not likes.user is request.user %}{{likes.get_full_name}}{% endif %}
{% endfor %}

To reverse the list I think you can do:

{% for likes in forum.likes.all.reverse %}


On Friday, August 30, 2013 10:35:46 AM UTC-5, Robin Lery wrote:
>
> I have a template that displays the numbers of likes and name of the users 
> liked the forum. But I don't want the request.user's (logged in user's) 
> name in the list, I just want the other user's name and not the user 
> itself. How do I achieve this? And also I want the list of the names in the 
> reverse order in the template (now its showing the latest liked user in the 
> last of the list.). Please guide me. Thank you.[image: Inline image 1]
>
> forums.html:
>
> {% extends "base.html" %}{% load forum_tags %}
> {% block content %}Logged in as -- {{request.user}}Forums:
> {% if forums.count > 0 %}
> {% for forum in forums %}
> {{forum.question}}
> {{forum.body | truncatewords:"30"}}
> {% if user in forum.likes.all and forum.likes.count > 1 %}
> Unlike You 
> and {{forum.likes.count | substract:1}} others liked
> {% elif user in forum.likes.all %}
> You liked it
> {% else %}
> Like
> {% endif %}
> {% for likes in forum.likes.all %}
>  href="/get/{{likes.user}}">{{likes.get_full_name}}
> {% endfor %}
> {% endfor %}
> {% else %}
> Sorry! No forum to display.
> {% endif %}
> {% endblock %}
>
>
> snippet of views.py:
>
> def forums(request):
> forums = Forum.objects.all()
> c = {'forums': forums}
> return render(request, 'forums.html', c)
>
>  

-- 
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: Removing the logged in user's name from the list of users in django

2013-08-30 Thread Robin Lery
I can still see my name (the logged in user's name) on the list..


On Fri, Aug 30, 2013 at 10:05 PM, C. Kirby  wrote:

> To remove the current user from your list just use an if statement in your
> template that tests the user instance you are iterating over against
> request.user
> i.e.
>
> {% for likes in forum.likes.all %}
>  {% if not likes.user is request.user %} href="/get/{{likes.user}}">{{l**ikes.get_full_name}}{% endif %}
> {% endfor %}
>
> To reverse the list I think you can do:
>
> {% for likes in forum.likes.all.reverse %}
>
>
> On Friday, August 30, 2013 10:35:46 AM UTC-5, Robin Lery wrote:
>>
>> I have a template that displays the numbers of likes and name of the
>> users liked the forum. But I don't want the request.user's (logged in
>> user's) name in the list, I just want the other user's name and not the
>> user itself. How do I achieve this? And also I want the list of the names
>> in the reverse order in the template (now its showing the latest liked user
>> in the last of the list.). Please guide me. Thank you.[image: Inline
>> image 1]
>>
>> forums.html:
>>
>> {% extends "base.html" %}{% load forum_tags %}
>> {% block content %}Logged in as -- {{request.user}}Forums:
>> {% if forums.count > 0 %}
>> {% for forum in forums %}
>> > href="/forum/get/{{forum.id}}/**">{{forum.question}}
>> {{forum.body | truncatewords:"30"}}
>> {% if user in forum.likes.all and forum.likes.count > 1 %}
>> http://forum.id>}}/">Unlike You and {{forum.likes.count | substract:1}} 
>> others liked
>> {% elif user in forum.likes.all %}
>> You liked it
>> {% else %}
>> http://forum.id>}}/">Like
>> {% endif %}
>> {% for likes in forum.likes.all %}
>> > href="/get/{{likes.user}}">{{l**ikes.get_full_name}}
>> {% endfor %}
>> {% endfor %}
>> {% else %}
>> Sorry! No forum to display.
>> {% endif %}
>> {% endblock %}
>>
>>
>> snippet of views.py:
>>
>> def forums(request):
>> forums = Forum.objects.all()
>> c = {'forums': forums}
>> return render(request, 'forums.html', c)
>>
>>   --
> 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.


A quick Question about ManyRelatedManager.

2013-08-30 Thread Abhishek Vaid
I'm new to django and my question may be immature, but I really need answer 
to it. 

I have a model in my application as following.

class BacklogEntry(models.Model):
>
> PRIORITY_CHOICES = dict([(0, 'NA'), (1, 'Low'), (2, 'Medium'), (3, 
> 'High'), (4, 'Very High'), (5, 'Apocalypse')])
> STATUS_CHOICES = dict([(0, 'No Longer Valid'), (1, 'Suspended'), (2, 
> 'In Progress'), (3, 'Almost Finished'), (4, 'Finishded')])
>
> description = TextField()
> start_time = DateTimeField()
> end_time = DateTimeField()
> users = ManyToManyField(User)
> status = IntegerField(choices=STATUS_CHOICES.items())
> priority=IntegerField(choices=PRIORITY_CHOICES.items())
>
> backlog = ForeignKey(Backlog)
>

Now I want to define *__unicode__(self)* method, in which I'll be creating 
a string representation for the *BacklogEntry* object. In doing so, I need 
to access all *users *which are referenced by *ManyRelatedManager*. 
Basically, I want to access name attribute of each User, referenced in a 
foreign key manner. But I'm not sure how to do that. 

Some help is required.

-- 
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: [View Django] Problem with view that makes add and update

2013-08-30 Thread Marcos Luiz Wilhelm
Hello!
The problem that occurred was that the view when answering the case of 
modification, the id of the record was not passed when submitting the form. 
My solution was to add a block if / else to change the action of the form.
The following code: http://pastebin.com/BtPrpqSJ

I do not know if it is the best practice, but I think a simple solution.
Thanks C. Kirby.
Hug!

Em segunda-feira, 26 de agosto de 2013 12h40min52s UTC-3, Marcos Luiz 
Wilhelm escreveu:
>
> Hello!
> I'm having problems with a view that makes add and update
> The view generates a new record rather than change a instance.
> My code is this: http://pastebin.com/rZNAeN0p
> Someone can help me please?
>

-- 
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.


Admin: Add new dataset with a pre-selected foreign key?

2013-08-30 Thread Katja
Hi,

I have a data model like this:
class Samples(models.Model):  
  sample_id = models.CharField(max_length=128, help_text='Id of the sample')
  entry_created = models.DateTimeField(auto_now_add=True)
  sample_status = models.CharField(choices=SAMPLE_STATUS_CHOICES, 
max_length=128)
  comments = models.TextField(null=True, blank=True)
  def __unicode__(self):
return ("%s" % (self.sample_id))

class StatusLog(models.Model):
  sample_id = models.ForeignKey(Samples)
  lsu_proc_id = models.IntegerField()
  orig_lab = models.ForeignKey(OriginatingLab)
  cruise_id = models.ForeignKey(Cruises)
  tier = models.ForeignKey(Tiers)
  orig_tier_tote_nr = models.IntegerField()
  gear_type = models.ForeignKey(GearType)
  orig_number_jars = models.IntegerField()
  all_consumed = models.CharField(max_length=3, choices=YES_NO_CHOICE)
  def __unicode__(self):
return ("%s %s" %(self.sample_id, self.lsu_proc_id))



So first I add a Sample, and later I want to add a status log entry - using 
the admin interface.
Problem: My list of samples will be LONG (right now roughly 1000 entries, 
more are coming). 

Is there any way that I can call the "add" page 
(http://MYSERVER/admin/statuslog/statuslog/add/) with the sample already 
preselected, so I don't have to go through the whole list?

Any ideas?

Thanks!
Katja

-- 
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: JSON or YAML?

2013-08-30 Thread Floor Tile
In that case I'll go for JSON too as I'm already familiar with it.

Thanks for the quick reply.


On Fri, Aug 30, 2013 at 2:37 PM, Some Developer
wrote:

> On 30/08/2013 14:34, Floor Tile wrote:
>
>> Helle everybody,
>>
>> Just a short and simple question:
>>
>> It seams that both JSON and YAML can be used for initial data loading.
>> (among other data types but I don't care about them for the moment)
>> But can't figure out what the up and/or downsides of them are.
>> Is it purely a matter of personal preference or there one better to use
>> than the other for initial data loading. And which one would be the most
>> preferred, if this is the case?
>>
>> Many thanks in advance!
>>
>
> Personal preference. I use JSON simply because it seems to be more widely
> used in general. But choose whichever you want.
>
> --
> 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+unsubscribe@**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.


Re: JSON or YAML?

2013-08-30 Thread Some Developer

On 30/08/2013 14:34, Floor Tile wrote:

Helle everybody,

Just a short and simple question:

It seams that both JSON and YAML can be used for initial data loading.
(among other data types but I don't care about them for the moment)
But can't figure out what the up and/or downsides of them are.
Is it purely a matter of personal preference or there one better to use
than the other for initial data loading. And which one would be the most
preferred, if this is the case?

Many thanks in advance!


Personal preference. I use JSON simply because it seems to be more 
widely used in general. But choose whichever you want.


--
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.


JSON or YAML?

2013-08-30 Thread Floor Tile
Helle everybody,

Just a short and simple question:

It seams that both JSON and YAML can be used for initial data loading.
(among other data types but I don't care about them for the moment)
But can't figure out what the up and/or downsides of them are.
Is it purely a matter of personal preference or there one better to use
than the other for initial data loading. And which one would be the most
preferred, if this is the case?

Many thanks in advance!

-- 
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: reload counts

2013-08-30 Thread Ninja Master

How about django-hitcount  or 
django-tracking  if you're 
after analytics support?

Warm regards

On Friday, August 30, 2013 7:27:26 AM UTC+1, Harjot Mann wrote:
>
> I want to add a feature in my app in which when user opens a template, 
> it counts the number of clicks done and also count the number of of 
> times the page reloads. Not have any idea. Can anyone help me? 
>
> -- 
> Harjot Kaur Mann 
> Blog: http://harjotmann.wordpress.com/ 
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/ 
>

-- 
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: OperationalError: unable to open database file

2013-08-30 Thread jumpmanlane
make sure you don't have another instance of django running already.

-J

On Monday, July 22, 2013 1:48:43 PM UTC-4, Stian Sjøli wrote:
>
> i get this error while going throught the tutorial from the django 
> website. I am a mac user, and have modified my settings-file to use sqlite3 
> and the name variable to say "./mysite". Any suggestions why I get this 
> error?
>

-- 
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: Browsing a certain website within another website?

2013-08-30 Thread jumpmanlane
iframes?

-J

On Tuesday, August 6, 2013 12:43:32 AM UTC-4, Somnath wrote:
>
> is it possible to browse certain website within another website in django?

-- 
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: Django error with installing reviewboard on solaris.

2013-08-30 Thread jumpmanlane
you might need Python 2.7+

-J

On Wednesday, August 21, 2013 4:25:29 AM UTC-4, tomoya.f...@gmail.com wrote:
>
> I'm trying to install reviewboard on solaris 10, but this Django problem 
> stops me to do that.
> Does anyone know how to get through this problem?
> (python is 2.4)
>
> bash-3.2# pwd
>
> /home/fujita/Downloads/Django-1.3.7
>
> bash-3.2# python setup.py install
>
> ... snip
>
>  
>
> bash-3.2# ls -lt /usr/lib/python2.4/site-packages/
>
> total 2417
>
> ...snip
>
> drwxr-xr-x  17 root root  19 Aug 21 17:14 django-> 
> /* django is installed. */
>
> drwxr-xr-x   5 root root   5 Aug 21 16:53 
> ReviewBoard-1.5.7-py2.4.egg
>
> drwxr-xr-x   5 root root   5 Aug 21 16:41 
> Djblets-0.6.10-py2.4.egg
>
> drwxr-xr-x   5 root root   5 Aug 19 23:18 
> django_evolution-0.6.5-py2.4.egg
>
> drwxr-xr-x   4 root root   4 Aug 19 23:16 
> Pygments-1.4-py2.4.egg
>
> -rw-r--r--   1 root root  30 Aug 19 16:47 setuptools.pth
>
> -rw-r--r--   1 root root 546 Aug 19 16:09 easy-install.pth
>
> drwxr-xr-x   4 root root  10 Aug 19 15:41 
> PIL-1.1.6-py2.4-solaris-2.10-sun4u.egg
>
> -rw-r--r--   1 root root  136261 Aug 19 15:34 flup-1.0-py2.4.egg
>
> -rw-r--r--   1 root root  308077 Aug 19 15:18 
> paramiko-1.11.0-py2.4.egg
>
> drwxr-xr-x   4 root root   4 Aug 19 14:38 
> python_dateutil-1.5-py2.4.egg
>
> drwxr-xr-x   3 root root   5 Aug 19 14:27 
> python_memcached-1.53-py2.4.egg
>
> drwxr-xr-x   4 root root  10 Aug  8 22:00 
> setuptools-0.6c11-py2.4.egg
>
> drwxr-xr-x   7 root root  29 Aug 22  2011 docutils
>
> -rw-r--r--   1 root root3365 Aug 22  2011 roman.pyc
>
> -rw-r--r--   1 root root  514206 May  8  2011 pytz-2011g-py2.4.egg
>
> -rw-r--r--   1 root root7419 Jun 21  2007 
> recaptcha_client-1.0.1-py2.4.egg
>
> ...snip
>
>  
>
> bash-3.2# cat /usr/lib/python2.4/site-packages/easy-install.pth
>
> import sys; sys.__plen = len(sys.path)
>
> ./setuptools-0.6c11-py2.4.egg
>
> ./ReviewBoard-1.5.7-py2.4.egg
>
> ./recaptcha_client-1.0.1-py2.4.egg
>
> ./pytz-2011g-py2.4.egg
>
> ./python_memcached-1.53-py2.4.egg
>
> ./python_dateutil-1.5-py2.4.egg
>
> ./paramiko-1.11.0-py2.4.egg
>
> ./flup-1.0-py2.4.egg
>
> ./Pygments-1.4-py2.4.egg
>
> ./PIL-1.1.6-py2.4-solaris-2.10-sun4u.egg
>
> ./Djblets-0.6.10-py2.4.egg
>
> ./django_evolution-0.6.5-py2.4.egg
>
> import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
> p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = 
> p+len(new)
>
>  
>
> bash-3.2# easy_install ReviewBoard-1.5.7-py2.4.egg
>
> Processing ReviewBoard-1.5.7-py2.4.egg
>
> removing '/usr/lib/python2.4/site-packages/ReviewBoard-1.5.7-py2.4.egg' 
> (and everything under it)
>
> creating /usr/lib/python2.4/site-packages/ReviewBoard-1.5.7-py2.4.egg
>
> Extracting ReviewBoard-1.5.7-py2.4.egg to /usr/lib/python2.4/site-packages
>
> ReviewBoard 1.5.7 is already the active version in easy-install.pth
>
> Installing rb-site script to /usr/bin
>
> Installing rbssh script to /usr/bin
>
>  
>
> Installed /usr/lib/python2.4/site-packages/ReviewBoard-1.5.7-py2.4.egg
>
> Processing dependencies for ReviewBoard==1.5.7
>
> Searching for Django>=1.1.3
>
> Reading http://downloads.reviewboard.org/mirror/
>
> Reading http://downloads.reviewboard.org/releases/ReviewBoard/1.5/
>
> Reading http://pypi.python.org/simple/Django/
>
> No local packages or download links found for Django>=1.1.3
>
> Best match: None
>
> Traceback (most recent call last):
>
>   File "/usr/bin/easy_install", line 7, in ?
>
> sys.exit(
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py",
>  
> line 1712, in main
>
> with_ei_usage(lambda:
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py",
>  
> line 1700, in with_ei_usage
>
> return f()
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py",
>  
> line 1716, in 
>
> distclass=DistributionWithoutHelpCommands, **kw
>
>   File "/usr/lib/python2.4/distutils/core.py", line 149, in setup
>
> dist.run_commands()
>
>   File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands
>
> self.run_command(cmd)
>
>   File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
>
> cmd_obj.run()
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py",
>  
> line 211, in run
>
> self.easy_install(spec, not self.no_deps)
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py",
>  
> line 427, in easy_install
>
> return self.install_item(None, spec, tmpdir, deps, True)
>
>   File 
> "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_insta

Re: django refreshing problem

2013-08-30 Thread Sithembewena Lloyd Dube
Clear your browser cache and check your preferences. Then restart the
browser.


On Fri, Aug 30, 2013 at 8:28 AM, Harjot Mann wrote:

> On Mon, Aug 26, 2013 at 2:36 PM, Harjot Mann 
> wrote:
> > In django whenever I make some template I need to refresh it. I am not
> > getting what is the problem, is it some cache problem, even I disabled
> > it using never_cache but nothing worked, Is there anyone who faced the
> > same problem. Please help me I want to know that exactly what is
> > happening and why?
>
>
> Waiting for reply.
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
>
> --
> 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.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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.