Related records on same page with DetailView

2021-06-23 Thread David Crandell
Hello, I just don't stop having problems LOL.

All I want to do is display related Subcats on the detail page under the 
Category detail.

Seems like the exact same thing as the Books/Publisher demo but I just 
can't get it to work. It keeps saying my field doesn't exist, or it pulls 
all the records from the entire table for every entry in the Category 
table. This seems like it should be so simple. I'm really starting to get 
discouraged here.

This is my VIEW. Below are my models.

class CatDetailView(DetailView):
model = Category
template_name = 'ohnet/category_detail.html'

def get_context_data(self, **kwargs):
context = super(CatDetailView, self).get_context_data(**kwargs)
context['subcats'] = SubCat.objects.filter(category_id=self.get_object())
return context

MODEL

class Category(models.Model):
category_name = models.CharField(max_length=200, default=None)
date_entered = models.DateTimeField(auto_now_add=True)
customer_id = models.SmallIntegerField(default=0)
is_active = models.BooleanField(default=True)
scr_pending = models.BooleanField(default=False)
scr_pending_date = models.DateTimeField(default=None, null=True)
header_id = models.SmallIntegerField(default=0)
last_script_added = models.DateTimeField(default=None)
category_type = models.SmallIntegerField(default=0)
writer = models.SmallIntegerField(models.ForeignKey(Emp, related_name='+', 
on_delete=models.CASCADE), default=0)
nickname = models.CharField(max_length=50, default=None, null=True)

def __str__(self):
return self.category_name

def get_absolute_path(self):
return reverse('cat-det', args=[self.id])


class SubCat(models.Model):
category = models.ForeignKey(Category, related_name='+', 
on_delete=models.CASCADE)
subcat = models.CharField(max_length=200, default=None)
scope_users = models.CharField(max_length=200, default=None, null=True)
scope_loc_reg = models.CharField(max_length=200, default=None, null=True)
is_featured = models.BooleanField(default=False)
date_entered = models.DateTimeField(auto_now_add=True)

def __str__(self):
return self.subcat

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f0f1bad-1389-4a66-93fb-9f7a301dc936n%40googlegroups.com.


Fwd: Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Parul.
-- Forwarded message -
From: Parul. 
Date: Wed, Jun 23, 2021, 11:34 PM
Subject: Error while creating an ecommerce website :PLEASE HELP!
To: 


Hi,
I am working on an ecommerce website. I am facing an error. Can anyone
please help me solve this error.
I am not able to fetch the PRODUCT_ID

1. views.py (APP-CART)
---
from django.shortcuts import render,redirect
from .models import Cart
from new_app.models import Product

# Create your views here.


def cart_home(request):

cart_obj,new_obj=Cart.objects.new_or_get(request)
products=Cart.objects.all()



return render(request,'carts/home.html',{})


def cart_update(request):
print(request.POST)
# print(dict(request.POST.items()))
# print("in func")

product_id=1
print('id below')
print(product_id) // not able to get the value of product id in
console
product_obj=Product.objects.get(id=product_id)
cart_obj,new_obj=Cart.objects.new_or_get(request)
if product_obj in cart_obj.products.all():
cart_obj.products.remove(product_obj)
else:
cart_obj.products.add(product_obj)
return redirect('home')




2. models.py  (cart)


from django.db import models
from django.conf import settings
from new_app.models import Product
from django.db.models.signals import pre_save,post_save,m2m_changed



User=settings.AUTH_USER_MODEL

class CartManager(models.Manager):
def new_or_get(self,request):
cart_id=request.session.get("cart_id",None)
# qs=self.get_queryset().filter(id=cart_id)
qs=self.get_queryset().only('products')

print(qs)
if qs.count()==1:
new_obj=False
cart_obj=qs.first()
print('cart obj below')
print(cart_obj)
if request.user.is_authenticated and cart_obj.user is None:

cart_obj.user=request.user
cart_obj.save()


else:
cart_obj=Cart.objects.new_cart(user=request.user)
new_obj=True
request.session['cart_id']=cart_obj.id
return cart_obj,new_obj

def new_cart(self,user=None):
user_obj=None
if user is not None:
if user.is_authenticated:
user_obj=user
return self.model.objects.create(user=user_obj)

class Cart(models.Model):

user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
products=models.ManyToManyField(Product,blank=True)

subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)

total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
timestamp=models.DateTimeField(auto_now_add=True)
updated=models.DateTimeField(auto_now=True)

objects=CartManager()

def __str__(self):
return str(self.id)


def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
print(action)
if action=='post_add' or action=='post_remove' or action=='clear':
products=instance.products.all()
total=0
for x in products:
total += x.price
if instance.subtotal != total:
instance.subtotal=total
instance.save()
m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)


def pre_save_cart_receiver(sender,instance,*args,**kwargs):
if instance.subtotal>0:
instance.total=instance.subtotal + 10
else:
instance.total=0.00

pre_save.connect(pre_save_cart_receiver,sender=Cart)




OUTPUT IN CONSOLE:

  GETTING EMPTY DICTIONARY  INSTEAD OF GETTING PRODUCT
ID i.e. 1
id below
1
]>


So, I am unable to fetch the productc id there besides the csrf
i tried to individually print the product id.. which came as 1...(written
under"id below" in output)

Can anyone pls help me with this.




Also, adding update_cart.html
{% csrf_token
%}
  
  {% if product in cart.products.all %}
  remove
  {% else %}
  add to cart
  {% endif %}

  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHjHRFqpGEcZj6-Enq_uwZJRbKZRVwJEti9BfKBwg%2Bv%3Dkr4kjA%40mail.gmail.com.


Re: Partner

2021-06-23 Thread DJANGO DEVELOPER
Hi Erick!
I am a python/Django developer and use it for many projects and I would
love to have a meeting with you to discuss the projects.
Regards:
Muhammad Abubakar

On Thu, Jun 24, 2021 at 4:12 AM Natalie Smyth 
wrote:

> Dear Erick,
>
> My name is Natalie, I am a full stack web developer and I would love to
> work with you on some projects!
>
> I love the Django framework, have used it a lot, and am very familiar with
> DRF and using restful routes in general.
>
> Best,
> Natalie
>
>
>
> On Wed, Jun 23, 2021 at 11:18 AM ...@gmail.com 
> wrote:
>
>> hello guys am looking for any one good at Django and DRF i have couple of
>> personal projects which needs this tech spec am not good at them if any one
>> is interested plz i will be grateful
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMFvn%2B1Y3WinwDa412csDfb%3DPn7E0WCyyZrq%3D71b3zgyi8n-9g%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pm1YK45ShVuaqbTkZN8zciDNga%3DU9vP-ro%3DOzE0YyVM8A%40mail.gmail.com.


Re: How to insert into multiple tables cascading

2021-06-23 Thread DJANGO DEVELOPER
https://docs.djangoproject.com/en/3.2/topics/forms/modelforms/
read this official doc of django. all is written about modelformset and
inlineformset_factory.

On Thu, Jun 24, 2021 at 6:35 AM DJANGO DEVELOPER 
wrote:

> have you tried to implement the inlineformset_factory function within your
> views? if not then give a try to  inlineformset_factory. because through
> inlineformset_factory you can populate data of different models through a
> single form. for now it looks a solution to me.
>
> On Wed, Jun 23, 2021 at 6:35 PM David Crandell 
> wrote:
>
>> Sorry customer is inherited from these types
>>
>> class BaseInfo(models.Model):
>> contact1_first_name = models.CharField(help_text='Primary Contact First
>> name', max_length=50, default=None)
>> contact1_last_name = models.CharField(help_text='Primary Contact Last
>> name', max_length=50, default=None)
>> address1 = models.CharField(help_text='Address 1', max_length=50,
>> default=None)
>> address2 = models.CharField(help_text='Address 2', max_length=50,
>> default=None, blank=True)
>> city = models.CharField(help_text='City', max_length=50, default=None)
>> state = models.CharField(help_text='State', max_length=50, default=None)
>> zip_code = models.CharField(help_text='Postal/ZIP', max_length=20,
>> default=None)
>> phone = models.CharField(help_text='Phone', max_length=20, default=None)
>> email = models.EmailField(default=None)
>>
>>
>> class Prospects(BaseInfo):
>> associations = models.CharField(max_length=200, default=None, null=True,
>> blank=True)
>> company_name = models.CharField(help_text='Company Name', max_length=200,
>> default=None)
>> contact2_first_name = models.CharField(max_length=50, null=True,
>> blank=True)
>> contact2_last_name = models.CharField(max_length=50, null=True,
>> blank=True)
>> contact2_phone = models.CharField(help_text='Phone', max_length=20,
>> default=None, null=True, blank=True)
>> contact2_email = models.EmailField(default=None, null=True, blank=True)
>> fax = models.CharField(max_length=20, null=True, blank=True)
>> mobile = models.CharField(max_length=50, default=None, blank=True,
>> null=True)
>> web_address = models.CharField(max_length=50, null=True, blank=True)
>> date_entered = models.DateTimeField(auto_now_add=True)
>> is_active = models.BooleanField(default=True)
>> date_turned_off = models.DateTimeField(default=None, null=True,
>> blank=True)
>> notes = models.TextField(help_text='Notes', null=True, blank=True,
>> default=None)
>>
>> On Wednesday, June 23, 2021 at 8:34:07 AM UTC-5 David Crandell wrote:
>>
>>> Thank you for your reply.
>>>
>>> here are my models. Forms below.
>>>
>>> MODELS
>>>
>>> class Customers(Prospects):
>>> cust_id = models.IntegerField(default=0)
>>> vertical_cat = models.IntegerField(default=0)
>>> custom_cat = models.IntegerField(default=0)
>>> logo = models.ImageField(default='default.png',
>>> upload_to='media/cust-logos/')
>>> max_scripts = models.IntegerField(default=0)
>>> branch_custom_scripts = models.BooleanField(default=False)
>>> receive_emails = models.BooleanField(default=True)
>>> customer_rep_id = models.SmallIntegerField(default=0)
>>> customer_writer_id = models.SmallIntegerField(default=0)
>>> customer_male_vt_id = models.SmallIntegerField(default=0)
>>> customer_fem_vt = models.SmallIntegerField(default=0)
>>> customer_sales_rep = models.SmallIntegerField(default=0)
>>> contract_date_first = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> contract_date_renewal = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> contract_billing_type = models.CharField(max_length=200, null=True,
>>> blank=True)
>>> anniversary = models.DateTimeField(default=None, null=True, blank=True)
>>> is_on_contract = models.BooleanField(default=False)
>>> internal_flag = models.IntegerField(default=0)
>>> shuff_freq_pref = models.SmallIntegerField(default=0)
>>> shuff_freq_upd = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> shuff_freq_7 = models.BooleanField(default=True)
>>> shuff_freq_14 = models.BooleanField(default=True)
>>> shuff_freq_30 = models.BooleanField(default=True)
>>> shuff_freq_60 = models.BooleanField(default=True)
>>> shuff_freq_90 = models.BooleanField(default=True)
>>> shuff_freq_180 = models.BooleanField(default=False)
>>> shuff_walk_thru = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp,
>>> on_delete=models.CASCADE), default=0)
>>> cust_classification = models.ForeignKey(CustomerClasses,
>>> on_delete=models.CASCADE)
>>> date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
>>> updated_by = models.SmallIntegerField(default=0)
>>> audit_note = models.TextField(default=None, null=True, blank=True)
>>> audit_exception = models.BooleanField(default=False)
>>> audit_date = models.DateTimeField(auto_now_add=True)
>>> script_exception = models.BooleanField(default=False)
>>> script_exception_date = 

Re: Specifying a database connection for ManyToMany add()

2021-06-23 Thread Mike Dewhirst

On 23/06/2021 7:18 pm, Jayanth Shankar wrote:


Hi,

I am trying to add items to a ManyToMany relationship, but I would 
like to make the operation use a particular database connection, like 
one might do when calling save() on a model instance. However, looking 
at the source for ManyToMany.add(), the function defaults to checking 
the router's for_write connection.


class B(models.Model):
...

class A(models.Model):
b = models.ManyToManyField(B)
...

ideally, I would like to modify the many to many field as follows...
a = A(id=0)
for b in B.objects.all():
    a.b.add(b, using="aconnection")

but this does not work. As far Is there an alternative way to insert 
an object into the ManyToMany relationship(where a db alias can be 
specified) besides add?


Not sure I understand what you are trying to do but it is possible to 
manage the many-to-many yourself. Django makes a table to connect A and 
B without your needing to specify it as a model.


If you write a model to represent that table you can add other fields to 
it and use its save() method to perform all sorts of magic.


For example, I have chemicals and products.

class Chemical(models.Model):

    products = models.ManyToManyField(

    "Product",

    blank=True,

    through="ChemicalProducts",

    through_fields=("chemical", "product"),

    related_name="products",

    )


class ChemicalProducts(models.Model):

    chemical = models.ForeignKey(

    "Chemical",

    on_delete=models.CASCADE,

    related_name="base_chemical",

    null=True,

    blank=True,

    )

    product = models.ForeignKey(

    "Product",

 on_delete=models.CASCADE,

    null=True,

    blank=True,

    )

    # other fields and methods follow here

If I did not write the ChemicalProducts model, Django would make it 
anyway. But because I have named the through table and it exists Django 
doesn't bother.


This means I can write queries which insert m2m connections without 
using 'add'.


However, I don't know because I haven't looked at the docs or the Django 
source, whether you can use a callable for the 'through' table or even 
specify the db_alias for it. I have only ever used the default myself.


HTH

Mike






--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a49409db-5b9a-48cd-818f-6645caa184e9n%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0e161c3e-9c55-450b-e289-644e9fcfcfd4%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: How to insert into multiple tables cascading

2021-06-23 Thread David Crandell
Thank you my friend. I will give this a try.

David L. Crandell
469-585-5009
g uitard...@outlook.com
guitardave8...@gmail.com
da...@onholdwizard.com



On Wed, Jun 23, 2021 at 8:36 PM DJANGO DEVELOPER 
wrote:

> have you tried to implement the inlineformset_factory function within your
> views? if not then give a try to  inlineformset_factory. because through
> inlineformset_factory you can populate data of different models through a
> single form. for now it looks a solution to me.
>
> On Wed, Jun 23, 2021 at 6:35 PM David Crandell 
> wrote:
>
>> Sorry customer is inherited from these types
>>
>> class BaseInfo(models.Model):
>> contact1_first_name = models.CharField(help_text='Primary Contact First
>> name', max_length=50, default=None)
>> contact1_last_name = models.CharField(help_text='Primary Contact Last
>> name', max_length=50, default=None)
>> address1 = models.CharField(help_text='Address 1', max_length=50,
>> default=None)
>> address2 = models.CharField(help_text='Address 2', max_length=50,
>> default=None, blank=True)
>> city = models.CharField(help_text='City', max_length=50, default=None)
>> state = models.CharField(help_text='State', max_length=50, default=None)
>> zip_code = models.CharField(help_text='Postal/ZIP', max_length=20,
>> default=None)
>> phone = models.CharField(help_text='Phone', max_length=20, default=None)
>> email = models.EmailField(default=None)
>>
>>
>> class Prospects(BaseInfo):
>> associations = models.CharField(max_length=200, default=None, null=True,
>> blank=True)
>> company_name = models.CharField(help_text='Company Name', max_length=200,
>> default=None)
>> contact2_first_name = models.CharField(max_length=50, null=True,
>> blank=True)
>> contact2_last_name = models.CharField(max_length=50, null=True,
>> blank=True)
>> contact2_phone = models.CharField(help_text='Phone', max_length=20,
>> default=None, null=True, blank=True)
>> contact2_email = models.EmailField(default=None, null=True, blank=True)
>> fax = models.CharField(max_length=20, null=True, blank=True)
>> mobile = models.CharField(max_length=50, default=None, blank=True,
>> null=True)
>> web_address = models.CharField(max_length=50, null=True, blank=True)
>> date_entered = models.DateTimeField(auto_now_add=True)
>> is_active = models.BooleanField(default=True)
>> date_turned_off = models.DateTimeField(default=None, null=True,
>> blank=True)
>> notes = models.TextField(help_text='Notes', null=True, blank=True,
>> default=None)
>>
>> On Wednesday, June 23, 2021 at 8:34:07 AM UTC-5 David Crandell wrote:
>>
>>> Thank you for your reply.
>>>
>>> here are my models. Forms below.
>>>
>>> MODELS
>>>
>>> class Customers(Prospects):
>>> cust_id = models.IntegerField(default=0)
>>> vertical_cat = models.IntegerField(default=0)
>>> custom_cat = models.IntegerField(default=0)
>>> logo = models.ImageField(default='default.png',
>>> upload_to='media/cust-logos/')
>>> max_scripts = models.IntegerField(default=0)
>>> branch_custom_scripts = models.BooleanField(default=False)
>>> receive_emails = models.BooleanField(default=True)
>>> customer_rep_id = models.SmallIntegerField(default=0)
>>> customer_writer_id = models.SmallIntegerField(default=0)
>>> customer_male_vt_id = models.SmallIntegerField(default=0)
>>> customer_fem_vt = models.SmallIntegerField(default=0)
>>> customer_sales_rep = models.SmallIntegerField(default=0)
>>> contract_date_first = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> contract_date_renewal = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> contract_billing_type = models.CharField(max_length=200, null=True,
>>> blank=True)
>>> anniversary = models.DateTimeField(default=None, null=True, blank=True)
>>> is_on_contract = models.BooleanField(default=False)
>>> internal_flag = models.IntegerField(default=0)
>>> shuff_freq_pref = models.SmallIntegerField(default=0)
>>> shuff_freq_upd = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> shuff_freq_7 = models.BooleanField(default=True)
>>> shuff_freq_14 = models.BooleanField(default=True)
>>> shuff_freq_30 = models.BooleanField(default=True)
>>> shuff_freq_60 = models.BooleanField(default=True)
>>> shuff_freq_90 = models.BooleanField(default=True)
>>> shuff_freq_180 = models.BooleanField(default=False)
>>> shuff_walk_thru = models.DateTimeField(default=None, null=True,
>>> blank=True)
>>> shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp,
>>> on_delete=models.CASCADE), default=0)
>>> cust_classification = models.ForeignKey(CustomerClasses,
>>> on_delete=models.CASCADE)
>>> date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
>>> updated_by = models.SmallIntegerField(default=0)
>>> audit_note = models.TextField(default=None, null=True, blank=True)
>>> audit_exception = models.BooleanField(default=False)
>>> audit_date = models.DateTimeField(auto_now_add=True)
>>> script_exception = models.BooleanField(default=False)
>>> script_exception_date = 

Is the document not consistent for related_name?

2021-06-23 Thread ihc...@gmail.com
`%(model_name)s` is recommended in the document default_related_name 

 
but `%(class)s ` is recommended in the document Be careful with 
related_name and related_query_name 

.

Is the document not consistent for related_name? Althought both are worked.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3a4a59b4-3c52-43ac-8fd8-3b161815cb84n%40googlegroups.com.


Re: How to insert into multiple tables cascading

2021-06-23 Thread DJANGO DEVELOPER
have you tried to implement the inlineformset_factory function within your
views? if not then give a try to  inlineformset_factory. because through
inlineformset_factory you can populate data of different models through a
single form. for now it looks a solution to me.

On Wed, Jun 23, 2021 at 6:35 PM David Crandell 
wrote:

> Sorry customer is inherited from these types
>
> class BaseInfo(models.Model):
> contact1_first_name = models.CharField(help_text='Primary Contact First
> name', max_length=50, default=None)
> contact1_last_name = models.CharField(help_text='Primary Contact Last
> name', max_length=50, default=None)
> address1 = models.CharField(help_text='Address 1', max_length=50,
> default=None)
> address2 = models.CharField(help_text='Address 2', max_length=50,
> default=None, blank=True)
> city = models.CharField(help_text='City', max_length=50, default=None)
> state = models.CharField(help_text='State', max_length=50, default=None)
> zip_code = models.CharField(help_text='Postal/ZIP', max_length=20,
> default=None)
> phone = models.CharField(help_text='Phone', max_length=20, default=None)
> email = models.EmailField(default=None)
>
>
> class Prospects(BaseInfo):
> associations = models.CharField(max_length=200, default=None, null=True,
> blank=True)
> company_name = models.CharField(help_text='Company Name', max_length=200,
> default=None)
> contact2_first_name = models.CharField(max_length=50, null=True,
> blank=True)
> contact2_last_name = models.CharField(max_length=50, null=True, blank=True)
> contact2_phone = models.CharField(help_text='Phone', max_length=20,
> default=None, null=True, blank=True)
> contact2_email = models.EmailField(default=None, null=True, blank=True)
> fax = models.CharField(max_length=20, null=True, blank=True)
> mobile = models.CharField(max_length=50, default=None, blank=True,
> null=True)
> web_address = models.CharField(max_length=50, null=True, blank=True)
> date_entered = models.DateTimeField(auto_now_add=True)
> is_active = models.BooleanField(default=True)
> date_turned_off = models.DateTimeField(default=None, null=True, blank=True)
> notes = models.TextField(help_text='Notes', null=True, blank=True,
> default=None)
>
> On Wednesday, June 23, 2021 at 8:34:07 AM UTC-5 David Crandell wrote:
>
>> Thank you for your reply.
>>
>> here are my models. Forms below.
>>
>> MODELS
>>
>> class Customers(Prospects):
>> cust_id = models.IntegerField(default=0)
>> vertical_cat = models.IntegerField(default=0)
>> custom_cat = models.IntegerField(default=0)
>> logo = models.ImageField(default='default.png',
>> upload_to='media/cust-logos/')
>> max_scripts = models.IntegerField(default=0)
>> branch_custom_scripts = models.BooleanField(default=False)
>> receive_emails = models.BooleanField(default=True)
>> customer_rep_id = models.SmallIntegerField(default=0)
>> customer_writer_id = models.SmallIntegerField(default=0)
>> customer_male_vt_id = models.SmallIntegerField(default=0)
>> customer_fem_vt = models.SmallIntegerField(default=0)
>> customer_sales_rep = models.SmallIntegerField(default=0)
>> contract_date_first = models.DateTimeField(default=None, null=True,
>> blank=True)
>> contract_date_renewal = models.DateTimeField(default=None, null=True,
>> blank=True)
>> contract_billing_type = models.CharField(max_length=200, null=True,
>> blank=True)
>> anniversary = models.DateTimeField(default=None, null=True, blank=True)
>> is_on_contract = models.BooleanField(default=False)
>> internal_flag = models.IntegerField(default=0)
>> shuff_freq_pref = models.SmallIntegerField(default=0)
>> shuff_freq_upd = models.DateTimeField(default=None, null=True, blank=True)
>> shuff_freq_7 = models.BooleanField(default=True)
>> shuff_freq_14 = models.BooleanField(default=True)
>> shuff_freq_30 = models.BooleanField(default=True)
>> shuff_freq_60 = models.BooleanField(default=True)
>> shuff_freq_90 = models.BooleanField(default=True)
>> shuff_freq_180 = models.BooleanField(default=False)
>> shuff_walk_thru = models.DateTimeField(default=None, null=True,
>> blank=True)
>> shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp,
>> on_delete=models.CASCADE), default=0)
>> cust_classification = models.ForeignKey(CustomerClasses,
>> on_delete=models.CASCADE)
>> date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
>> updated_by = models.SmallIntegerField(default=0)
>> audit_note = models.TextField(default=None, null=True, blank=True)
>> audit_exception = models.BooleanField(default=False)
>> audit_date = models.DateTimeField(auto_now_add=True)
>> script_exception = models.BooleanField(default=False)
>> script_exception_date = models.DateTimeField(default=None, null=True,
>> blank=True)
>> reports_exception = models.BooleanField(default=False)
>> reports_exception_date = models.DateTimeField(default=None, null=True,
>> blank=True)
>> using_script_credits = models.BooleanField(default=False)
>>
>> def __str__(self):
>> return self.company_name
>>
>> def 

Re: Partner

2021-06-23 Thread Natalie Smyth
Dear Erick,

My name is Natalie, I am a full stack web developer and I would love to
work with you on some projects!

I love the Django framework, have used it a lot, and am very familiar with
DRF and using restful routes in general.

Best,
Natalie



On Wed, Jun 23, 2021 at 11:18 AM ...@gmail.com 
wrote:

> hello guys am looking for any one good at Django and DRF i have couple of
> personal projects which needs this tech spec am not good at them if any one
> is interested plz i will be grateful
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMFvn%2B1Y3WinwDa412csDfb%3DPn7E0WCyyZrq%3D71b3zgyi8n-9g%40mail.gmail.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Eugene TUYIZERE
Dear Jolio,

can you send me step by step to host to DigitalOcean?

regards,

On Wed, 23 Jun 2021 at 20:52, Julio Cojom  wrote:

> cPanel it's a pain to deploy python applications, better change to a vps
> with digitalocean or something similar.
>
>
>
> El mié., 23 de junio de 2021 11:37 a. m., Franck Tchouanga <
> ftchoua...@gmail.com> escribió:
>
>> I see.
>>
>> On Wed, Jun 23, 2021, 11:38 AM Eugene TUYIZERE 
>> wrote:
>>
>>> Dear Franck,
>>>
>>> The problem I have now is to configure the django app in cpanel so that
>>> users can browse it. As I said in previous email, I already have domain and
>>> cpanel credentials.
>>>
>>> On Wed, 23 Jun 2021 at 12:17, Franck Tchouanga 
>>> wrote:
>>>
 Hello I can assist you what is the problem.


 On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE <
 eugenetuyiz...@gmail.com> wrote:

> please assist
>
> On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE <
> eugenetuyiz...@gmail.com> wrote:
>
>> Dear Team,
>>
>> I have an issue. I want to make my app productive. I bought a domain
>> and I got cpanel credentials. The problem I have now is that I do not 
>> know
>> how I can configure the app in cpanel so that users can start browsing 
>> it.
>> I tried to connect to the database and I loaded the application files. Is
>> there someone who can tell me all the steps I need to follow to make the
>> app accessible? for what I have done, I am getting this error message 
>> when
>> browsing:
>> [image: image.png]
>>
>> Please assist
>>
>> --
>> *Eugene*
>>
>>
>>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
> 
> .
>


 --
 Best Wishes

 *Mr Tchouanga*

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com
 
 .

>>>
>>>
>>> --
>>> *TUYIZERE Eugene*
>>>
>>>
>>>
>>> *Msc Degree in Mathematical Science*
>>>
>>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>>> Garden-Lime, Cameroon*
>>>
>>> Bsc in Computer Science
>>>
>>> *UR-Nyagatare Campus*
>>>
>>> Email: eugene.tuyiz...@aims-cameroon.org
>>>eugenetuyiz...@gmail.com
>>>
>>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABxpZHs4G05MtjQOyfrf2H4ZQfCWS63oxG4hFYXpCx4VYTzrpg%40mail.gmail.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANRJ%3D3nu5HTfT4b0cqJACAwHsFCWTuS-Pz_H2vZz4t4jtNCs%2Bg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To 

Re: Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Parul.
Hi,
I tried to pass the id..but its not working
I observed while debugging, the try catch block is not getting
implemented... i tried to put some print statements there..but they are not
getting printed
The print statements in models.py -- new_or_get func()  are working

On Thu, Jun 24, 2021 at 12:08 AM Aadil Rashid 
wrote:

> First pass Id as an argument along with request to that particular view
> function
>
> On Thu, 24 Jun, 2021, 12:06 AM Parul.,  wrote:
>
>> Hi ,
>>
>> I am doing : product_obj=Product.objects.get(id=product_id)
>> in the cart_update function in views.py
>>
>> but when trying to print this object... i am not getting anything... is
>> this function is not working?
>>
>>
>> On Wed, Jun 23, 2021 at 11:38 PM Aadil Rashid 
>> wrote:
>>
>>> Pass I'd to the view you are you are using,
>>> And then get products thrid that I'd by simple ORM quriy
>>>
>>> Product = model name.objects.get(id=id)
>>>
>>> On Wed, 23 Jun, 2021, 11:35 PM Parul.,  wrote:
>>>
 Hi,
 I am working on an ecommerce website. I am facing an error. Can anyone
 please help me solve this error.
 I am not able to fetch the PRODUCT_ID

 1. views.py (APP-CART)

 ---
 from django.shortcuts import render,redirect
 from .models import Cart
 from new_app.models import Product

 # Create your views here.


 def cart_home(request):

 cart_obj,new_obj=Cart.objects.new_or_get(request)
 products=Cart.objects.all()



 return render(request,'carts/home.html',{})


 def cart_update(request):
 print(request.POST)
 # print(dict(request.POST.items()))
 # print("in func")

 product_id=1
 print('id below')
 print(product_id) // not able to get the value of product id in
 console
 product_obj=Product.objects.get(id=product_id)
 cart_obj,new_obj=Cart.objects.new_or_get(request)
 if product_obj in cart_obj.products.all():
 cart_obj.products.remove(product_obj)
 else:
 cart_obj.products.add(product_obj)
 return redirect('home')




 
 2. models.py  (cart)


 from django.db import models
 from django.conf import settings
 from new_app.models import Product
 from django.db.models.signals import pre_save,post_save,m2m_changed



 User=settings.AUTH_USER_MODEL

 class CartManager(models.Manager):
 def new_or_get(self,request):
 cart_id=request.session.get("cart_id",None)
 # qs=self.get_queryset().filter(id=cart_id)
 qs=self.get_queryset().only('products')

 print(qs)
 if qs.count()==1:
 new_obj=False
 cart_obj=qs.first()
 print('cart obj below')
 print(cart_obj)
 if request.user.is_authenticated and cart_obj.user is
 None:

 cart_obj.user=request.user
 cart_obj.save()


 else:
 cart_obj=Cart.objects.new_cart(user=request.user)
 new_obj=True
 request.session['cart_id']=cart_obj.id
 return cart_obj,new_obj

 def new_cart(self,user=None):
 user_obj=None
 if user is not None:
 if user.is_authenticated:
 user_obj=user
 return self.model.objects.create(user=user_obj)

 class Cart(models.Model):

 user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
 products=models.ManyToManyField(Product,blank=True)

 subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)


 total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
 timestamp=models.DateTimeField(auto_now_add=True)
 updated=models.DateTimeField(auto_now=True)

 objects=CartManager()

 def __str__(self):
 return str(self.id)


 def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
 print(action)
 if action=='post_add' or action=='post_remove' or action=='clear':
 products=instance.products.all()
 total=0
 for x in products:
 total += x.price
 if instance.subtotal != total:
 instance.subtotal=total
 instance.save()

 m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)


 def pre_save_cart_receiver(sender,instance,*args,**kwargs):

Re: Deploy Django app using cpanel

2021-06-23 Thread Julio Cojom
cPanel it's a pain to deploy python applications, better change to a vps
with digitalocean or something similar.



El mié., 23 de junio de 2021 11:37 a. m., Franck Tchouanga <
ftchoua...@gmail.com> escribió:

> I see.
>
> On Wed, Jun 23, 2021, 11:38 AM Eugene TUYIZERE 
> wrote:
>
>> Dear Franck,
>>
>> The problem I have now is to configure the django app in cpanel so that
>> users can browse it. As I said in previous email, I already have domain and
>> cpanel credentials.
>>
>> On Wed, 23 Jun 2021 at 12:17, Franck Tchouanga 
>> wrote:
>>
>>> Hello I can assist you what is the problem.
>>>
>>>
>>> On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE <
>>> eugenetuyiz...@gmail.com> wrote:
>>>
 please assist

 On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
 wrote:

> Dear Team,
>
> I have an issue. I want to make my app productive. I bought a domain
> and I got cpanel credentials. The problem I have now is that I do not know
> how I can configure the app in cpanel so that users can start browsing it.
> I tried to connect to the database and I loaded the application files. Is
> there someone who can tell me all the steps I need to follow to make the
> app accessible? for what I have done, I am getting this error message when
> browsing:
> [image: image.png]
>
> Please assist
>
> --
> *Eugene*
>
>
>

 --
 *TUYIZERE Eugene*



 *Msc Degree in Mathematical Science*

 *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
 Garden-Lime, Cameroon*

 Bsc in Computer Science

 *UR-Nyagatare Campus*

 Email: eugene.tuyiz...@aims-cameroon.org
eugenetuyiz...@gmail.com

 Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
 
 .

>>>
>>>
>>> --
>>> Best Wishes
>>>
>>> *Mr Tchouanga*
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> *TUYIZERE Eugene*
>>
>>
>>
>> *Msc Degree in Mathematical Science*
>>
>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>> Garden-Lime, Cameroon*
>>
>> Bsc in Computer Science
>>
>> *UR-Nyagatare Campus*
>>
>> Email: eugene.tuyiz...@aims-cameroon.org
>>eugenetuyiz...@gmail.com
>>
>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABxpZHs4G05MtjQOyfrf2H4ZQfCWS63oxG4hFYXpCx4VYTzrpg%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANRJ%3D3nu5HTfT4b0cqJACAwHsFCWTuS-Pz_H2vZz4t4jtNCs%2Bg%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHRQUHnLX%2BArn1yW_dCfdVh3qyKKm4WLfc0D%3DYLsrB7jJ5g6Zg%40mail.gmail.com.


Re: Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Aadil Rashid
First pass Id as an argument along with request to that particular view
function

On Thu, 24 Jun, 2021, 12:06 AM Parul.,  wrote:

> Hi ,
>
> I am doing : product_obj=Product.objects.get(id=product_id)
> in the cart_update function in views.py
>
> but when trying to print this object... i am not getting anything... is
> this function is not working?
>
>
> On Wed, Jun 23, 2021 at 11:38 PM Aadil Rashid 
> wrote:
>
>> Pass I'd to the view you are you are using,
>> And then get products thrid that I'd by simple ORM quriy
>>
>> Product = model name.objects.get(id=id)
>>
>> On Wed, 23 Jun, 2021, 11:35 PM Parul.,  wrote:
>>
>>> Hi,
>>> I am working on an ecommerce website. I am facing an error. Can anyone
>>> please help me solve this error.
>>> I am not able to fetch the PRODUCT_ID
>>>
>>> 1. views.py (APP-CART)
>>>
>>> ---
>>> from django.shortcuts import render,redirect
>>> from .models import Cart
>>> from new_app.models import Product
>>>
>>> # Create your views here.
>>>
>>>
>>> def cart_home(request):
>>>
>>> cart_obj,new_obj=Cart.objects.new_or_get(request)
>>> products=Cart.objects.all()
>>>
>>>
>>>
>>> return render(request,'carts/home.html',{})
>>>
>>>
>>> def cart_update(request):
>>> print(request.POST)
>>> # print(dict(request.POST.items()))
>>> # print("in func")
>>>
>>> product_id=1
>>> print('id below')
>>> print(product_id) // not able to get the value of product id in
>>> console
>>> product_obj=Product.objects.get(id=product_id)
>>> cart_obj,new_obj=Cart.objects.new_or_get(request)
>>> if product_obj in cart_obj.products.all():
>>> cart_obj.products.remove(product_obj)
>>> else:
>>> cart_obj.products.add(product_obj)
>>> return redirect('home')
>>>
>>>
>>>
>>>
>>> 
>>> 2. models.py  (cart)
>>>
>>>
>>> from django.db import models
>>> from django.conf import settings
>>> from new_app.models import Product
>>> from django.db.models.signals import pre_save,post_save,m2m_changed
>>>
>>>
>>>
>>> User=settings.AUTH_USER_MODEL
>>>
>>> class CartManager(models.Manager):
>>> def new_or_get(self,request):
>>> cart_id=request.session.get("cart_id",None)
>>> # qs=self.get_queryset().filter(id=cart_id)
>>> qs=self.get_queryset().only('products')
>>>
>>> print(qs)
>>> if qs.count()==1:
>>> new_obj=False
>>> cart_obj=qs.first()
>>> print('cart obj below')
>>> print(cart_obj)
>>> if request.user.is_authenticated and cart_obj.user is
>>> None:
>>>
>>> cart_obj.user=request.user
>>> cart_obj.save()
>>>
>>>
>>> else:
>>> cart_obj=Cart.objects.new_cart(user=request.user)
>>> new_obj=True
>>> request.session['cart_id']=cart_obj.id
>>> return cart_obj,new_obj
>>>
>>> def new_cart(self,user=None):
>>> user_obj=None
>>> if user is not None:
>>> if user.is_authenticated:
>>> user_obj=user
>>> return self.model.objects.create(user=user_obj)
>>>
>>> class Cart(models.Model):
>>>
>>> user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
>>> products=models.ManyToManyField(Product,blank=True)
>>>
>>> subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
>>>
>>>
>>> total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
>>> timestamp=models.DateTimeField(auto_now_add=True)
>>> updated=models.DateTimeField(auto_now=True)
>>>
>>> objects=CartManager()
>>>
>>> def __str__(self):
>>> return str(self.id)
>>>
>>>
>>> def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
>>> print(action)
>>> if action=='post_add' or action=='post_remove' or action=='clear':
>>> products=instance.products.all()
>>> total=0
>>> for x in products:
>>> total += x.price
>>> if instance.subtotal != total:
>>> instance.subtotal=total
>>> instance.save()
>>>
>>> m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)
>>>
>>>
>>> def pre_save_cart_receiver(sender,instance,*args,**kwargs):
>>> if instance.subtotal>0:
>>> instance.total=instance.subtotal + 10
>>> else:
>>> instance.total=0.00
>>>
>>> pre_save.connect(pre_save_cart_receiver,sender=Cart)
>>>
>>>
>>>
>>>
>>> OUTPUT IN CONSOLE:
>>>
>>> >> ['FMk2gTq6XXxZ2HU40I6h4b3WtPl59Drf1urwUNufDZUeSFPMzGNwU4L1QuGCiCbB'],
>>> 'product_id':
>>>  ['']}>  GETTING EMPTY DICTIONARY  INSTEAD OF GETTING
>>> PRODUCT ID i.e. 1
>>> id below
>>> 1
>>> ]>
>>>
>>>
>>> So, I am unable to 

Re: Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Parul.
Hi ,

I am doing : product_obj=Product.objects.get(id=product_id)
in the cart_update function in views.py

but when trying to print this object... i am not getting anything... is
this function is not working?


On Wed, Jun 23, 2021 at 11:38 PM Aadil Rashid 
wrote:

> Pass I'd to the view you are you are using,
> And then get products thrid that I'd by simple ORM quriy
>
> Product = model name.objects.get(id=id)
>
> On Wed, 23 Jun, 2021, 11:35 PM Parul.,  wrote:
>
>> Hi,
>> I am working on an ecommerce website. I am facing an error. Can anyone
>> please help me solve this error.
>> I am not able to fetch the PRODUCT_ID
>>
>> 1. views.py (APP-CART)
>>
>> ---
>> from django.shortcuts import render,redirect
>> from .models import Cart
>> from new_app.models import Product
>>
>> # Create your views here.
>>
>>
>> def cart_home(request):
>>
>> cart_obj,new_obj=Cart.objects.new_or_get(request)
>> products=Cart.objects.all()
>>
>>
>>
>> return render(request,'carts/home.html',{})
>>
>>
>> def cart_update(request):
>> print(request.POST)
>> # print(dict(request.POST.items()))
>> # print("in func")
>>
>> product_id=1
>> print('id below')
>> print(product_id) // not able to get the value of product id in
>> console
>> product_obj=Product.objects.get(id=product_id)
>> cart_obj,new_obj=Cart.objects.new_or_get(request)
>> if product_obj in cart_obj.products.all():
>> cart_obj.products.remove(product_obj)
>> else:
>> cart_obj.products.add(product_obj)
>> return redirect('home')
>>
>>
>>
>>
>> 
>> 2. models.py  (cart)
>>
>>
>> from django.db import models
>> from django.conf import settings
>> from new_app.models import Product
>> from django.db.models.signals import pre_save,post_save,m2m_changed
>>
>>
>>
>> User=settings.AUTH_USER_MODEL
>>
>> class CartManager(models.Manager):
>> def new_or_get(self,request):
>> cart_id=request.session.get("cart_id",None)
>> # qs=self.get_queryset().filter(id=cart_id)
>> qs=self.get_queryset().only('products')
>>
>> print(qs)
>> if qs.count()==1:
>> new_obj=False
>> cart_obj=qs.first()
>> print('cart obj below')
>> print(cart_obj)
>> if request.user.is_authenticated and cart_obj.user is
>> None:
>>
>> cart_obj.user=request.user
>> cart_obj.save()
>>
>>
>> else:
>> cart_obj=Cart.objects.new_cart(user=request.user)
>> new_obj=True
>> request.session['cart_id']=cart_obj.id
>> return cart_obj,new_obj
>>
>> def new_cart(self,user=None):
>> user_obj=None
>> if user is not None:
>> if user.is_authenticated:
>> user_obj=user
>> return self.model.objects.create(user=user_obj)
>>
>> class Cart(models.Model):
>>
>> user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
>> products=models.ManyToManyField(Product,blank=True)
>>
>> subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
>>
>>
>> total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
>> timestamp=models.DateTimeField(auto_now_add=True)
>> updated=models.DateTimeField(auto_now=True)
>>
>> objects=CartManager()
>>
>> def __str__(self):
>> return str(self.id)
>>
>>
>> def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
>> print(action)
>> if action=='post_add' or action=='post_remove' or action=='clear':
>> products=instance.products.all()
>> total=0
>> for x in products:
>> total += x.price
>> if instance.subtotal != total:
>> instance.subtotal=total
>> instance.save()
>>
>> m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)
>>
>>
>> def pre_save_cart_receiver(sender,instance,*args,**kwargs):
>> if instance.subtotal>0:
>> instance.total=instance.subtotal + 10
>> else:
>> instance.total=0.00
>>
>> pre_save.connect(pre_save_cart_receiver,sender=Cart)
>>
>>
>>
>>
>> OUTPUT IN CONSOLE:
>>
>> > ['FMk2gTq6XXxZ2HU40I6h4b3WtPl59Drf1urwUNufDZUeSFPMzGNwU4L1QuGCiCbB'],
>> 'product_id':
>>  ['']}>  GETTING EMPTY DICTIONARY  INSTEAD OF GETTING PRODUCT
>> ID i.e. 1
>> id below
>> 1
>> ]>
>>
>>
>> So, I am unable to fetch the productc id there besides the csrf
>> i tried to individually print the product id.. which came as 1...(written
>> under"id below" in output)
>>
>> Can anyone pls help me with this.
>>
>>
>>
>>
>> Also, adding update_cart.html
>> {%
>> csrf_token %}
>>   
>>   {% if product in 

JavaScript

2021-06-23 Thread Tanni Seriki


I try to implement JavaScript on my Django project, but it's not working at
all.

In Mozilla Firefox it keep saying,
File failed to load with 
It's not a valid mime type...
Please help me out...


Or is there any way I can use Django to make add to cart functionality.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALWCJq15oPD%3D9ib-sVoA3jSM9-XoHxL4O_Q11YtubECUkG7s3A%40mail.gmail.com.


Re: Partner

2021-06-23 Thread Sri ram
Hello, I am interested and love to know more about this opportunity.

On Wed, Jun 23, 2021 at 8:48 PM ericki...@gmail.com 
wrote:

> hello guys am looking for any one good at Django and DRF i have couple of
> personal projects which needs this tech spec am not good at them if any one
> is interested plz i will be grateful
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%40googlegroups.com
> 
> .
>


-- 
Thanks & Regards


T.Sriram,
Mob:  9849828772

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOa4MY_6TxZd6YiWebCd91omGqBA4JH%2BXgvwHJkb1ryB07ZDkA%40mail.gmail.com.


Re: Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Aadil Rashid
Pass I'd to the view you are you are using,
And then get products thrid that I'd by simple ORM quriy

Product = model name.objects.get(id=id)

On Wed, 23 Jun, 2021, 11:35 PM Parul.,  wrote:

> Hi,
> I am working on an ecommerce website. I am facing an error. Can anyone
> please help me solve this error.
> I am not able to fetch the PRODUCT_ID
>
> 1. views.py (APP-CART)
>
> ---
> from django.shortcuts import render,redirect
> from .models import Cart
> from new_app.models import Product
>
> # Create your views here.
>
>
> def cart_home(request):
>
> cart_obj,new_obj=Cart.objects.new_or_get(request)
> products=Cart.objects.all()
>
>
>
> return render(request,'carts/home.html',{})
>
>
> def cart_update(request):
> print(request.POST)
> # print(dict(request.POST.items()))
> # print("in func")
>
> product_id=1
> print('id below')
> print(product_id) // not able to get the value of product id in
> console
> product_obj=Product.objects.get(id=product_id)
> cart_obj,new_obj=Cart.objects.new_or_get(request)
> if product_obj in cart_obj.products.all():
> cart_obj.products.remove(product_obj)
> else:
> cart_obj.products.add(product_obj)
> return redirect('home')
>
>
>
>
> 
> 2. models.py  (cart)
>
>
> from django.db import models
> from django.conf import settings
> from new_app.models import Product
> from django.db.models.signals import pre_save,post_save,m2m_changed
>
>
>
> User=settings.AUTH_USER_MODEL
>
> class CartManager(models.Manager):
> def new_or_get(self,request):
> cart_id=request.session.get("cart_id",None)
> # qs=self.get_queryset().filter(id=cart_id)
> qs=self.get_queryset().only('products')
>
> print(qs)
> if qs.count()==1:
> new_obj=False
> cart_obj=qs.first()
> print('cart obj below')
> print(cart_obj)
> if request.user.is_authenticated and cart_obj.user is None:
>
> cart_obj.user=request.user
> cart_obj.save()
>
>
> else:
> cart_obj=Cart.objects.new_cart(user=request.user)
> new_obj=True
> request.session['cart_id']=cart_obj.id
> return cart_obj,new_obj
>
> def new_cart(self,user=None):
> user_obj=None
> if user is not None:
> if user.is_authenticated:
> user_obj=user
> return self.model.objects.create(user=user_obj)
>
> class Cart(models.Model):
>
> user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
> products=models.ManyToManyField(Product,blank=True)
>
> subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
>
> total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
> timestamp=models.DateTimeField(auto_now_add=True)
> updated=models.DateTimeField(auto_now=True)
>
> objects=CartManager()
>
> def __str__(self):
> return str(self.id)
>
>
> def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
> print(action)
> if action=='post_add' or action=='post_remove' or action=='clear':
> products=instance.products.all()
> total=0
> for x in products:
> total += x.price
> if instance.subtotal != total:
> instance.subtotal=total
> instance.save()
> m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)
>
>
> def pre_save_cart_receiver(sender,instance,*args,**kwargs):
> if instance.subtotal>0:
> instance.total=instance.subtotal + 10
> else:
> instance.total=0.00
>
> pre_save.connect(pre_save_cart_receiver,sender=Cart)
>
>
>
>
> OUTPUT IN CONSOLE:
>
>  ['FMk2gTq6XXxZ2HU40I6h4b3WtPl59Drf1urwUNufDZUeSFPMzGNwU4L1QuGCiCbB'],
> 'product_id':
>  ['']}>  GETTING EMPTY DICTIONARY  INSTEAD OF GETTING PRODUCT
> ID i.e. 1
> id below
> 1
> ]>
>
>
> So, I am unable to fetch the productc id there besides the csrf
> i tried to individually print the product id.. which came as 1...(written
> under"id below" in output)
>
> Can anyone pls help me with this.
>
>
>
>
> Also, adding update_cart.html
> {% csrf_token
> %}
>   
>   {% if product in cart.products.all %}
>   remove
>   {% else %}
>   add to cart
>   {% endif %}
>
>   
>
>
>
>
>
> --
> 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 view this discussion on the web visit
> 

Error while creating an ecommerce website :PLEASE HELP!

2021-06-23 Thread Parul.
Hi,
I am working on an ecommerce website. I am facing an error. Can anyone
please help me solve this error.
I am not able to fetch the PRODUCT_ID

1. views.py (APP-CART)
---
from django.shortcuts import render,redirect
from .models import Cart
from new_app.models import Product

# Create your views here.


def cart_home(request):

cart_obj,new_obj=Cart.objects.new_or_get(request)
products=Cart.objects.all()



return render(request,'carts/home.html',{})


def cart_update(request):
print(request.POST)
# print(dict(request.POST.items()))
# print("in func")

product_id=1
print('id below')
print(product_id) // not able to get the value of product id in
console
product_obj=Product.objects.get(id=product_id)
cart_obj,new_obj=Cart.objects.new_or_get(request)
if product_obj in cart_obj.products.all():
cart_obj.products.remove(product_obj)
else:
cart_obj.products.add(product_obj)
return redirect('home')




2. models.py  (cart)


from django.db import models
from django.conf import settings
from new_app.models import Product
from django.db.models.signals import pre_save,post_save,m2m_changed



User=settings.AUTH_USER_MODEL

class CartManager(models.Manager):
def new_or_get(self,request):
cart_id=request.session.get("cart_id",None)
# qs=self.get_queryset().filter(id=cart_id)
qs=self.get_queryset().only('products')

print(qs)
if qs.count()==1:
new_obj=False
cart_obj=qs.first()
print('cart obj below')
print(cart_obj)
if request.user.is_authenticated and cart_obj.user is None:

cart_obj.user=request.user
cart_obj.save()


else:
cart_obj=Cart.objects.new_cart(user=request.user)
new_obj=True
request.session['cart_id']=cart_obj.id
return cart_obj,new_obj

def new_cart(self,user=None):
user_obj=None
if user is not None:
if user.is_authenticated:
user_obj=user
return self.model.objects.create(user=user_obj)

class Cart(models.Model):

user=models.ForeignKey(User,null=True,blank=True,on_delete=models.CASCADE)
products=models.ManyToManyField(Product,blank=True)

subtotal=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)

total=models.DecimalField(default=0.00,max_digits=100,decimal_places=2)
timestamp=models.DateTimeField(auto_now_add=True)
updated=models.DateTimeField(auto_now=True)

objects=CartManager()

def __str__(self):
return str(self.id)


def m2m_changed_cart_receiver(sender,instance,action,*args,**kwargs):
print(action)
if action=='post_add' or action=='post_remove' or action=='clear':
products=instance.products.all()
total=0
for x in products:
total += x.price
if instance.subtotal != total:
instance.subtotal=total
instance.save()
m2m_changed.connect(m2m_changed_cart_receiver,sender=Cart.products.through)


def pre_save_cart_receiver(sender,instance,*args,**kwargs):
if instance.subtotal>0:
instance.total=instance.subtotal + 10
else:
instance.total=0.00

pre_save.connect(pre_save_cart_receiver,sender=Cart)




OUTPUT IN CONSOLE:

  GETTING EMPTY DICTIONARY  INSTEAD OF GETTING PRODUCT
ID i.e. 1
id below
1
]>


So, I am unable to fetch the productc id there besides the csrf
i tried to individually print the product id.. which came as 1...(written
under"id below" in output)

Can anyone pls help me with this.




Also, adding update_cart.html
{% csrf_token
%}
  
  {% if product in cart.products.all %}
  remove
  {% else %}
  add to cart
  {% endif %}

  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHjHRFpf_EfU%3DSSFFTMOeb5JkuNKL%3DuSNVtp782A2r_R-M0_DA%40mail.gmail.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Franck Tchouanga
I see.

On Wed, Jun 23, 2021, 11:38 AM Eugene TUYIZERE 
wrote:

> Dear Franck,
>
> The problem I have now is to configure the django app in cpanel so that
> users can browse it. As I said in previous email, I already have domain and
> cpanel credentials.
>
> On Wed, 23 Jun 2021 at 12:17, Franck Tchouanga 
> wrote:
>
>> Hello I can assist you what is the problem.
>>
>>
>> On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE 
>> wrote:
>>
>>> please assist
>>>
>>> On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
>>> wrote:
>>>
 Dear Team,

 I have an issue. I want to make my app productive. I bought a domain
 and I got cpanel credentials. The problem I have now is that I do not know
 how I can configure the app in cpanel so that users can start browsing it.
 I tried to connect to the database and I loaded the application files. Is
 there someone who can tell me all the steps I need to follow to make the
 app accessible? for what I have done, I am getting this error message when
 browsing:
 [image: image.png]

 Please assist

 --
 *Eugene*



>>>
>>> --
>>> *TUYIZERE Eugene*
>>>
>>>
>>>
>>> *Msc Degree in Mathematical Science*
>>>
>>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>>> Garden-Lime, Cameroon*
>>>
>>> Bsc in Computer Science
>>>
>>> *UR-Nyagatare Campus*
>>>
>>> Email: eugene.tuyiz...@aims-cameroon.org
>>>eugenetuyiz...@gmail.com
>>>
>>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Best Wishes
>>
>> *Mr Tchouanga*
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHs4G05MtjQOyfrf2H4ZQfCWS63oxG4hFYXpCx4VYTzrpg%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANRJ%3D3nu5HTfT4b0cqJACAwHsFCWTuS-Pz_H2vZz4t4jtNCs%2Bg%40mail.gmail.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Kelvin Sajere
I have a feeling the hosting company might have some input on how django is
deployed on their shared Cpanel hosting, but in namecheap for instance, you
would have to make sure you have imported the application in your wsgi,
configured the media and static URLs and root to where you’d like them to
be, and made sure your application is running in your terminal by trying to
run python manage.py runserver, if there are any issues you’d know from
there, turn debug to true in your settings.py file to see whatever is
happening.

On Wed, Jun 23, 2021 at 11:38 Eugene TUYIZERE 
wrote:

> Dear Franck,
>
> The problem I have now is to configure the django app in cpanel so that
> users can browse it. As I said in previous email, I already have domain and
> cpanel credentials.
>
> On Wed, 23 Jun 2021 at 12:17, Franck Tchouanga 
> wrote:
>
>> Hello I can assist you what is the problem.
>>
>>
>> On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE 
>> wrote:
>>
>>> please assist
>>>
>>> On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
>>> wrote:
>>>
 Dear Team,

 I have an issue. I want to make my app productive. I bought a domain
 and I got cpanel credentials. The problem I have now is that I do not know
 how I can configure the app in cpanel so that users can start browsing it.
 I tried to connect to the database and I loaded the application files. Is
 there someone who can tell me all the steps I need to follow to make the
 app accessible? for what I have done, I am getting this error message when
 browsing:
 [image: image.png]

 Please assist

 --
 *Eugene*



>>>
>>> --
>>> *TUYIZERE Eugene*
>>>
>>>
>>>
>>> *Msc Degree in Mathematical Science*
>>>
>>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>>> Garden-Lime, Cameroon*
>>>
>>> Bsc in Computer Science
>>>
>>> *UR-Nyagatare Campus*
>>>
>>> Email: eugene.tuyiz...@aims-cameroon.org
>>>eugenetuyiz...@gmail.com
>>>
>>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Best Wishes
>>
>> *Mr Tchouanga*
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHs4G05MtjQOyfrf2H4ZQfCWS63oxG4hFYXpCx4VYTzrpg%40mail.gmail.com
> 
> .
>
-- 
KeLLs

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADYqDX2fDxnwTSrpQ64%3DPvif0TE-p85spXANu6R9Jur2M%3DnBaw%40mail.gmail.com.


Re: kindly i need a help

2021-06-23 Thread Kelvin Sajere
I see three errors in your views and templates. First, the kvc variable in
your view holds a list of all objects in your Aboutus table and all objects
in your Services table, and I don’t think that’s what you want.

If I understand what you want to achieve, then your view should look like
this.

def index(request):
Abt = Aboutus.objects.all()
service = Services.objects.all()
kvc = {“Abt” : Abt,
“service” : service}
return render(request, "index.html", kvc)

Then in your template, loop over Abt to get all about us objects, then over
services to get services objects. You can’t just call Abt or services cos
they are lists of objects.

On Wed, Jun 23, 2021 at 17:04 Richard Dushime 
wrote:

> i am making a website using  django  and postgresql the  when i made a
> migration and i created the tables then i i went  in the admin (django
> administration ) everything was okay  the user and the data i can add and
> manipulate all the data and get effect into the database  but  on my
> webpages i am not seeing anything it is deseapiring
>  this is my index.html file
>   
> 
>   
>
> 
>   {{Abt.name}}
>   {{Abt.desc}}
> 
>
> 
>   
> 
>   
> 
>   
>   
> 
>   {{Abt.title}}
>   
> {{Abt.desc2}}
>   
>   
> 
>  Ullamco laboris nisi ut aliquip ex ea commodo consequat.
> 
>  Duis aute irure dolor in reprehenderit in voluptate velit.
> 
>  Ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure 
> dolor in reprehenderit in voluptate trideta storacalaperda mastiro dolore eu 
> fugiat nulla pariatur.
> 
>   
>   
>
> Ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis 
> aute irure dolor in reprehenderit in voluptate
>
> velit esse cillum dolore eu fugiat nulla pariatur. Excepteur 
> sint occaecat cupidatat non proident, sunt in
> culpa qui officia deserunt mollit anim id est laborum
>   
> 
>   
> 
>
>   
> 
>
> 
> 
>   
>
> 
>   {{service.title}}
>   {{service.description}}
> 
>
> 
>   
> 
>   
>   {{service.name}}
>   {{service.description1}}
> 
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJCm56LnoLUsxp-NSZuopNchdG7wAd5UOHxdyfjsfCR7RmMD3w%40mail.gmail.com
> 
> .
>
-- 
KeLLs

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADYqDX0MZiC3s0TqwPEFeJr9EgxttiaY9b%2BkgNbrPeaLjP0RVw%40mail.gmail.com.


Re: Partner

2021-06-23 Thread Ogunsanya Opeyemi
Hi. I would like to join you. I have more experience in django

On Wednesday, June 23, 2021, Arthur Obo Nwakaji 
wrote:

> Hello, I am interested and love to know more about this opportunity. I am
> well experienced in Django and DRF.
>
> On Wed, 23 Jun 2021, 4:19 PM ericki...@gmail.com  wrote:
>
>> hello guys am looking for any one good at Django and DRF i have couple of
>> personal projects which needs this tech spec am not good at them if any one
>> is interested plz i will be grateful
>>
>> --
>> 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 view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%
>> 40googlegroups.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 view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAGOrV0c%2BfTqrvFdsPUXnbrYa27ZU8BppN%
> 3Dok2Dna%2Be8ky0Z9%3DA%40mail.gmail.com
> 
> .
>


-- 
null

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABJxPrGXu-%2B71mfsUchNugS2Kc9Y-hQzZCFnYss2u6u_AGyTww%40mail.gmail.com.


Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
Can you write the class based function of the above views.py. I'm unable to
do so. Will be of great help.


On Wed, 23 Jun 2021 at 21:54, Shailesh Yadav 
wrote:

> in Html code
>
> 
> {{items_filter.form}}
> 
>  Search
> 
> 
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 9:50 PM Shailesh Yadav <
> shaileshyadav7...@gmail.com> wrote:
>
>> Okay.
>> If you using the Django filter then, please try like below in your views..
>>
>> abc_list = ModelName.objects.all()
>> result_filter = ModelNameFilter(request.GET, queryset=abc_list)
>>
>> Thanks & Regards
>> Shailesh Yadav
>> +91-9920886044
>>
>>   [image: Linkedin] 
>>
>>
>>
>>
>> On Wed, Jun 23, 2021 at 9:13 PM Aritra Ray  wrote:
>>
>>> Sorry, it's not working. I tried items_filter.form but it didn't work.
>>> Kindly check my views.py if that'll be of any help or require any changes.
>>>
>>>
>>> On Wed, 23 Jun 2021 at 15:02, Shailesh Yadav <
>>> shaileshyadav7...@gmail.com> wrote:
>>>
 Okay use below in html
 {{yourmodelnameinsmall_filter.form}}

 Thanks & Regards
 Shailesh Yadav
 +91-9920886044

   [image: Linkedin]
 



 On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:

> This isn't working. When we are supplying a filter, the html is
> displaying all the products irrespective of the requested.
>
> On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
> shaileshyadav7...@gmail.com> wrote:
>
>> Can you help with what ERROR you are getting?
>>
>> Thanks & Regards
>> Shailesh Yadav
>> +91-9920886044
>>
>>   [image: Linkedin]
>> 
>>
>>
>>
>> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray 
>> wrote:
>>
>>> Hi,
>>> I've been trying to introduce a filter system in my Django-ecommerce
>>> website and I've been struggling despite reading the documents, etc. I 
>>> am
>>> using 'django-filter' and below are filters.py, models.py, views.py and 
>>> the
>>> template. To check out the project, follow the github link:
>>> https://github.com/First-project-01/Django-ecommerce.
>>>
>>> Will be grateful if anyone can sort this out. Thanks in advance.
>>> Regards,
>>> Aritra
>>>
>>> #filters.py
>>> class ProductFilter(django_filters.FilterSet):
>>> price = django_filters.NumberFilter()
>>> price__gt = django_filters.NumberFilter(field_name='price'
>>> , lookup_expr='gt')
>>> price__lt = django_filters.NumberFilter(field_name='price'
>>> , lookup_expr='lt')
>>> class Meta:
>>> model = Items
>>> fields = ['size', 'availability']
>>>
>>> #views.py
>>> class Product(ListView):
>>> model = Items
>>> paginate_by = 6
>>> template_name = 'products.html'
>>> def get_context_data(self, **kwargs):
>>> context = super(Product, self).get_context_data(**kwargs)
>>> context['filter'] = ProductFilter(self.request.GET, queryset
>>> =self.get_queryset())
>>> return context
>>> #models.py
>>> AVAILABILITY = (
>>> ('Y', 'Available'),
>>> ('N', 'Out of Stock'),
>>> )
>>>
>>> SIZES = (
>>> ('K', 'King - 108 x 120'),
>>> ('Q', 'Queen - 90 x 108')
>>> )
>>> class Items(BaseModel):
>>> title = models.CharField(max_length=100, null=True, blank=True)
>>> price = models.FloatField(null=True, blank=True)
>>> size = models.CharField(choices=SIZES, default=SIZES[0][0
>>> ], max_length=1)
>>> description = models.TextField(max_length=500)
>>> availability = models.CharField(choices=AVAILABILITY, default=
>>> AVAILABILITY[0][0], max_length=1)
>>> ...
>>>
>>> #product-list.html
>>> 
>>>  
>>> {{ filter.form| crispy }}
>>> Search
>>>  
>>> 
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop 

Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
Like this?

class Product(ListView):
model = Items.objects.all()
paginate_by = 6
template_name = 'products.html'
result_filter = ProductFilter(request.GET, queryset=model)

On Wed, 23 Jun 2021 at 21:51, Shailesh Yadav 
wrote:

> Okay.
> If you using the Django filter then, please try like below in your views..
>
> abc_list = ModelName.objects.all()
> result_filter = ModelNameFilter(request.GET, queryset=abc_list)
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 9:13 PM Aritra Ray  wrote:
>
>> Sorry, it's not working. I tried items_filter.form but it didn't work.
>> Kindly check my views.py if that'll be of any help or require any changes.
>>
>>
>> On Wed, 23 Jun 2021 at 15:02, Shailesh Yadav 
>> wrote:
>>
>>> Okay use below in html
>>> {{yourmodelnameinsmall_filter.form}}
>>>
>>> Thanks & Regards
>>> Shailesh Yadav
>>> +91-9920886044
>>>
>>>   [image: Linkedin]
>>> 
>>>
>>>
>>>
>>> On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:
>>>
 This isn't working. When we are supplying a filter, the html is
 displaying all the products irrespective of the requested.

 On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
 shaileshyadav7...@gmail.com> wrote:

> Can you help with what ERROR you are getting?
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin]
> 
>
>
>
> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray 
> wrote:
>
>> Hi,
>> I've been trying to introduce a filter system in my Django-ecommerce
>> website and I've been struggling despite reading the documents, etc. I am
>> using 'django-filter' and below are filters.py, models.py, views.py and 
>> the
>> template. To check out the project, follow the github link:
>> https://github.com/First-project-01/Django-ecommerce.
>>
>> Will be grateful if anyone can sort this out. Thanks in advance.
>> Regards,
>> Aritra
>>
>> #filters.py
>> class ProductFilter(django_filters.FilterSet):
>> price = django_filters.NumberFilter()
>> price__gt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='gt')
>> price__lt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='lt')
>> class Meta:
>> model = Items
>> fields = ['size', 'availability']
>>
>> #views.py
>> class Product(ListView):
>> model = Items
>> paginate_by = 6
>> template_name = 'products.html'
>> def get_context_data(self, **kwargs):
>> context = super(Product, self).get_context_data(**kwargs)
>> context['filter'] = ProductFilter(self.request.GET, queryset=
>> self.get_queryset())
>> return context
>> #models.py
>> AVAILABILITY = (
>> ('Y', 'Available'),
>> ('N', 'Out of Stock'),
>> )
>>
>> SIZES = (
>> ('K', 'King - 108 x 120'),
>> ('Q', 'Queen - 90 x 108')
>> )
>> class Items(BaseModel):
>> title = models.CharField(max_length=100, null=True, blank=True)
>> price = models.FloatField(null=True, blank=True)
>> size = models.CharField(choices=SIZES, default=SIZES[0][0
>> ], max_length=1)
>> description = models.TextField(max_length=500)
>> availability = models.CharField(choices=AVAILABILITY, default=
>> AVAILABILITY[0][0], max_length=1)
>> ...
>>
>> #product-list.html
>> 
>>  
>> {{ filter.form| crispy }}
>> Search
>>  
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.com
> 

Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Shailesh Yadav
in Html code


{{items_filter.form}}

 Search



Thanks & Regards
Shailesh Yadav
+91-9920886044

  [image: Linkedin] 



On Wed, Jun 23, 2021 at 9:50 PM Shailesh Yadav 
wrote:

> Okay.
> If you using the Django filter then, please try like below in your views..
>
> abc_list = ModelName.objects.all()
> result_filter = ModelNameFilter(request.GET, queryset=abc_list)
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 9:13 PM Aritra Ray  wrote:
>
>> Sorry, it's not working. I tried items_filter.form but it didn't work.
>> Kindly check my views.py if that'll be of any help or require any changes.
>>
>>
>> On Wed, 23 Jun 2021 at 15:02, Shailesh Yadav 
>> wrote:
>>
>>> Okay use below in html
>>> {{yourmodelnameinsmall_filter.form}}
>>>
>>> Thanks & Regards
>>> Shailesh Yadav
>>> +91-9920886044
>>>
>>>   [image: Linkedin]
>>> 
>>>
>>>
>>>
>>> On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:
>>>
 This isn't working. When we are supplying a filter, the html is
 displaying all the products irrespective of the requested.

 On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
 shaileshyadav7...@gmail.com> wrote:

> Can you help with what ERROR you are getting?
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin]
> 
>
>
>
> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray 
> wrote:
>
>> Hi,
>> I've been trying to introduce a filter system in my Django-ecommerce
>> website and I've been struggling despite reading the documents, etc. I am
>> using 'django-filter' and below are filters.py, models.py, views.py and 
>> the
>> template. To check out the project, follow the github link:
>> https://github.com/First-project-01/Django-ecommerce.
>>
>> Will be grateful if anyone can sort this out. Thanks in advance.
>> Regards,
>> Aritra
>>
>> #filters.py
>> class ProductFilter(django_filters.FilterSet):
>> price = django_filters.NumberFilter()
>> price__gt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='gt')
>> price__lt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='lt')
>> class Meta:
>> model = Items
>> fields = ['size', 'availability']
>>
>> #views.py
>> class Product(ListView):
>> model = Items
>> paginate_by = 6
>> template_name = 'products.html'
>> def get_context_data(self, **kwargs):
>> context = super(Product, self).get_context_data(**kwargs)
>> context['filter'] = ProductFilter(self.request.GET, queryset=
>> self.get_queryset())
>> return context
>> #models.py
>> AVAILABILITY = (
>> ('Y', 'Available'),
>> ('N', 'Out of Stock'),
>> )
>>
>> SIZES = (
>> ('K', 'King - 108 x 120'),
>> ('Q', 'Queen - 90 x 108')
>> )
>> class Items(BaseModel):
>> title = models.CharField(max_length=100, null=True, blank=True)
>> price = models.FloatField(null=True, blank=True)
>> size = models.CharField(choices=SIZES, default=SIZES[0][0
>> ], max_length=1)
>> description = models.TextField(max_length=500)
>> availability = models.CharField(choices=AVAILABILITY, default=
>> AVAILABILITY[0][0], max_length=1)
>> ...
>>
>> #product-list.html
>> 
>>  
>> {{ filter.form| crispy }}
>> Search
>>  
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.com
> 

Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Shailesh Yadav
Okay.
If you using the Django filter then, please try like below in your views..

abc_list = ModelName.objects.all()
result_filter = ModelNameFilter(request.GET, queryset=abc_list)

Thanks & Regards
Shailesh Yadav
+91-9920886044

  [image: Linkedin] 



On Wed, Jun 23, 2021 at 9:13 PM Aritra Ray  wrote:

> Sorry, it's not working. I tried items_filter.form but it didn't work.
> Kindly check my views.py if that'll be of any help or require any changes.
>
>
> On Wed, 23 Jun 2021 at 15:02, Shailesh Yadav 
> wrote:
>
>> Okay use below in html
>> {{yourmodelnameinsmall_filter.form}}
>>
>> Thanks & Regards
>> Shailesh Yadav
>> +91-9920886044
>>
>>   [image: Linkedin] 
>>
>>
>>
>>
>> On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:
>>
>>> This isn't working. When we are supplying a filter, the html is
>>> displaying all the products irrespective of the requested.
>>>
>>> On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
>>> shaileshyadav7...@gmail.com> wrote:
>>>
 Can you help with what ERROR you are getting?

 Thanks & Regards
 Shailesh Yadav
 +91-9920886044

   [image: Linkedin]
 



 On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:

> Hi,
> I've been trying to introduce a filter system in my Django-ecommerce
> website and I've been struggling despite reading the documents, etc. I am
> using 'django-filter' and below are filters.py, models.py, views.py and 
> the
> template. To check out the project, follow the github link:
> https://github.com/First-project-01/Django-ecommerce.
>
> Will be grateful if anyone can sort this out. Thanks in advance.
> Regards,
> Aritra
>
> #filters.py
> class ProductFilter(django_filters.FilterSet):
> price = django_filters.NumberFilter()
> price__gt = django_filters.NumberFilter(field_name='price'
> , lookup_expr='gt')
> price__lt = django_filters.NumberFilter(field_name='price'
> , lookup_expr='lt')
> class Meta:
> model = Items
> fields = ['size', 'availability']
>
> #views.py
> class Product(ListView):
> model = Items
> paginate_by = 6
> template_name = 'products.html'
> def get_context_data(self, **kwargs):
> context = super(Product, self).get_context_data(**kwargs)
> context['filter'] = ProductFilter(self.request.GET, queryset=
> self.get_queryset())
> return context
> #models.py
> AVAILABILITY = (
> ('Y', 'Available'),
> ('N', 'Out of Stock'),
> )
>
> SIZES = (
> ('K', 'King - 108 x 120'),
> ('Q', 'Queen - 90 x 108')
> )
> class Items(BaseModel):
> title = models.CharField(max_length=100, null=True, blank=True)
> price = models.FloatField(null=True, blank=True)
> size = models.CharField(choices=SIZES, default=SIZES[0][0
> ], max_length=1)
> description = models.TextField(max_length=500)
> availability = models.CharField(choices=AVAILABILITY, default=
> AVAILABILITY[0][0], max_length=1)
> ...
>
> #product-list.html
> 
>  
> {{ filter.form| crispy }}
> Search
>  
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.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 view this discussion on the web visit
>>> 

kindly i need a help

2021-06-23 Thread Richard Dushime
i am making a website using  django  and postgresql the  when i made a
migration and i created the tables then i i went  in the admin (django
administration ) everything was okay  the user and the data i can add and
manipulate all the data and get effect into the database  but  on my
webpages i am not seeing anything it is deseapiring
 this is my index.html file
  

  


  {{Abt.name}}
  {{Abt.desc}}



  

  

  
  

  {{Abt.title}}
  
{{Abt.desc2}}
  
  

 Ullamco laboris nisi ut aliquip ex ea commodo consequat.

 Duis aute irure dolor in reprehenderit in voluptate velit.

 Ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate trideta storacalaperda
mastiro dolore eu fugiat nulla pariatur.

  
  
Ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum
  

  


  




  


  {{service.title}}
  {{service.description}}



  

  
  {{service.name}}
  {{service.description1}}


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJCm56LnoLUsxp-NSZuopNchdG7wAd5UOHxdyfjsfCR7RmMD3w%40mail.gmail.com.
from django.contrib import admin
from .models import Aboutus,Services

# Register your models here.
admin.site.register(Aboutus)
admin.site.register(Services)from os import name
from django.db import models

# Create your models here.

class Aboutus(models.Model):
name = models.CharField(max_length=100)
desc = models.TextField()
img = models.ImageField(upload_to='images')
title = models.CharField(max_length=200)
desc2 = models.TextField()

# services section
class Services(models.Model):
title = models.CharField(max_length=120)
description = models.TextField()
name = models.CharField(max_length=100)
description1 = models.TextField()from kampalavc.models import Aboutus, Services
from django.shortcuts import render

# Create your views here.

def index(request):

Abt = Aboutus.objects.all()
service = Services.objects.all()
kvc = [Abt,service]
return render(request, "index.html", {'kvc': kvc})from django.urls import path

from . import views

urlpatterns = [
path("", views.index, name="index")
]


Re: Partner

2021-06-23 Thread Arthur Obo Nwakaji
Hello, I am interested and love to know more about this opportunity. I am
well experienced in Django and DRF.

On Wed, 23 Jun 2021, 4:19 PM ericki...@gmail.com  hello guys am looking for any one good at Django and DRF i have couple of
> personal projects which needs this tech spec am not good at them if any one
> is interested plz i will be grateful
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGOrV0c%2BfTqrvFdsPUXnbrYa27ZU8BppN%3Dok2Dna%2Be8ky0Z9%3DA%40mail.gmail.com.


Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
Sorry, it's not working. I tried items_filter.form but it didn't work.
Kindly check my views.py if that'll be of any help or require any changes.


On Wed, 23 Jun 2021 at 15:02, Shailesh Yadav 
wrote:

> Okay use below in html
> {{yourmodelnameinsmall_filter.form}}
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:
>
>> This isn't working. When we are supplying a filter, the html is
>> displaying all the products irrespective of the requested.
>>
>> On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
>> shaileshyadav7...@gmail.com> wrote:
>>
>>> Can you help with what ERROR you are getting?
>>>
>>> Thanks & Regards
>>> Shailesh Yadav
>>> +91-9920886044
>>>
>>>   [image: Linkedin]
>>> 
>>>
>>>
>>>
>>> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:
>>>
 Hi,
 I've been trying to introduce a filter system in my Django-ecommerce
 website and I've been struggling despite reading the documents, etc. I am
 using 'django-filter' and below are filters.py, models.py, views.py and the
 template. To check out the project, follow the github link:
 https://github.com/First-project-01/Django-ecommerce.

 Will be grateful if anyone can sort this out. Thanks in advance.
 Regards,
 Aritra

 #filters.py
 class ProductFilter(django_filters.FilterSet):
 price = django_filters.NumberFilter()
 price__gt = django_filters.NumberFilter(field_name='price'
 , lookup_expr='gt')
 price__lt = django_filters.NumberFilter(field_name='price'
 , lookup_expr='lt')
 class Meta:
 model = Items
 fields = ['size', 'availability']

 #views.py
 class Product(ListView):
 model = Items
 paginate_by = 6
 template_name = 'products.html'
 def get_context_data(self, **kwargs):
 context = super(Product, self).get_context_data(**kwargs)
 context['filter'] = ProductFilter(self.request.GET, queryset=
 self.get_queryset())
 return context
 #models.py
 AVAILABILITY = (
 ('Y', 'Available'),
 ('N', 'Out of Stock'),
 )

 SIZES = (
 ('K', 'King - 108 x 120'),
 ('Q', 'Queen - 90 x 108')
 )
 class Items(BaseModel):
 title = models.CharField(max_length=100, null=True, blank=True)
 price = models.FloatField(null=True, blank=True)
 size = models.CharField(choices=SIZES, default=SIZES[0][0
 ], max_length=1)
 description = models.TextField(max_length=500)
 availability = models.CharField(choices=AVAILABILITY, default=
 AVAILABILITY[0][0], max_length=1)
 ...

 #product-list.html
 
  
 {{ filter.form| crispy }}
 Search
  
 

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecaduw28greFLXGqsTuit5JmCrzfHqawOU9HKvoojfXQLYtg%40mail.gmail.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 view this discussion on the web 

inspectdb errors: missing 1 required positional argument: 'collation'

2021-06-23 Thread Stephan van Beerschoten
I'm trying to recreate my models using inspectdb, but for some reason I'm 
now getting this output in my file:

from django.db import models
# Unable to inspect table 'AAA'
# The error was: () missing 1 required positional argument: 
'collation'
# Unable to inspect table 'BBB'
# The error was: () missing 1 required positional argument: 
'collation'

What's going on here? 

Thanks,
Stephan

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e08760df-95a9-43e1-b36e-514d373c838en%40googlegroups.com.


i am trying to learn django from django documentation but i am getting an error message in the first part of the documentation

2021-06-23 Thread vatsal narula


Using the URLconf defined in blogs.urls, Django tried these URL patterns, 
in this order:

admin/ The current path, polls/, didn’t match any of these. this is the 
error i am getting after i wrote the following code:

   1. 
   
   for urls.py
   from django.contrib import admin from django.urls import include, path 
   urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', 
   admin.site.urls), ] 
   2. 
   
   for polls/urls.py
   from django.urls import path from . import views urlpatterns = [ 
   path('', views.index, name='index'), ] 

3.for polls/views.py

 """ from django.http import HttpResponse
def index(request): return HttpResponse("Hello, world. You're at the polls 
index.") """ 

*how i can i remove this error in vs code*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5750b076-eddf-400d-b180-4ec7d46aa0e3n%40googlegroups.com.


Specifying a database connection for ManyToMany add()

2021-06-23 Thread Jayanth Shankar

Hi,

I am trying to add items to a ManyToMany relationship, but I would like to 
make the operation use a particular database connection, like one might do 
when calling save() on a model instance. However, looking at the source for 
ManyToMany.add(), the function defaults to checking the router's for_write 
connection.

class B(models.Model):
...

class A(models.Model):
b = models.ManyToManyField(B)
...

ideally, I would like to modify the many to many field as follows...
a = A(id=0)
for b in B.objects.all():
a.b.add(b, using="aconnection")

but this does not work. As far Is there an alternative way to insert an 
object into the ManyToMany relationship(where a db alias can be specified) 
besides add?


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a49409db-5b9a-48cd-818f-6645caa184e9n%40googlegroups.com.


Partner

2021-06-23 Thread ericki...@gmail.com
hello guys am looking for any one good at Django and DRF i have couple of 
personal projects which needs this tech spec am not good at them if any one 
is interested plz i will be grateful

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b21836a0-1b17-4467-9b3c-5aba128e2c23n%40googlegroups.com.


Re: How to insert into multiple tables cascading

2021-06-23 Thread David Crandell
Sorry customer is inherited from these types

class BaseInfo(models.Model):
contact1_first_name = models.CharField(help_text='Primary Contact First 
name', max_length=50, default=None)
contact1_last_name = models.CharField(help_text='Primary Contact Last 
name', max_length=50, default=None)
address1 = models.CharField(help_text='Address 1', max_length=50, 
default=None)
address2 = models.CharField(help_text='Address 2', max_length=50, 
default=None, blank=True)
city = models.CharField(help_text='City', max_length=50, default=None)
state = models.CharField(help_text='State', max_length=50, default=None)
zip_code = models.CharField(help_text='Postal/ZIP', max_length=20, 
default=None)
phone = models.CharField(help_text='Phone', max_length=20, default=None)
email = models.EmailField(default=None)


class Prospects(BaseInfo):
associations = models.CharField(max_length=200, default=None, null=True, 
blank=True)
company_name = models.CharField(help_text='Company Name', max_length=200, 
default=None)
contact2_first_name = models.CharField(max_length=50, null=True, blank=True)
contact2_last_name = models.CharField(max_length=50, null=True, blank=True)
contact2_phone = models.CharField(help_text='Phone', max_length=20, 
default=None, null=True, blank=True)
contact2_email = models.EmailField(default=None, null=True, blank=True)
fax = models.CharField(max_length=20, null=True, blank=True)
mobile = models.CharField(max_length=50, default=None, blank=True, 
null=True)
web_address = models.CharField(max_length=50, null=True, blank=True)
date_entered = models.DateTimeField(auto_now_add=True)
is_active = models.BooleanField(default=True)
date_turned_off = models.DateTimeField(default=None, null=True, blank=True)
notes = models.TextField(help_text='Notes', null=True, blank=True, 
default=None)

On Wednesday, June 23, 2021 at 8:34:07 AM UTC-5 David Crandell wrote:

> Thank you for your reply.
>
> here are my models. Forms below.
>
> MODELS
>
> class Customers(Prospects):
> cust_id = models.IntegerField(default=0)
> vertical_cat = models.IntegerField(default=0)
> custom_cat = models.IntegerField(default=0)
> logo = models.ImageField(default='default.png', 
> upload_to='media/cust-logos/')
> max_scripts = models.IntegerField(default=0)
> branch_custom_scripts = models.BooleanField(default=False)
> receive_emails = models.BooleanField(default=True)
> customer_rep_id = models.SmallIntegerField(default=0)
> customer_writer_id = models.SmallIntegerField(default=0)
> customer_male_vt_id = models.SmallIntegerField(default=0)
> customer_fem_vt = models.SmallIntegerField(default=0)
> customer_sales_rep = models.SmallIntegerField(default=0)
> contract_date_first = models.DateTimeField(default=None, null=True, 
> blank=True)
> contract_date_renewal = models.DateTimeField(default=None, null=True, 
> blank=True)
> contract_billing_type = models.CharField(max_length=200, null=True, 
> blank=True)
> anniversary = models.DateTimeField(default=None, null=True, blank=True)
> is_on_contract = models.BooleanField(default=False)
> internal_flag = models.IntegerField(default=0)
> shuff_freq_pref = models.SmallIntegerField(default=0)
> shuff_freq_upd = models.DateTimeField(default=None, null=True, blank=True)
> shuff_freq_7 = models.BooleanField(default=True)
> shuff_freq_14 = models.BooleanField(default=True)
> shuff_freq_30 = models.BooleanField(default=True)
> shuff_freq_60 = models.BooleanField(default=True)
> shuff_freq_90 = models.BooleanField(default=True)
> shuff_freq_180 = models.BooleanField(default=False)
> shuff_walk_thru = models.DateTimeField(default=None, null=True, blank=True)
> shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp, 
> on_delete=models.CASCADE), default=0)
> cust_classification = models.ForeignKey(CustomerClasses, 
> on_delete=models.CASCADE)
> date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
> updated_by = models.SmallIntegerField(default=0)
> audit_note = models.TextField(default=None, null=True, blank=True)
> audit_exception = models.BooleanField(default=False)
> audit_date = models.DateTimeField(auto_now_add=True)
> script_exception = models.BooleanField(default=False)
> script_exception_date = models.DateTimeField(default=None, null=True, 
> blank=True)
> reports_exception = models.BooleanField(default=False)
> reports_exception_date = models.DateTimeField(default=None, null=True, 
> blank=True)
> using_script_credits = models.BooleanField(default=False)
>
> def __str__(self):
> return self.company_name
>
> def get_absolute_url(self):
> return reverse('cust-detail', args=[self.id])
>
>
> class CustomerRegions(models.Model):
> region = models.CharField(max_length=100)
> customer = models.ForeignKey(Customers, on_delete=models.CASCADE)
>
> def __str__(self):
> return self.region
>
>
>
> FORMS
>
> class CustomerForm(forms.ModelForm):
> class Meta:
> model = Customers
> fields = 'company_name', 'contact1_first_name', \
> 'contact1_last_name', 'email', 'contact2_first_name', 

Re: How to insert into multiple tables cascading

2021-06-23 Thread David Crandell
Thank you for your reply.

here are my models. Forms below.

MODELS

class Customers(Prospects):
cust_id = models.IntegerField(default=0)
vertical_cat = models.IntegerField(default=0)
custom_cat = models.IntegerField(default=0)
logo = models.ImageField(default='default.png', 
upload_to='media/cust-logos/')
max_scripts = models.IntegerField(default=0)
branch_custom_scripts = models.BooleanField(default=False)
receive_emails = models.BooleanField(default=True)
customer_rep_id = models.SmallIntegerField(default=0)
customer_writer_id = models.SmallIntegerField(default=0)
customer_male_vt_id = models.SmallIntegerField(default=0)
customer_fem_vt = models.SmallIntegerField(default=0)
customer_sales_rep = models.SmallIntegerField(default=0)
contract_date_first = models.DateTimeField(default=None, null=True, 
blank=True)
contract_date_renewal = models.DateTimeField(default=None, null=True, 
blank=True)
contract_billing_type = models.CharField(max_length=200, null=True, 
blank=True)
anniversary = models.DateTimeField(default=None, null=True, blank=True)
is_on_contract = models.BooleanField(default=False)
internal_flag = models.IntegerField(default=0)
shuff_freq_pref = models.SmallIntegerField(default=0)
shuff_freq_upd = models.DateTimeField(default=None, null=True, blank=True)
shuff_freq_7 = models.BooleanField(default=True)
shuff_freq_14 = models.BooleanField(default=True)
shuff_freq_30 = models.BooleanField(default=True)
shuff_freq_60 = models.BooleanField(default=True)
shuff_freq_90 = models.BooleanField(default=True)
shuff_freq_180 = models.BooleanField(default=False)
shuff_walk_thru = models.DateTimeField(default=None, null=True, blank=True)
shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp, 
on_delete=models.CASCADE), default=0)
cust_classification = models.ForeignKey(CustomerClasses, 
on_delete=models.CASCADE)
date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
updated_by = models.SmallIntegerField(default=0)
audit_note = models.TextField(default=None, null=True, blank=True)
audit_exception = models.BooleanField(default=False)
audit_date = models.DateTimeField(auto_now_add=True)
script_exception = models.BooleanField(default=False)
script_exception_date = models.DateTimeField(default=None, null=True, 
blank=True)
reports_exception = models.BooleanField(default=False)
reports_exception_date = models.DateTimeField(default=None, null=True, 
blank=True)
using_script_credits = models.BooleanField(default=False)

def __str__(self):
return self.company_name

def get_absolute_url(self):
return reverse('cust-detail', args=[self.id])


class CustomerRegions(models.Model):
region = models.CharField(max_length=100)
customer = models.ForeignKey(Customers, on_delete=models.CASCADE)

def __str__(self):
return self.region



FORMS

class CustomerForm(forms.ModelForm):
class Meta:
model = Customers
fields = 'company_name', 'contact1_first_name', \
'contact1_last_name', 'email', 'contact2_first_name', \
'contact2_last_name', 'contact2_email', \
'contact2_phone', 'address1', 'address2', \
'city', 'state', 'zip_code', 'phone', \
'mobile', 'web_address', 'notes', \
'cust_classification', 'logo'

class RegionWCust(forms.ModelForm):
class Meta:
model = CustomerRegions
fields = ('region',)
On Tuesday, June 22, 2021 at 9:47:26 PM UTC-5 abubak...@gmail.com wrote:

> please share your related models and form as well.
>
> On Wed, Jun 23, 2021 at 1:22 AM David Crandell  
> wrote:
>
>> Hello, I come from a platform where I built out forms and then manually 
>> wrote insert statements from the form input entering all the data at once.
>>
>> What I want to do is enter a customer (one table), have it populate a 
>> master region with the same name (another table), then fill out a master 
>> location record (another table) and then create a user from the person 
>> profiled in the customer information (another table)
>>
>> I'm trying to go to the next page which is a location form and pass the 
>> value of the customer ID to the region form included on the same page. 
>>
>>   There has to be a better way to do this. I still have no idea how to 
>> combine and enter information into multiple models from one form. The ORM 
>> is cool but it seems so limited. I guess I just don't understand it.
>>
>> class CustomerCreateView(View):
>> template_name = 'ohnet/customer_form.html'
>> form_class = CustomerForm
>> rform = RegionWCust
>>
>> def get(self, request, *args, **kwargs):
>> form = self.form_class
>> rform = self.rform
>> return render(request, self.template_name, {'form': form, 'rform': 
>> rform})
>>
>> def post(self, request, *args, **kwargs):
>> form = self.form_class(request.POST, request.FILES)
>> rform = self.rform(request.POST)
>> if form.is_valid() and rform.is_valid():
>> form.save()
>> obj = Customers.objects.latest('id')
>> f = rform.save(commit=False)
>> f.customer_id = obj
>> 

Admin Site Permissions issue with one particular model

2021-06-23 Thread Jimmy Gawain
This is in reference to an issue with the Django admin site in Django v2.2.
I have admin set up for two models: Group and GroupMember.

GroupMember works fine.
When I try to go to the change page for a Group object in my
staff admin area I get a permission error:

*You are authenticated as XX, but are not authorized to access this 
page. Would you like to login to a different account?*

I have two admin sites, site_admin and staff_admin which I use to 
differentiate between control capabilities for the superuser and for those 
accounts that have a is_staff attribute set to True. All other staff_admin 
areas work fine.

Admin Site definitions:

class SiteAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_superuser and request.user.is_active

class StaffAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_staff and request.user.is_active

staff_admin = StaffAdminSite(name='staff')
site_admin = SiteAdminSite(name='admin')

I have an app, member, that has the two classes pertinent to this issue:

class Group(BaseModelUUID):
class Meta:
db_table = 'group'
...

class GroupMember(BaseModelUUID):
class Meta:
db_table = 'group_member'
...

I define admin areas for these models in admin.py:

from app.member.models import (
...
Group,
GroupMember,
...
)

...

@admin.register(Group)
class GroupAdmin(DjangoQLMixin,BaseModelAdmin):
...

@admin.register(GroupMember)
class GroupMemberAdmin(DjangoQLMixin,BaseModelAdmin):
...

staff_admin.register(Group,GroupAdmin)
staff_admin.register(GroupMember,GroupMemberAdmin)
...
site_admin.register(Group,GroupAdmin)
site_admin.register(GroupMember,GroupMemberAdmin)
...

I've trimmed a lot of stuff but that is because it is
exactly the same between the two models.

What could be causing this one model admin to have a permissions issue?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2630a68-93c5-4650-89bc-113540b72fb8n%40googlegroups.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Eugene TUYIZERE
Dear Franck,

The problem I have now is to configure the django app in cpanel so that
users can browse it. As I said in previous email, I already have domain and
cpanel credentials.

On Wed, 23 Jun 2021 at 12:17, Franck Tchouanga  wrote:

> Hello I can assist you what is the problem.
>
>
> On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE 
> wrote:
>
>> please assist
>>
>> On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
>> wrote:
>>
>>> Dear Team,
>>>
>>> I have an issue. I want to make my app productive. I bought a domain and
>>> I got cpanel credentials. The problem I have now is that I do not know how
>>> I can configure the app in cpanel so that users can start browsing it. I
>>> tried to connect to the database and I loaded the application files. Is
>>> there someone who can tell me all the steps I need to follow to make the
>>> app accessible? for what I have done, I am getting this error message when
>>> browsing:
>>> [image: image.png]
>>>
>>> Please assist
>>>
>>> --
>>> *Eugene*
>>>
>>>
>>>
>>
>> --
>> *TUYIZERE Eugene*
>>
>>
>>
>> *Msc Degree in Mathematical Science*
>>
>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>> Garden-Lime, Cameroon*
>>
>> Bsc in Computer Science
>>
>> *UR-Nyagatare Campus*
>>
>> Email: eugene.tuyiz...@aims-cameroon.org
>>eugenetuyiz...@gmail.com
>>
>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Best Wishes
>
> *Mr Tchouanga*
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com
> 
> .
>


-- 
*TUYIZERE Eugene*



*Msc Degree in Mathematical Science*

*African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
Garden-Lime, Cameroon*

Bsc in Computer Science

*UR-Nyagatare Campus*

Email: eugene.tuyiz...@aims-cameroon.org
   eugenetuyiz...@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABxpZHs4G05MtjQOyfrf2H4ZQfCWS63oxG4hFYXpCx4VYTzrpg%40mail.gmail.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Franck Tchouanga
Hello I can assist you what is the problem.


On Wed, Jun 23, 2021 at 9:54 AM Eugene TUYIZERE 
wrote:

> please assist
>
> On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
> wrote:
>
>> Dear Team,
>>
>> I have an issue. I want to make my app productive. I bought a domain and
>> I got cpanel credentials. The problem I have now is that I do not know how
>> I can configure the app in cpanel so that users can start browsing it. I
>> tried to connect to the database and I loaded the application files. Is
>> there someone who can tell me all the steps I need to follow to make the
>> app accessible? for what I have done, I am getting this error message when
>> browsing:
>> [image: image.png]
>>
>> Please assist
>>
>> --
>> *Eugene*
>>
>>
>>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com
> 
> .
>


-- 
Best Wishes

*Mr Tchouanga*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANRJ%3D3%3DHnyVQfMmCGpZk-cMLhZZQvqp4EHxjdh-3itcoPnFUPA%40mail.gmail.com.


Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
Okay, will try and let you know.
Thank you for your response.

On Wed, 23 Jun, 2021, 3:02 pm Shailesh Yadav, 
wrote:

> Okay use below in html
> {{yourmodelnameinsmall_filter.form}}
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:
>
>> This isn't working. When we are supplying a filter, the html is
>> displaying all the products irrespective of the requested.
>>
>> On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, <
>> shaileshyadav7...@gmail.com> wrote:
>>
>>> Can you help with what ERROR you are getting?
>>>
>>> Thanks & Regards
>>> Shailesh Yadav
>>> +91-9920886044
>>>
>>>   [image: Linkedin]
>>> 
>>>
>>>
>>>
>>> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:
>>>
 Hi,
 I've been trying to introduce a filter system in my Django-ecommerce
 website and I've been struggling despite reading the documents, etc. I am
 using 'django-filter' and below are filters.py, models.py, views.py and the
 template. To check out the project, follow the github link:
 https://github.com/First-project-01/Django-ecommerce.

 Will be grateful if anyone can sort this out. Thanks in advance.
 Regards,
 Aritra

 #filters.py
 class ProductFilter(django_filters.FilterSet):
 price = django_filters.NumberFilter()
 price__gt = django_filters.NumberFilter(field_name='price'
 , lookup_expr='gt')
 price__lt = django_filters.NumberFilter(field_name='price'
 , lookup_expr='lt')
 class Meta:
 model = Items
 fields = ['size', 'availability']

 #views.py
 class Product(ListView):
 model = Items
 paginate_by = 6
 template_name = 'products.html'
 def get_context_data(self, **kwargs):
 context = super(Product, self).get_context_data(**kwargs)
 context['filter'] = ProductFilter(self.request.GET, queryset=
 self.get_queryset())
 return context
 #models.py
 AVAILABILITY = (
 ('Y', 'Available'),
 ('N', 'Out of Stock'),
 )

 SIZES = (
 ('K', 'King - 108 x 120'),
 ('Q', 'Queen - 90 x 108')
 )
 class Items(BaseModel):
 title = models.CharField(max_length=100, null=True, blank=True)
 price = models.FloatField(null=True, blank=True)
 size = models.CharField(choices=SIZES, default=SIZES[0][0
 ], max_length=1)
 description = models.TextField(max_length=500)
 availability = models.CharField(choices=AVAILABILITY, default=
 AVAILABILITY[0][0], max_length=1)
 ...

 #product-list.html
 
  
 {{ filter.form| crispy }}
 Search
  
 

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecaduw28greFLXGqsTuit5JmCrzfHqawOU9HKvoojfXQLYtg%40mail.gmail.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 view this discussion on the web visit
> 

Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Shailesh Yadav
Okay use below in html
{{yourmodelnameinsmall_filter.form}}

Thanks & Regards
Shailesh Yadav
+91-9920886044

  [image: Linkedin] 



On Wed, Jun 23, 2021 at 2:58 PM Aritra Ray  wrote:

> This isn't working. When we are supplying a filter, the html is displaying
> all the products irrespective of the requested.
>
> On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, 
> wrote:
>
>> Can you help with what ERROR you are getting?
>>
>> Thanks & Regards
>> Shailesh Yadav
>> +91-9920886044
>>
>>   [image: Linkedin] 
>>
>>
>>
>>
>> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:
>>
>>> Hi,
>>> I've been trying to introduce a filter system in my Django-ecommerce
>>> website and I've been struggling despite reading the documents, etc. I am
>>> using 'django-filter' and below are filters.py, models.py, views.py and the
>>> template. To check out the project, follow the github link:
>>> https://github.com/First-project-01/Django-ecommerce.
>>>
>>> Will be grateful if anyone can sort this out. Thanks in advance.
>>> Regards,
>>> Aritra
>>>
>>> #filters.py
>>> class ProductFilter(django_filters.FilterSet):
>>> price = django_filters.NumberFilter()
>>> price__gt = django_filters.NumberFilter(field_name='price'
>>> , lookup_expr='gt')
>>> price__lt = django_filters.NumberFilter(field_name='price'
>>> , lookup_expr='lt')
>>> class Meta:
>>> model = Items
>>> fields = ['size', 'availability']
>>>
>>> #views.py
>>> class Product(ListView):
>>> model = Items
>>> paginate_by = 6
>>> template_name = 'products.html'
>>> def get_context_data(self, **kwargs):
>>> context = super(Product, self).get_context_data(**kwargs)
>>> context['filter'] = ProductFilter(self.request.GET, queryset=
>>> self.get_queryset())
>>> return context
>>> #models.py
>>> AVAILABILITY = (
>>> ('Y', 'Available'),
>>> ('N', 'Out of Stock'),
>>> )
>>>
>>> SIZES = (
>>> ('K', 'King - 108 x 120'),
>>> ('Q', 'Queen - 90 x 108')
>>> )
>>> class Items(BaseModel):
>>> title = models.CharField(max_length=100, null=True, blank=True)
>>> price = models.FloatField(null=True, blank=True)
>>> size = models.CharField(choices=SIZES, default=SIZES[0][0
>>> ], max_length=1)
>>> description = models.TextField(max_length=500)
>>> availability = models.CharField(choices=AVAILABILITY, default=
>>> AVAILABILITY[0][0], max_length=1)
>>> ...
>>>
>>> #product-list.html
>>> 
>>>  
>>> {{ filter.form| crispy }}
>>> Search
>>>  
>>> 
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecaduw28greFLXGqsTuit5JmCrzfHqawOU9HKvoojfXQLYtg%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQ-AEXrqujnhn3q_629ZyjCbrS31j7mtqAt9br0psKPSB53dQ%40mail.gmail.com.


Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
This isn't working. When we are supplying a filter, the html is displaying
all the products irrespective of the requested.

On Wed, 23 Jun, 2021, 2:57 pm Shailesh Yadav, 
wrote:

> Can you help with what ERROR you are getting?
>
> Thanks & Regards
> Shailesh Yadav
> +91-9920886044
>
>   [image: Linkedin] 
>
>
>
> On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:
>
>> Hi,
>> I've been trying to introduce a filter system in my Django-ecommerce
>> website and I've been struggling despite reading the documents, etc. I am
>> using 'django-filter' and below are filters.py, models.py, views.py and the
>> template. To check out the project, follow the github link:
>> https://github.com/First-project-01/Django-ecommerce.
>>
>> Will be grateful if anyone can sort this out. Thanks in advance.
>> Regards,
>> Aritra
>>
>> #filters.py
>> class ProductFilter(django_filters.FilterSet):
>> price = django_filters.NumberFilter()
>> price__gt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='gt')
>> price__lt = django_filters.NumberFilter(field_name='price'
>> , lookup_expr='lt')
>> class Meta:
>> model = Items
>> fields = ['size', 'availability']
>>
>> #views.py
>> class Product(ListView):
>> model = Items
>> paginate_by = 6
>> template_name = 'products.html'
>> def get_context_data(self, **kwargs):
>> context = super(Product, self).get_context_data(**kwargs)
>> context['filter'] = ProductFilter(self.request.GET, queryset=self
>> .get_queryset())
>> return context
>> #models.py
>> AVAILABILITY = (
>> ('Y', 'Available'),
>> ('N', 'Out of Stock'),
>> )
>>
>> SIZES = (
>> ('K', 'King - 108 x 120'),
>> ('Q', 'Queen - 90 x 108')
>> )
>> class Items(BaseModel):
>> title = models.CharField(max_length=100, null=True, blank=True)
>> price = models.FloatField(null=True, blank=True)
>> size = models.CharField(choices=SIZES, default=SIZES[0][0
>> ], max_length=1)
>> description = models.TextField(max_length=500)
>> availability = models.CharField(choices=AVAILABILITY, default=
>> AVAILABILITY[0][0], max_length=1)
>> ...
>>
>> #product-list.html
>> 
>>  
>> {{ filter.form| crispy }}
>> Search
>>  
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFecaduw28greFLXGqsTuit5JmCrzfHqawOU9HKvoojfXQLYtg%40mail.gmail.com.


Re: Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Shailesh Yadav
Can you help with what ERROR you are getting?

Thanks & Regards
Shailesh Yadav
+91-9920886044

  [image: Linkedin] 



On Wed, Jun 23, 2021 at 2:25 PM Aritra Ray  wrote:

> Hi,
> I've been trying to introduce a filter system in my Django-ecommerce
> website and I've been struggling despite reading the documents, etc. I am
> using 'django-filter' and below are filters.py, models.py, views.py and the
> template. To check out the project, follow the github link:
> https://github.com/First-project-01/Django-ecommerce.
>
> Will be grateful if anyone can sort this out. Thanks in advance.
> Regards,
> Aritra
>
> #filters.py
> class ProductFilter(django_filters.FilterSet):
> price = django_filters.NumberFilter()
> price__gt = django_filters.NumberFilter(field_name='price'
> , lookup_expr='gt')
> price__lt = django_filters.NumberFilter(field_name='price'
> , lookup_expr='lt')
> class Meta:
> model = Items
> fields = ['size', 'availability']
>
> #views.py
> class Product(ListView):
> model = Items
> paginate_by = 6
> template_name = 'products.html'
> def get_context_data(self, **kwargs):
> context = super(Product, self).get_context_data(**kwargs)
> context['filter'] = ProductFilter(self.request.GET, queryset=self.
> get_queryset())
> return context
> #models.py
> AVAILABILITY = (
> ('Y', 'Available'),
> ('N', 'Out of Stock'),
> )
>
> SIZES = (
> ('K', 'King - 108 x 120'),
> ('Q', 'Queen - 90 x 108')
> )
> class Items(BaseModel):
> title = models.CharField(max_length=100, null=True, blank=True)
> price = models.FloatField(null=True, blank=True)
> size = models.CharField(choices=SIZES, default=SIZES[0][0], max_length
> =1)
> description = models.TextField(max_length=500)
> availability = models.CharField(choices=AVAILABILITY, default=
> AVAILABILITY[0][0], max_length=1)
> ...
>
> #product-list.html
> 
>  
> {{ filter.form| crispy }}
> Search
>  
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQ-AEXsJ%2B19X3aO740%3DD%2BZUhcEYujh2FWScZDXCqM4cB0Bikg%40mail.gmail.com.


Need urgent help with filter system (django-filter) in Django

2021-06-23 Thread Aritra Ray
Hi,
I've been trying to introduce a filter system in my Django-ecommerce
website and I've been struggling despite reading the documents, etc. I am
using 'django-filter' and below are filters.py, models.py, views.py and the
template. To check out the project, follow the github link:
https://github.com/First-project-01/Django-ecommerce.

Will be grateful if anyone can sort this out. Thanks in advance.
Regards,
Aritra

#filters.py
class ProductFilter(django_filters.FilterSet):
price = django_filters.NumberFilter()
price__gt = django_filters.NumberFilter(field_name='price', lookup_expr=
'gt')
price__lt = django_filters.NumberFilter(field_name='price', lookup_expr=
'lt')
class Meta:
model = Items
fields = ['size', 'availability']

#views.py
class Product(ListView):
model = Items
paginate_by = 6
template_name = 'products.html'
def get_context_data(self, **kwargs):
context = super(Product, self).get_context_data(**kwargs)
context['filter'] = ProductFilter(self.request.GET, queryset=self.
get_queryset())
return context
#models.py
AVAILABILITY = (
('Y', 'Available'),
('N', 'Out of Stock'),
)

SIZES = (
('K', 'King - 108 x 120'),
('Q', 'Queen - 90 x 108')
)
class Items(BaseModel):
title = models.CharField(max_length=100, null=True, blank=True)
price = models.FloatField(null=True, blank=True)
size = models.CharField(choices=SIZES, default=SIZES[0][0], max_length=1
)
description = models.TextField(max_length=500)
availability = models.CharField(choices=AVAILABILITY, default=
AVAILABILITY[0][0], max_length=1)
...

#product-list.html

 
{{ filter.form| crispy }}
Search
 


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFecadtwZG0%3DLwE989gsFkusgAnAGkvEspF3i5WC1-uWO6OOHw%40mail.gmail.com.


Re: Deploy Django app using cpanel

2021-06-23 Thread Eugene TUYIZERE
please assist

On Tue, 22 Jun 2021 at 13:03, Eugene TUYIZERE 
wrote:

> Dear Team,
>
> I have an issue. I want to make my app productive. I bought a domain and I
> got cpanel credentials. The problem I have now is that I do not know how I
> can configure the app in cpanel so that users can start browsing it. I
> tried to connect to the database and I loaded the application files. Is
> there someone who can tell me all the steps I need to follow to make the
> app accessible? for what I have done, I am getting this error message when
> browsing:
> [image: image.png]
>
> Please assist
>
> --
> *Eugene*
>
>
>

-- 
*TUYIZERE Eugene*



*Msc Degree in Mathematical Science*

*African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
Garden-Lime, Cameroon*

Bsc in Computer Science

*UR-Nyagatare Campus*

Email: eugene.tuyiz...@aims-cameroon.org
   eugenetuyiz...@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABxpZHt5TP8LK%2ByELRcC0sZwJ4WUTw7_PAp7%3DpsS%3DKTnG8zRNw%40mail.gmail.com.


Re: In need of urgent help regarding dynamic image display v

2021-06-23 Thread Aritra Ray
Thank you, it worked.


On Fri, 18 Jun 2021 at 00:08, Ayush Bisht  wrote:

> I think there is 2 method which you can do to get the work done. ...
>
> *1 : first one* .. you can declare a property decorator which just return
> the url of that image
>
>
>   class Banner(BaseModel):
> image = ResizedImageField(upload_to="banner", null=True,
> blank=True)
>
> @property
>   def get_image_url(self):
>   return str(self.image.url).replace(" ", "")
>
> and then you can simply access this function like normal attributes..
>
>  
> {% for banner in banners %}
> 
> {% endfor %}
>
> 
>
>
> *2 Method :  *you can create a   root path for static files as well
>
>
> STATIC_URL = '/static/'
> STATICFILES_DIRS = [os.path.join(BASE_DIR,'static')]
>
>
> now , with this root path I can access all the file belonging to that
> particular folder 
>
> folder structure ...
>
> * static
>*Banner
>  *banner1.jpg
>
>
>
> now u can simply access all the stuff ...
>
> .banner-item-01 {
> padding:300px 0px;
> background-size: cover;
> background-image: url('/static/Banner/banner1.jpg');
> background-repeat: no-repeat;
> background-position: center center;
> }
>
> On Thursday, June 17, 2021 at 4:11:11 AM UTC-7 arit...@gmail.com wrote:
>
>> Hi,
>> I've been building a Django E-commerce website and I'm facing this
>> problem.
>> I have created a Banner model which will take in images via
>> django.ResizedImage and then display it in the homepage. But I'm unable to
>> process them in CSS.
>> Kindly help me out.
>>
>> PS: I'll have to process it as background-image orelse when passed as
>>  in html, we're getting extra wrapped spaces which aren't needed.
>>
>> Below given are: views.py, models.py, index.html, css block.
>> Kindly help me out as it is urgent. Thank you for your support in advance.
>>
>> Regards,
>> Aritra
>>
>> class HomeView(ListView):
>> context_object_name = 'items'
>> template_name = "index.html"
>> queryset = Items.objects.all()
>>
>> def get_context_data(self, **kwargs):
>> context = super(HomeView, self).get_context_data(**kwargs)
>> context['banners'] = Banner.objects.all()
>> return context
>>
>> class Banner(BaseModel):
>> image = ResizedImageField(upload_to="banner", null=True, blank=True)
>>
>> 
>> 
>>   {% for banner in banners %}
>> > {{banner.image.url}}>
>>   {% endfor %}
>> 
>> 
>>
>>   .banner-item-01 {
>>padding:300px 0px;
>>background-size: cover;
>>background-image: url(var(--item));
>>background-repeat: no-repeat;
>>background-position: center center;
>> }
>>
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/241a1f08-a093-4f3a-a01f-46e0a3e73ce1n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFecadu_Gjnr4nzRV_GEkfCpG%3DGWP%3DaNKoR0yZxqzqk8cE3MGQ%40mail.gmail.com.


Manager.raw() in a class method

2021-06-23 Thread Daniel Sears
I have a SQL function that works when I run it directly from an SQL script
and now I'm trying to run it with Manager.raw() in a model method. I wrote
a model instance method that worked fine:

def get_store_products_sql(self) -> list['Product']:
return Product.objects.raw(
 '''SELECT  prod_id AS id,
prod_name,
prod_price
  FROM  get_store_products(%s)''',
 [self.id]
  )

Now I'm trying to write a similar class method:

@classmethod
def get_products_by_color_sql(cls, color) -> list['Product']:
return Product.objects.raw(
 '''SELECT  prod_id AS id,
prod_name,
prod_price
  FROM
 get_products_by_color(%s)''',
 [color]
  )

This fails pretty silently without even entering
get_products_by_color(). color is a legal string and I've also tried simply
using "green" without any luck.

As I said, this isn't even getting into the get_products_by_color()
function, so I doubt that's the problem. It appears to be either a problem
with calling Manager.raw() in a class method or a problem with the color
string.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLzXtQ2a4wd4O69OSL1jEo1YNAuSQCPTJ%2B2LayqGYJ5kUsOHA%40mail.gmail.com.


Re: Django Admin: object history not working

2021-06-23 Thread Christian Ledermann
See
https://stackoverflow.com/questions/987669/tying-in-to-django-admins-model-history
for a better explanation and alternatives

On Tue, 22 Jun 2021 at 18:59, Ryan Kite  wrote:

>
> Thanks for the clarification, I didn't realize it only applied to changes
> administered directly from the Django Admin.
> Was interested in learning about an objects' change history, but in this
> case, the changes were not performed from the Django Admin.
>
>
> On Tuesday, June 22, 2021 at 5:50:10 AM UTC-7 christian...@gmail.com
> wrote:
>
>> I am not sure what you are asking about.
>> The history works out of the box, but only when you manipulate entries
>> via the django admin.
>> When you change the model instance through your own views, you have to
>> explicitly create the log entry.
>>
>> On Tue, 22 Jun 2021 at 00:48, Ryan Kite  wrote:
>>
>>> Hello,
>>>
>>> The issue is when clicking the "History" button on an object from the
>>> Django admin site, it opens to the template but says "*This object
>>> doesn't have a change history. It probably wasn't added via this admin
>>> site."*
>>>
>>> From reading the docs it appears that: *history_view*() already exists
>>> (which is what I want)
>>>
>>> /// from the doc page:
>>> ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
>>> [source]
>>> 
>>> ¶
>>> 
>>>
>>>  Django view for the page that shows the modification history for a
>>> given model instance.
>>>
>>> ///
>>>
>>> We can see the change history when doing:
>>>
>>>  python manage.shell
>>>
>>> import django.contrib.admin.models import LogEntry
>>> from django.contrib.contenttypes.models import ContentType
>>> from app import MyModel
>>>
>>>  results =
>>> LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel
>>> ))
>>>
>>> print(vars(results[1]))
>>>
>>> .. shows the change details
>>>
>>> Please tell me what I'm missing or need to add.
>>>
>>>
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Dublin, IE
>> Mobile : +353 (0) 899748838
>>
>> https://www.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cc8975e1-8b77-4316-92df-909eecaad98cn%40googlegroups.com
> 
> .
>


-- 
Best Regards,

Christian Ledermann

Dublin, IE
Mobile : +353 (0) 899748838

https://www.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABCjzWq3UhJwtyz%2BQbAaAJg-ganZCr-JL%2BSXLdxrCYOruQ3pqQ%40mail.gmail.com.