The more time I spend with django, the more problems pop up :)
I dont fully understand how to access related fields between models. (FK or
ManyToMany)
Code:
http://pastebin.com/qbciYqYw
In code pasted below - {{p.souce.all}} returns source name but in that
form: [], instead of "Google".
Also I
On Sunday, 11 September 2011 08:23:16 UTC+1, Petey wrote:
>
> The more time I spend with django, the more problems pop up :)
>
> I dont fully understand how to access related fields between models. (FK or
> ManyToMany)
> Code:
> http://pastebin.com/qbciYqYw
>
> In code pasted below - {{p.souce.all
On Sunday, 11 September 2011 00:18:28 UTC+1, Kurtis wrote:
>
> Hey Guys,
>
> I have a very simple stub of a project. I'm trying to do something
> that should be very simple but isn't as easy as I hoped.
>
> I have a UserProfile class. This object is basically just an extension
> of the standar
That worked but how do I acces other field called "url" which is in Category
model?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/1VxdFnovRNEJ.
To post t
Why would it be any different? You have the same relationship between
Publisher and Category as you do between Publisher and Source, so just do
the same thing again.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussio
And also how do I display more objets from that list? ;) Sorry for double
post
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/FAgvFRzJpdIJ.
To post to thi
Hi,
as Daniel wrote, the {{ p.source.all }} is a queryset you can access the
same way as in {% for p in publisher.object_list %}. So you create a
nested for loop.
Martin
On Sun, 11 Sep 2011 10:38:39 +0200, Petey wrote:
And also how do I display more objets from that list? ;) Sorry for d
Ooops I meant source ;)
Firstly:
{{ p.source.all.0 }} - < gets source name, only first element (as proper
slice should work) but I still dont understand how to get all avaliable
elements for each source in publisher
Secondly:
{{ p.source.url.all.0 }} < does not get URL from Source.url, I reall
{{ p.source.all }} - is a list of source objects
{{ p.source.all.0 }} - is the first item in the list of source objects
(the same as p.source.all[0] in python)
{{ p.source.all.0.some_attribute }} - you access some_attribute of the
object source which is the first item in the list od source
Thank you Bruce and Daniel both anwsers really helped me.
I really appreciate it :).
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/LkInATAnM28J.
To post
On Fri, Sep 9, 2011 at 12:02 PM, Brett Hutley wrote:
> You need to add it to the registration_form.html as well.
>
> Make sure you have 'django.middleware.csrf.CsrfViewMiddleware', in the
> MIDDLEWARE_CLASSES tuple in the settings.py file.
>
> Cheers, Brett
>
> On 9 Sep 2011, at 16:47, nicolas H
Hi!
How can I express this SQL query
SELECT ... FROM (
SELECT ... FROM ...
)
in the ORM? Specifically, I want to express
SELECT ... FROM (
SELECT ... FROM app_model
ORDER BY field1
)
GROUP BY field2
Is it possible without writing SQL by hand?
Thanks,
Jonas
--
Django +
在什么地方举行呢?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this
*You can filter the objects based on user. Which means you can include a
ForeignKey to User model in your models, and save the logged in user while
saving the model. In the views, while displaying, you can filter based on
the logged-in user. So no other user get to see your objects
*
On Tue, Aug 30
Hi,
I have been struggling with this for a while now and I can't seem to
find a way of returning a class object from a different module without
importing it.
Say I have two files:
test_a.py
class A(models.Model):
pass
test_b.py
class B(models.Model):
def get_a_class(se
2011/9/9 sjtirtha
> But I cannot set the SITE_ID in the settings.py right?
> Because if one user set the SITE_ID = 1, then parallel another user
> can set the SITE_ID = 2.
> Because we only have one instance.
>
Right, but AFAIK if you don't use threads you shouldn't have any problem.
We have b
I should add that in the B class function get_a_class I only have a
variable name "A"
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email
Hi,
you can do the import here to prevent circular import:
class B(models.Model):
def get_a_class(self):
from test_a import A
return A
Martin
On Sun, 11 Sep 2011 16:49:22 +0200, pbzRPA wrote:
Hi,
I have been struggling with this for a while now and I can't seem to
find
Hi Martin,
Thanks for the tip. The thing is that I store my class names in the
database. So
class B(models.Mode):
form_class = models.CharField(...)
def get_form_class(self):
return ..(self.form_class) <- this is where I need to some
how get the class object from a different
Ok, I found a way. I don't know if it's the best way but it works :)
return getattr(__import__(module_name, fromlist = [class_name]),
class_name)
Thanks for the help.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
Hello all I have two views in two app and I want to get them in main
url file how I Can do that ?
first view in project/app_news/views.py
def article_index(request):
return render_to_response('news/index.html', {
'news_slide': Article.objects.filter(status=1,
statusslide=1)[:
Hi cha,
Programming in django is just programming in python. Views are just
normal python functions that are called from urls.py which contains
pattern which is also a function.
If you want both views in one file, do exactly that. You could cut and
paste the view in the second app and paste it in t
You may merge the code in views.py and use 1 url for them.
You could use TemplateView() instead of render to response
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/djan
I know you can run multiple admin sites, but the only reason I can see for
doing it is to have a full admin and other customized admin sites for
different types of users. This is possibly even a stretch, and really just a
guess.
What are some of the use cases for multiple admin sites?
--
Yo
I've done this for a multitenant project where we wanted each tenant
to have their own admin site with just their own data filtered, as
well as a central admin where senior staff could manage all tenants'
data. It's also handy if you want different interfaces (custom forms,
read-only or excluded
thank you very much
Babatunde Akinyanmi & petey
Im merge the code and its work
Mr Babatunde Akinyanmi
acutely I need be comfortable with programming with python
But I dont Know How to do that
can you help me and give me the best way to be comfortable and
professional programmer
--
You received t
Hi Babatunde,
1. sorry for the delayed answer - but I was in the last three weeks
far from any possibility to use the Internet (and Django as well)...
2. I have tried to reproduce the phenomenon and with the 'Pászkán
Attila' as user it worked ! Why? - still it isn't clear.
PA
On Aug 26, 12:20
Where can I find any info about hot to run it?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/s5twxCSBgDMJ.
To post to this group, send email to django-use
That makes sense. Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/Hz0DW_-dSwAJ.
To post to this group, send email to django-users@googlegroups.com.
T
ok, i am planning to remove all traces of all django installations
from my
system, and re-install the dev version (and if that still does not
work 3.1)
under virtualenv.
Will repost here if I still see problems.
Nara
On Sep 10, 7:16 pm, Babatunde Akinyanmi wrote:
> Hi nara,
> Please post the de
On Sat, Sep 10, 2011 at 11:06 PM, Shawn Milochik wrote:
> The way you were doing it makes perfect sense if you have experience
> creating database tables by hand, the way most people do for their PHP and
> ASP apps. Django's ORM is doing all the same stuff underneath, but it
> provides a level of
It isn't clear to me also. Initially I was surprised because the site
app doesn't have any dependency on django's user system. Even if it
does, django uses unicode which caters for those characters in your
name.
Well.at least we are sure the problem wsnt from the user name. But
something define
This is way off topic for this group but..
To be comfortable with python, the online python documentation is a
very good resource. It seems like you're a programming noob so also
get books like pragmatic programmer and Python The Hard Way. Of course
there are many more good books on python pr
And reply here if you don't see problems :)
On 9/12/11, nara wrote:
> ok, i am planning to remove all traces of all django installations
> from my
> system, and re-install the dev version (and if that still does not
> work 3.1)
> under virtualenv.
>
> Will repost here if I still see probl
Thank You very much!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/MUltEa4dGogJ.
To post to this group, send email to django-users@googlegroups.com.
To un
omg, I'm so ashamed...
I use {% csrf_token %} and it works,
Thx :)
Nicolas
On Sun, Sep 11, 2011 at 2:52 PM, DrBloodmoney wrote:
> On Fri, Sep 9, 2011 at 12:02 PM, Brett Hutley wrote:
> > You need to add it to the registration_form.html as well.
> >
> > Make sure you have 'django.middleware.csr
36 matches
Mail list logo