Re: How to redorder app

2013-09-06 Thread Mehmet Gultas
I guess, you're searching for
this
.

Mehmet Gültaş | Research Assistant | Department of Psychology | METU
| +90-312-2105966


On Fri, Sep 6, 2013 at 11:16 AM, Ranjith Kumar wrote:

> Hello,
> I trying to reorder the app in django admin, is there anyways we can do it
> via admin.py?
>
> Thank you!
>
> --
> Cheers,
> Ranjith Kumar K,
> Chennai.
>
> http://ranjithtenz.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.


OneToOneField revese lookup question

2014-06-06 Thread Mehmet Gultas
Using the model below, I am trying to extend User. And with the related
view I am trying to reach the method of AnkediDolduran model.
authonticate() gives me a User instance, right? How can I reach the method
of the model AnketiDolduran using this instance of User?

Thanks in advance.


class AnketiDolduran(models.Model):
'''Anketi dolduran kişilere ait bilgileri saklar.'''
UNVANLAR = (
('AR', 'Araştırma Görevlisi'),
('OK', 'Okutman'),
('OG', 'Öğretim Görevlisi'),
('YR', 'Yardımcı Doçent Doktor'),
('DO', 'Doçent Doktor'),
('PR', 'Profesör Doktor'),
)
title = models.CharField('ünvan', max_length=2,
  choices=UNVANLAR,
  default='Yardımcı Doçent Doktor',
  help_text = 'Lütfen ünvanınızı
giriniz')
university = models.CharField('üniversite', max_length = 100, help_text
= 'Görev yaptığınız üniversiteyi belirtiniz')
department = models.CharField('bölüm', max_length = 100, help_text =
'Görev yaptığınız bölümü belirtiniz')
# Using this I am extending user model, I guess. Am I right?
user = models.OneToOneField(User)

def __unicode__(self):
return u'%s %s' % (self.user.first_name, self.user.last_name)

def arastirma_gorevlisi_mi(self):
'''Anketi dolduran kişi araştırma görevlisiyse TRUE döndürüyor.'''
return self.title in ('AR', )

def ogretim_uyesi_mi(self):
'''Anketi dolduran araştırma görevlisinden başka bir şeyse TRUE
döndürüyor.'''
return self.title in ('OK', 'OG', 'YR', 'DO', 'PR')


def giris(request):
context_instance = RequestContext(request)
if request.method == 'POST':
username = request.POST['user']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
#how can I reach this object through user?
if user.anketidolduran_set.arastirma_goverlisi_mi():
print 'arastirma_gorevlisi_mi()'
return redirect('anketler/bke_olcegi')
if anketidolduran.ogretim_uyesi_mi():
print 'ogretim_uyesi_mi()'
return redirect('anketler/performans_degerlendirme')
else:
pass

else:
return render_to_response('registration/login.html',
context_instance=context_instance)


*Mehmet Gültaş | Research Assistant | Department of Psychology | Middle
East Technical University *

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABYYfXNB2Ffz4anqRtVrFoV6u5mv%2B0Q0PJWxYTfjpK%2BA9877Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.