Luis
Pycharm?
inchidi
Pycharm?
more like vscode than pycharm for me
Django Bot
>> Blogs
- How to add Wagtail page programmatically via Python script
>> Links
- Django Class-Based-View Inspector -- Classy CBV
- Django REST Framework 3.7 -- Classy DRF
Anonymous
Django Bot
>> Links
- Django Class-Based-View Inspector -- Classy CBV
Django Bot
>> Links
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- An example Django REST framework project for test driven development.
Mahesh
Guys .
I wanna increase my partition size in Linux...
From 200 GB to 350gb
How may I do it????
I hve dual booted my laptop nd also installed windows 10..
In dat I hve given 200gb for Ubuntu nd test for windows 10
How may I increase my partition size of Ubuntu from 200 to 350gb..
r0b0t
Ismael
Weird
Here is, querydict issue:
From JS:
data: {'periodos':{'1':'50','2':'30','3':'20'},'nombre':{'ismael':'n1'}},
Python Log:
INFO:prices.views:{'periodos[1]': '50', 'periodos[2]': '30', 'periodos[3]': '20', 'nombre[ismael]': 'n1'}
Anonymous
Well both look familiar
Ismael
sure, but I cant go with dict['periodos']
Ismael
keyerror returned
Django Bot
>> Links
- Crossbar.io
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- mixcloud/django-experiments: Django AB testing module
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
Mahesh
Use gparted
Will it use dat free space if windows 10?
Anonymous
Will have a look again.
Django Bot
>> Links
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
Anonymous
hi, i try to use django abstracuser for user auth, but after i create user with superuser, the user cant login to django admin, its normal?
inchidi
Django Bot
>> Links
- Django Admin Cookbook
- Django Content Management System | Wagtail CMS
- Realtime Django Part 1: Build a Chat application with django, RabbitMQ and
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- internationalization - Django templates: Get current URL in another languag
Django Bot
>> Links
- Let's talk about usernames
Deepanshu S
Hello can someone help me in a small django feature! I need immediate help
Deepanshu S
Actually I have a comment button in ui , which I click redirects me to another page - where i can add comment , I want it to be on same page , no redirections required . *Can someone tell what to do to avoid redirect in django*
Mahesh
U need to use ajax for ot
Mahesh
It
Django Bot
>> Links
- OEP-17: Feature Toggles by nasthagiri · Pull Request #54 · edx/open-edx-pro
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- Django Admin Cookbook — Django Admin Cookbook 2.0 documentation
- mattiaslinnap/django-partial-index: PostgreSQL and SQLite partial index sup
- revsys/django-test-plus: Useful additions to Django's default TestCase
- wagtail/wagtail: A Django content management system focused on flexibility
- Let's talk about usernames
- IT-инфраструктура штабов Навального и сбор подписей: Жнец-2018 / Блог компа
Safwan
Mahesh
Leo
See my pm
Please don’t give answers in PN, since it could help others with similar problems ;)
Leo
Or copy/forward them in here, that’s fine as well 😇
Django Bot
>> Jobs
- Python/Django Developer (freelance)
Anonymous
Hey
Anonymous
I need a help
Anonymous
I need help
I want to define a view in a django project to show the search result ( with class based view) and also want to paginate it
Anonymous
https://hastebin.com/ayafozapuw.py
Django Bot
>> Blogs
- Do you know what is REST API?
Safwan
Luis
Hi guys
Luis
I have a question
Luis
I get a list using this: {% regroup object_list by slug|first|upper as letter_list %}, but i need dive this list in four groups in the template
Luis
Any idea?
Luis
I am thinking about modify the queryset method for slice the query set
Django Bot
>> Links
- Django Content Management System | Wagtail CMS
Anonymous
hey I created a class based view for searching but when moving to the secind page of the search its guvung me value error
This is the error :
https://hastebin.com/ojigakewoc.tex
And this is my view:
https://hastebin.com/eqapifaluc.py
can anyone help?
Crackly
Hey... I recently installed django but i am bit confused about how it works...app,models,urls,...
Crackly
From where can i start...?
biswaz
I've a charfield with some text.. and in that text there are multiple urls. In want to add a href to those when I use it in the template. How can I do this?
Anonymous
Anonymous
biswaz
Ok.. then how do I insert the links from the lists to the text in the template
Anonymous
Django Bot
>> Links
- Django Content Management System | Wagtail CMS
Luis
Finally i did it using a custom tag
Anonymous
Hi guys,
https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.FileField.upload_to
i want to use this to save my file in custom path
i was search and found this answer:
https://stackoverflow.com/questions/34239877/django-save-user-uploads-in-seperate-folders
And i get this error when i send my files:
'FileUpload' object has no attribute 'user'
but in documents explained instance:
instance
An instance of the model where the FileField is defined. More specifically, this is the particular instance where the current file is being attached.
In most cases, this object will not have been saved to the database yet, so if it uses the default AutoField, it might not yet have a value for its primary key field.
and my code is here :
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
return 'user_{0}/{1}'.format(instance.user.id, filename)
# Create your models here.
class FileUpload(models.Model):
owner = models.ForeignKey(User, to_field='id', on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
apk_file = models.FileField(upload_to=user_directory_path)
report_file = models.FileField(upload_to=user_directory_path)
what's wrong?
you should use instance.owner instead of instance.user , your model is having owner not user, check on your model class for this
Django Bot
>> Links
- stefanfoulis/django-phonenumber-field: A django model and form field for no
Anonymous
Code9
Hi guys,
https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.FileField.upload_to
i want to use this to save my file in custom path
i was search and found this answer:
https://stackoverflow.com/questions/34239877/django-save-user-uploads-in-seperate-folders
And i get this error when i send my files:
'FileUpload' object has no attribute 'user'
but in documents explained instance:
instance
An instance of the model where the FileField is defined. More specifically, this is the particular instance where the current file is being attached.
In most cases, this object will not have been saved to the database yet, so if it uses the default AutoField, it might not yet have a value for its primary key field.
and my code is here :
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
return 'user_{0}/{1}'.format(instance.user.id, filename)
# Create your models here.
class FileUpload(models.Model):
owner = models.ForeignKey(User, to_field='id', on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
apk_file = models.FileField(upload_to=user_directory_path)
report_file = models.FileField(upload_to=user_directory_path)
what's wrong?
def save(self, *args, **kwargs):
if self.pk is None:
temp = self.apk_file
self.apk_file = None
super(Order, self).save(*args, **kwargs)
self.apk_file = temp
super(Order, self).save(*args, **kwargs)
Try overriding the save() method
karry
Hey members I need some help on a project I am having. I need to do a project on django Matchmaker but the project uses django 1.8 which I need to convert to current django version .How do I go about it?
Anonymous
you don't have requirments.txt file in your project directory
when you use pip -r file
and for updating django from 1.8 to 2 you need to read changed log for version 2 and change your code where it need. and just install django 2 with pip
pip install django >= 2
i think
mλdcodez
Quick Question...
🗄models.py
class Categories(models.Model):
name = models.CharField(max_length=200)
objects = EntryQuerySet.as_manager()
class Meta:
verbose_name = "Category"
verbose_name_plural = "Categories"
def __str__(self):
return self.name
🗄admin.py
. . .
admin.site.register(models.Categories)
_how can i access the saved values under admin panel, Categories_
check next screenshot please.
Django Bot
>> Jobs
- Full Stack Developer
>> Blogs
- The Model-View-Controller Design Pattern
>> Links
- Dramatiq: simple task processing — Dramatiq 0.19.0 documentation
- Packaging Django with Docker - Kristian Glass - Do I Smell Burning?
- Django Content Management System | Wagtail CMS
- vevurka/frisor: Box for interesting urls web application in Python/Django
Charly
so you want to show all objects of a model in the admin principal page?
mλdcodez
I wanna show these
mλdcodez
Charly
mλdcodez
I'm a beginner. I'm studying django official doc.
mλdcodez
Charly
by default django won't show these objects, perhaps youll need to write a custom template
mλdcodez
So, I saved those values. Because, I called models.Categories while registering
mλdcodez
Charly
mλdcodez
Other imports
?
mλdcodez
Um. Can you please give an example of definition. For view.
Charly
https://docs.djangoproject.com/en/2.0/intro/tutorial03/
Luis
Guys, are this code well optimized?
class RecipesTag(GlobalQueryMixin, ListView):
model = TaggedItem
template_name = 'tags/recipe_tags.html'
def get_queryset(self):
"""
Overloading Queryset function for get 'slug' based tag's items.
:return:
"""
if self.kwargs.get('slug'):
self.recipe_tag = get_object_or_404(Tag, slug=self.kwargs['slug'])
if self.queryset is not None:
queryset = self.queryset
if isinstance(queryset, QuerySet):
queryset = queryset.filter(tag=self.recipe_tag)
elif self.model is not None:
queryset = self.model._default_manager.filter(tag=self.recipe_tag)
else:
raise ImproperlyConfigured(
"%(cls)s is missing a QuerySet. Define "
"%(cls)s.model, %(cls)s.queryset, or override "
"%(cls)s.get_queryset()." % {
'cls': self.__class__.__name__
}
)
ordering = self.get_ordering()
if ordering:
if isinstance(ordering, six.string_types):
ordering = (ordering,)
queryset = queryset.order_by(*ordering)
return queryset
def get_context_data(self, **kwargs):
"""
Getting the tag name
:param kwargs:
:return: tag name
"""
context = super(RecipesTag, self).get_context_data(**kwargs)
context['title'] = self.recipe_tag.name
return context
Luis
Thanks.
Django Bot
>> Jobs
- Full Stack Developer